fixed #89 - changed er/expand-region's default keybinding to C-c w

This commit is contained in:
Bozhidar Batsov 2012-03-09 16:20:46 +02:00
parent 811bf29287
commit 78bd021354
3 changed files with 26 additions and 1 deletions

View file

@ -360,5 +360,29 @@ there's a region, all lines that region covers will be duplicated."
(global-set-key [M-left] 'left-word)
(message "Arrow keys navigation in buffers in now allowed."))
(require 'repeat)
(defun make-repeatable-command (cmd)
"Returns a new command that is a repeatable version of CMD.
The new command is named CMD-repeat. CMD should be a quoted
command.
This allows you to bind the command to a compound keystroke and
repeat it with just the final key. For example:
(global-set-key (kbd \"C-c a\") (make-repeatable-command 'foo))
will create a new command called foo-repeat. Typing C-c a will
just invoke foo. Typing C-c a a a will invoke foo three times,
and so on."
(fset (intern (concat (symbol-name cmd) "-repeat"))
`(lambda ,(help-function-arglist cmd) ;; arg list
,(format "A repeatable version of `%s'." (symbol-name cmd)) ;; doc string
,(interactive-form cmd) ;; interactive form
;; see also repeat-message-function
(setq last-repeatable-command ',cmd)
(repeat nil)))
(intern (concat (symbol-name cmd) "-repeat")))
(provide 'prelude-core)
;;; prelude-core.el ends here

View file

@ -193,7 +193,6 @@
(put 'downcase-region 'disabled nil)
(require 'expand-region)
(global-set-key (kbd "C-@") 'er/expand-region)
;; bookmarks
(setq bookmark-default-file (concat user-emacs-directory "bookmarks")

View file

@ -104,6 +104,8 @@
(global-set-key (kbd "C-x g") 'magit-status)
(global-set-key (kbd "C-c w") (make-repeatable-command 'er/expand-region))
(provide 'prelude-global-keybindings)
;;; prelude-global-keybindings.el ends here