Skip to content

Commit

Permalink
merge from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
marivas committed Sep 7, 2012
2 parents 6485b14 + a4c89bd commit d3065f2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
22 changes: 19 additions & 3 deletions prelude/prelude-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ there's a region, all lines that region covers will be duplicated."
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
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))
Expand All @@ -348,13 +348,22 @@ 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
,(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")))

(defun prelude-create-scratch-buffer ()
"Create a new scratch buffer."
(interactive)
(progn
(switch-to-buffer
(get-buffer-create (generate-new-buffer-name "*scratch*")))
(emacs-lisp-mode)))

(defvar prelude-tips
'("Press <C-c o> to open a file with external program."
"Press <C-c p f> to navigate a project's files with ido."
Expand All @@ -368,7 +377,8 @@ and so on."

(defun prelude-tip-of-the-day ()
(interactive)
(message (concat "Prelude tip: " (nth (random (length prelude-tips)) prelude-tips))))
(message
(concat "Prelude tip: " (nth (random (length prelude-tips)) prelude-tips))))

(defun prelude-eval-after-init (form)
"Add `(lambda () FORM)' to `after-init-hook'.
Expand All @@ -379,5 +389,11 @@ and so on."
(when after-init-time
(eval form))))

(defun prelude-exchange-point-and-mark ()
"Identical to `exchange-point-and-mark' but will not activate the region."
(interactive)
(exchange-point-and-mark)
(deactivate-mark nil))

(provide 'prelude-core)
;;; prelude-core.el ends here
2 changes: 2 additions & 0 deletions prelude/prelude-global-keybindings.el
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@
(global-set-key (kbd "C-=") 'er/expand-region)
(global-set-key (kbd "C-c w") (make-repeatable-command 'er/expand-region))

(define-key global-map [remap exchange-point-and-mark] 'prelude-exchange-point-and-mark)

(provide 'prelude-global-keybindings)

;;; prelude-global-keybindings.el ends here

0 comments on commit d3065f2

Please sign in to comment.