made C-x C-x (exchange mark and point) transient-mark-mode friendly

This commit is contained in:
Bozhidar Batsov 2012-09-06 22:42:07 +03:00
parent 84ec2fe1e9
commit a4c89bd91c
2 changed files with 15 additions and 4 deletions

View file

@ -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 The new command is named CMD-repeat. CMD should be a quoted
command. 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: repeat it with just the final key. For example:
(global-set-key (kbd \"C-c a\") (make-repeatable-command 'foo)) (global-set-key (kbd \"C-c a\") (make-repeatable-command 'foo))
@ -348,7 +348,8 @@ just invoke foo. Typing C-c a a a will invoke foo three times,
and so on." and so on."
(fset (intern (concat (symbol-name cmd) "-repeat")) (fset (intern (concat (symbol-name cmd) "-repeat"))
`(lambda ,(help-function-arglist cmd) ;; arg list `(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 ,(interactive-form cmd) ;; interactive form
;; see also repeat-message-function ;; see also repeat-message-function
(setq last-repeatable-command ',cmd) (setq last-repeatable-command ',cmd)
@ -359,7 +360,8 @@ and so on."
"Create a new scratch buffer." "Create a new scratch buffer."
(interactive) (interactive)
(progn (progn
(switch-to-buffer (get-buffer-create (generate-new-buffer-name "*scratch*"))) (switch-to-buffer
(get-buffer-create (generate-new-buffer-name "*scratch*")))
(emacs-lisp-mode))) (emacs-lisp-mode)))
(defvar prelude-tips (defvar prelude-tips
@ -375,7 +377,8 @@ and so on."
(defun prelude-tip-of-the-day () (defun prelude-tip-of-the-day ()
(interactive) (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) (defun prelude-eval-after-init (form)
"Add `(lambda () FORM)' to `after-init-hook'. "Add `(lambda () FORM)' to `after-init-hook'.
@ -386,5 +389,11 @@ and so on."
(when after-init-time (when after-init-time
(eval form)))) (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) (provide 'prelude-core)
;;; prelude-core.el ends here ;;; prelude-core.el ends here

View file

@ -90,6 +90,8 @@
(global-set-key (kbd "C-=") 'er/expand-region) (global-set-key (kbd "C-=") 'er/expand-region)
(global-set-key (kbd "C-c w") (make-repeatable-command '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) (provide 'prelude-global-keybindings)
;;; prelude-global-keybindings.el ends here ;;; prelude-global-keybindings.el ends here