Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into myguidingstar
Browse files Browse the repository at this point in the history
* upstream/master:
  use https when piping to sh for install
  [Fix bbatsov#827] Make it possible to disable the tips
  Use jump to word or subword by default
  Don't open a file as root if it is owned by the current user
  Change how the "re-open file as root" functionality works
  Extract a function for reopening a file as root
  Make it possible to stop prelude loading any theme at all
  [Fix bbatsov#847] Restore ace-window
  Track upstream changes in avy
  Replace ace-jump-mode with avy
  Don't disabling which-function-mode in Python
  Enable the mode in a definite way
  Use sbcl in the absence of ccl on OS X
  Improve slime repl
  Add tip on keyboard shortcut for ace-jump-mode
  Auto install cmake-mode
  Enable ERC spell mode only if prelude-flyspell
  Fixed the problem with ido/untabify defadvice triggering got redefined error
  • Loading branch information
myguidingstar committed Jun 17, 2015
2 parents 459728d + e65c39e commit 681ba8b
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 29 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ can skip the whole manual and just type in your favorite shell the
following command:

```bash
curl -L http://git.io/epre | sh
curl -L https://git.io/epre | sh
```

You can now power up your Emacs, sit back and enjoy Prelude,
Expand Down Expand Up @@ -279,7 +279,6 @@ Keybinding | Description
<kbd>F12</kbd> | Toggle the Emacs menu bar.
<kbd>C-x g</kbd> | Open Magit's status buffer.
<kbd>M-Z</kbd> | Zap up to char.
<kbd>C-c J</kbd> or <kbd>Super-></kbd> | Switch between buffers with [`ace-jump-buffer`](https://github.com/waymondo/ace-jump-buffer)
<kbd>C-=</kbd> | Run `expand-region` (incremental text selection).
<kbd>C-a</kbd> | Run `prelude-move-beginning-of-line`. Read [this](http://emacsredux.com/blog/2013/05/22/smarter-navigation-to-the-beginning-of-a-line/) for details.

Expand Down Expand Up @@ -429,9 +428,9 @@ buffer. Passing prefix argument **BEFORE** =helm-M-x= **has no effect**.

Keybinding | Description
-------------------|----------------------------------------------
<kbd>jj</kbd> | Jump to the beginning of a word(`ace-jump-word-mode`)
<kbd>jk</kbd> | Jump to a character(`ace-jump-char-mode`)
<kbd>jl</kbd> | Jump to the beginning of a line(`ace-jump-line-mode`)
<kbd>jj</kbd> | Jump to the beginning of a word(`avy-goto-word-1`)
<kbd>jk</kbd> | Jump to a character(`avy-goto-char`)
<kbd>jl</kbd> | Jump to the beginning of a line(`avy-goto-line`)
<kbd>JJ</kbd> | Jump back to previous buffer(`prelude-switch-to-previous-buffer`)
<kbd>uu</kbd> | View edits as a tree(`undo-tree-visualize`)
<kbd>xx</kbd> | Executed extended command(`execute-extended-command`)
Expand Down Expand Up @@ -500,6 +499,13 @@ Or you can use another theme altogether by adding something in `personal/preload
install it from MELPA first (`M-x package-install RET
solarized-theme`).

Finally, if you don't want any theme at all, you can add this to your
`personal/preload`:

```lisp
(setq prelude-theme nil)
```

### Personalizing

Fork the official Prelude repo and add your own touch to it. You're advised to avoid changing stuff outside of the
Expand Down
29 changes: 24 additions & 5 deletions core/prelude-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,22 @@ there's a region, all lines that region covers will be duplicated."
(interactive)
(byte-recompile-directory prelude-dir 0))

(defun prelude-file-owner-uid (filename)
"Return the UID of the FILENAME as an integer.
See `file-attributes' for more info."
(nth 2 (file-attributes filename 'integer)))

(defun prelude-file-owned-by-user-p (filename)
"Return t if file FILENAME is owned by the currently logged in user."
(equal (prelude-file-owner-uid filename)
(user-uid)))

(defun prelude-find-alternate-file-as-root (filename)
"Wraps `find-alternate-file' with opening a file as root."
(find-alternate-file (concat "/sudo:root@localhost:" filename)))

(require 'ido)
(defun prelude-sudo-edit (&optional arg)
"Edit currently visited file as root.
Expand All @@ -295,15 +311,17 @@ buffer is not visiting a file."
(if (or arg (not buffer-file-name))
(find-file (concat "/sudo:root@localhost:"
(ido-read-file-name "Find file(as root): ")))
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
(prelude-find-alternate-file-as-root buffer-file-name)))

(defadvice ido-find-file (after find-file-sudo activate)
(defun prelude-reopen-as-root ()
"Find file as root if necessary."
(unless (or (tramp-tramp-file-p buffer-file-name)
(equal major-mode 'dired-mode)
(not (file-exists-p (file-name-directory buffer-file-name)))
(file-writable-p buffer-file-name))
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
(file-writable-p buffer-file-name)
(prelude-file-owned-by-user-p buffer-file-name))
(prelude-find-alternate-file-as-root buffer-file-name)))
(add-hook 'find-file-hook 'prelude-reopen-as-root)

(defun prelude-start-or-switch-to (function buffer-name)
"Invoke FUNCTION if there is no buffer with BUFFER-NAME.
Expand Down Expand Up @@ -394,6 +412,7 @@ Doesn't mess with special buffers."
"Press <C-Backspace> to kill a line backwards."
"Press <C-S-Backspace> or <s-k> to kill the whole line."
"Press <s-j> or <C-^> to join lines."
"Press <s-.> or <C-c j> to jump to the start of a word in any visible window."
"Press <f11> to toggle fullscreen mode."
"Press <f12> to toggle the menu bar."
"Explore the Tools->Prelude menu to find out about some of Prelude extensions to Emacs."
Expand All @@ -403,7 +422,7 @@ Doesn't mess with special buffers."
(defun prelude-tip-of-the-day ()
"Display a random entry from `prelude-tips'."
(interactive)
(unless (window-minibuffer-p)
(when (and prelude-tips (not (window-minibuffer-p)))
;; pick a new random seed
(random t)
(message
Expand Down
7 changes: 7 additions & 0 deletions core/prelude-editor.el
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,12 @@ The body of the advice is in BODY."
(setq projectile-cache-file (expand-file-name "projectile.cache" prelude-savefile-dir))
(projectile-global-mode t)

;; avy allows us to effectively navigate to visible things
(require 'avy)
(setq avy-background t)
(setq avy-style 'at-full)
(setq avy-style 'at-full)

;; anzu-mode enhances isearch & query-replace by showing total matches and current match position
(require 'anzu)
(diminish 'anzu-mode)
Expand Down Expand Up @@ -298,6 +304,7 @@ The body of the advice is in BODY."
(interactive
(list (not (region-active-p)))))

(require 'tabify)
(defmacro with-region-or-buffer (func)
"When called with no active region, call FUNC on current buffer."
`(defadvice ,func (before with-region-or-buffer activate compile)
Expand Down
6 changes: 2 additions & 4 deletions core/prelude-global-keybindings.el
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,8 @@

(global-set-key (kbd "C-=") 'er/expand-region)

(global-set-key (kbd "C-c j") 'ace-jump-mode)
(global-set-key (kbd "s-.") 'ace-jump-mode)
(global-set-key (kbd "C-c J") 'ace-jump-buffer)
(global-set-key (kbd "s->") 'ace-jump-buffer)
(global-set-key (kbd "C-c j") 'avy-goto-word-or-subword-1)
(global-set-key (kbd "s-.") 'avy-goto-word-or-subword-1)
(global-set-key (kbd "s-w") 'ace-window)

(provide 'prelude-global-keybindings)
Expand Down
7 changes: 4 additions & 3 deletions core/prelude-packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@
(package-initialize)

(defvar prelude-packages
'(ace-jump-mode
ace-jump-buffer
ace-window
'(ace-window
avy
anzu
browse-kill-ring
dash
Expand Down Expand Up @@ -127,6 +126,8 @@ PACKAGE is installed only if not already present. The file is opened in MODE."

(defvar prelude-auto-install-alist
'(("\\.clj\\'" clojure-mode clojure-mode)
("\\.cmake\\'" cmake-mode cmake-mode)
("CMakeLists\\.txt\\'" cmake-mode cmake-mode)
("\\.coffee\\'" coffee-mode coffee-mode)
("\\.css\\'" css-mode css-mode)
("\\.csv\\'" csv-mode csv-mode)
Expand Down
3 changes: 2 additions & 1 deletion core/prelude-ui.el
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
"%b"))))

;; use zenburn as the default theme
(load-theme prelude-theme t)
(when prelude-theme
(load-theme prelude-theme t))

(provide 'prelude-ui)
;;; prelude-ui.el ends here
12 changes: 10 additions & 2 deletions modules/prelude-common-lisp.el
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,22 @@
(sbcl ("sbcl" "--noinform") :coding-system utf-8-unix)))

;; select the default value from slime-lisp-implementations
(if (eq system-type 'darwin)
(if (and (eq system-type 'darwin)
(executable-find "ccl"))
;; default to Clozure CL on OS X
(setq slime-default-lisp 'ccl)
;; default to SBCL on Linux and Windows
(setq slime-default-lisp 'sbcl))

;; Add fancy slime contribs
(setq slime-contribs '(slime-fancy))

(add-hook 'lisp-mode-hook (lambda () (run-hooks 'prelude-lisp-coding-hook)))
(add-hook 'slime-repl-mode-hook (lambda () (run-hooks 'prelude-interactive-lisp-coding-hook)))
;; rainbow-delimeters messes up colors in slime-repl, and doesn't seem to work
;; anyway, so we won't use prelude-lisp-coding-defaults.
(add-hook 'slime-repl-mode-hook (lambda ()
(smartparens-strict-mode +1)
(whitespace-mode -1)))

(eval-after-load "slime"
'(progn
Expand Down
3 changes: 2 additions & 1 deletion modules/prelude-erc.el
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
(erc-truncate-mode +1)

;; enable spell checking
(erc-spelling-mode 1)
(when prelude-flyspell
(erc-spelling-mode 1))
;; set different dictionaries by different servers/channels
;;(setq erc-spelling-dictionaries '(("#emacs" "american")))

Expand Down
4 changes: 2 additions & 2 deletions modules/prelude-evil.el
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@

(setq evil-shift-width 2)

;;; enable ace-jump mode with evil-mode
(define-key evil-normal-state-map (kbd "SPC") 'ace-jump-mode)
;;; enable avy with evil-mode
(define-key evil-normal-state-map (kbd "SPC") 'avy-goto-word-1)

;;; snagged from Eric S. Fraga
;;; http://lists.gnu.org/archive/html/emacs-orgmode/2012-05/msg00153.html
Expand Down
6 changes: 3 additions & 3 deletions modules/prelude-key-chord.el
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@

(require 'key-chord)

(key-chord-define-global "jj" 'ace-jump-word-mode)
(key-chord-define-global "jl" 'ace-jump-line-mode)
(key-chord-define-global "jk" 'ace-jump-char-mode)
(key-chord-define-global "jj" 'avy-goto-word-1)
(key-chord-define-global "jl" 'avy-goto-line)
(key-chord-define-global "jk" 'avy-goto-char)
(key-chord-define-global "JJ" 'prelude-switch-to-previous-buffer)
(key-chord-define-global "uu" 'undo-tree-visualize)
(key-chord-define-global "xx" 'execute-extended-command)
Expand Down
5 changes: 2 additions & 3 deletions modules/prelude-python.el
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@
(defun prelude-python-mode-defaults ()
"Defaults for Python programming."
(subword-mode +1)
(anaconda-mode)
(eldoc-mode)
(which-function-mode -1)
(anaconda-mode 1)
(eldoc-mode 1)
(setq-local electric-layout-rules
'((?: . (lambda ()
(and (zerop (first (syntax-ppss)))
Expand Down

0 comments on commit 681ba8b

Please sign in to comment.