diff --git a/README.md b/README.md index ce1c144cd4..7707c01ef4 100644 --- a/README.md +++ b/README.md @@ -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, @@ -279,7 +279,6 @@ Keybinding | Description F12 | Toggle the Emacs menu bar. C-x g | Open Magit's status buffer. M-Z | Zap up to char. -C-c J or Super-> | Switch between buffers with [`ace-jump-buffer`](https://github.com/waymondo/ace-jump-buffer) C-= | Run `expand-region` (incremental text selection). C-a | 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. @@ -429,9 +428,9 @@ buffer. Passing prefix argument **BEFORE** =helm-M-x= **has no effect**. Keybinding | Description -------------------|---------------------------------------------- -jj | Jump to the beginning of a word(`ace-jump-word-mode`) -jk | Jump to a character(`ace-jump-char-mode`) -jl | Jump to the beginning of a line(`ace-jump-line-mode`) +jj | Jump to the beginning of a word(`avy-goto-word-1`) +jk | Jump to a character(`avy-goto-char`) +jl | Jump to the beginning of a line(`avy-goto-line`) JJ | Jump back to previous buffer(`prelude-switch-to-previous-buffer`) uu | View edits as a tree(`undo-tree-visualize`) xx | Executed extended command(`execute-extended-command`) @@ -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 diff --git a/core/prelude-core.el b/core/prelude-core.el index a9e1167c45..c59028e498 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -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. @@ -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. @@ -394,6 +412,7 @@ Doesn't mess with special buffers." "Press to kill a line backwards." "Press or to kill the whole line." "Press or to join lines." + "Press or to jump to the start of a word in any visible window." "Press to toggle fullscreen mode." "Press to toggle the menu bar." "Explore the Tools->Prelude menu to find out about some of Prelude extensions to Emacs." @@ -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 diff --git a/core/prelude-editor.el b/core/prelude-editor.el index b116335ae9..65d84c7e0f 100644 --- a/core/prelude-editor.el +++ b/core/prelude-editor.el @@ -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) @@ -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) diff --git a/core/prelude-global-keybindings.el b/core/prelude-global-keybindings.el index 5bfa1c3323..683a0a2cdb 100644 --- a/core/prelude-global-keybindings.el +++ b/core/prelude-global-keybindings.el @@ -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) diff --git a/core/prelude-packages.el b/core/prelude-packages.el index ced3895ece..04eeca52a4 100644 --- a/core/prelude-packages.el +++ b/core/prelude-packages.el @@ -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 @@ -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) diff --git a/core/prelude-ui.el b/core/prelude-ui.el index 3544051a45..bf59f5772d 100644 --- a/core/prelude-ui.el +++ b/core/prelude-ui.el @@ -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 diff --git a/modules/prelude-common-lisp.el b/modules/prelude-common-lisp.el index 718a9e5111..ae6ff2d4d4 100644 --- a/modules/prelude-common-lisp.el +++ b/modules/prelude-common-lisp.el @@ -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 diff --git a/modules/prelude-erc.el b/modules/prelude-erc.el index 4a9c94bf0c..9f51938fb5 100644 --- a/modules/prelude-erc.el +++ b/modules/prelude-erc.el @@ -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"))) diff --git a/modules/prelude-evil.el b/modules/prelude-evil.el index e0d705bac6..1998fbce6b 100644 --- a/modules/prelude-evil.el +++ b/modules/prelude-evil.el @@ -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 diff --git a/modules/prelude-key-chord.el b/modules/prelude-key-chord.el index d329ee069f..fbaf5b7bf7 100644 --- a/modules/prelude-key-chord.el +++ b/modules/prelude-key-chord.el @@ -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) diff --git a/modules/prelude-python.el b/modules/prelude-python.el index 8b717019e4..7def5fd799 100644 --- a/modules/prelude-python.el +++ b/modules/prelude-python.el @@ -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)))