From 6be5444ed4e79a403116be574c6917ec8ecc20db Mon Sep 17 00:00:00 2001 From: Abizer Nasir <abizern@abizern.org> Date: Sun, 31 Mar 2013 12:31:40 +0100 Subject: [PATCH 1/4] Correct link, spelling, and markup in Readme --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 43c454f..7a919e5 100644 --- a/README.md +++ b/README.md @@ -187,7 +187,7 @@ extensions to keybindings. Keybinding | Description -------------------|------------------------------------------------------------ <kbd>C-M-h</kbd> | Kill the previous word(`backward-kill-word`). (as in Bash/Zsh) -<kbd>C-x \</kbd> | `align-regexp` +<kbd>C-x \\</kbd> | `align-regexp` <kbd>C-+</kbd> | Increase font size(`text-scale-increase`). <kbd>C--</kbd> | Decrease font size(`text-scale-decrease`). <kbd>C-x O</kbd> | Go back to previous window (the inverse of `other-window` (`C-x o`)). @@ -197,7 +197,7 @@ Keybinding | Description <kbd>C-x M-m</kbd> | Start your default shell. <kbd>C-x C-m</kbd> | Alias for `M-x`. <kbd>C-h A</kbd> | Run `apropos` (search in all Emacs symbols). -<kbd>M-\</kbd> | Run `hippie-expand` (a replacement for the default `dabbrev-expand`). +<kbd>M-\\</kbd> | Run `hippie-expand` (a replacement for the default `dabbrev-expand`). <kbd>C-x C-b</kbd> | Open `ibuffer` (a replacement for the default `buffer-list`). <kbd>F12</kbd> | Toggle the Emacs menu bar. <kbd>C-x g</kbd> | Open Magit's status buffer. @@ -213,8 +213,8 @@ Keybinding | Description <kbd>C-S-up</kbd> | Move the current line up. <kbd>C-S-down</kbd> | Move the current line down. <kbd>C-c n</kbd> | Fix indentation in buffer and strip whitespace. -<kbd>C-c f</kbd> | Open recently visitted file. -<kbd>C-M-\</kbd> | Indent region (if selected) or the entire buffer. +<kbd>C-c f</kbd> | Open recently visited file. +<kbd>C-M-\\</kbd> | Indent region (if selected) or the entire buffer. <kbd>C-c u</kbd> | Open URL in your default browser. <kbd>C-c e</kbd> | Eval a bit of Emacs Lisp code and replace it with its result. <kbd>C-c s</kbd> | Swap two active windows. @@ -226,7 +226,7 @@ Keybinding | Description #### Projectile -Here's a list of functionality provided by [Projectile](https://github.com/bbatsov/prelude): +Here's a list of functionality provided by [Projectile](https://github.com/bbatsov/projectile): Keybinding | Description -------------------|------------------------------------------------------------ From 773578d2557af84be4aa75f660f7889e80beb94b Mon Sep 17 00:00:00 2001 From: Abizer Nasir <abizern@abizern.org> Date: Sun, 31 Mar 2013 13:20:36 +0100 Subject: [PATCH 2/4] Add prelude-smart-open-line-above defun to prelude-core.el Opens a line above the current line and indents it. The counterpart to prelude-smart-open-line (bound to S-ret) The new defun is bound to C-S-ret and is documented in the README. --- README.md | 1 + core/prelude-core.el | 9 +++++++++ core/prelude-mode.el | 1 + 3 files changed, 11 insertions(+) diff --git a/README.md b/README.md index 7a919e5..0466e02 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,7 @@ Keybinding | Description -------------------|------------------------------------------------------------ <kbd>C-c o</kbd> | Open the currently visited file with an external program. <kbd>C-c g</kbd> | Search in Google for the thing under point (or an interactive query). +<kbd>C-S-RET</kbd> | Insert an empty line above the current line and indent it properly <kbd>S-RET</kbd> | Insert an empty line and indent it properly (as in most IDEs). <kbd>C-S-up</kbd> | Move the current line up. <kbd>C-S-down</kbd> | Move the current line down. diff --git a/core/prelude-core.el b/core/prelude-core.el index b0f2b90..2a2da0b 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -79,6 +79,15 @@ (indent-rigidly (point-min) (point-max) arg) (clipboard-kill-ring-save (point-min) (point-max))))) +(defun prelude-smart-open-line-above () + "Insert an empty line above the current line. +Position the cursor at it's beginning, according to the current mode" + (interactive) + (beginning-of-line) + (newline) + (forward-line -1) + (indent-according-to-mode)) + (defun prelude-smart-open-line () "Insert an empty line after the current line. Position the cursor at its beginning, according to the current mode." diff --git a/core/prelude-mode.el b/core/prelude-mode.el index 17aa6fb..f99a010 100644 --- a/core/prelude-mode.el +++ b/core/prelude-mode.el @@ -39,6 +39,7 @@ (define-key map (kbd "C-c g") 'prelude-google) ;; mimic popular IDEs binding, note that it doesn't work in a terminal session (define-key map [(shift return)] 'prelude-smart-open-line) + (define-key map [(control shift return)] 'prelude-smart-open-line-above) (define-key map [(control shift up)] 'prelude-move-line-up) (define-key map [(control shift down)] 'prelude-move-line-down) (define-key map (kbd "C-c n") 'prelude-cleanup-buffer) From d4bf21e6be8c3e9819ed3eab03d90372fc9ba24a Mon Sep 17 00:00:00 2001 From: Abizer Nasir <abizern@abizern.org> Date: Sun, 31 Mar 2013 13:23:34 +0100 Subject: [PATCH 3/4] Minor corrections to doc lines in prelude-core They sound better grammatically. --- core/prelude-core.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/prelude-core.el b/core/prelude-core.el index 2a2da0b..21fc85f 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -96,13 +96,13 @@ Position the cursor at its beginning, according to the current mode." (newline-and-indent)) (defun prelude-move-line-up () - "Move up the current line." + "Move the current line up." (interactive) (transpose-lines 1) (forward-line -2)) (defun prelude-move-line-down () - "Move down the current line." + "Move the current line down." (interactive) (forward-line 1) (transpose-lines 1) From f0c2618a3eaca46ba858b31d81dceaa13a78f7f2 Mon Sep 17 00:00:00 2001 From: Abizer Nasir <abizern@abizern.org> Date: Sun, 31 Mar 2013 15:52:06 +0100 Subject: [PATCH 4/4] Simplify implementation of prelude-smart-open-line-above As suggested by bbatsov. --- core/prelude-core.el | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/prelude-core.el b/core/prelude-core.el index 21fc85f..7ad9ab2 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -83,10 +83,8 @@ "Insert an empty line above the current line. Position the cursor at it's beginning, according to the current mode" (interactive) - (beginning-of-line) - (newline) - (forward-line -1) - (indent-according-to-mode)) + (previous-line) + (prelude-smart-open-line)) (defun prelude-smart-open-line () "Insert an empty line after the current line.