diff options
author | Richard M. Stallman <rms@gnu.org> | 2005-03-06 20:16:01 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2005-03-06 20:16:01 +0000 |
commit | 0251bafb90e63cc7f428e1b91db436c32ad2677c (patch) | |
tree | 15bf9af7204a8c97ed8adb0faf5f29bc1f96eb52 /lisp/simple.el | |
parent | eac88b3bfb2990efc5787564ddf249f8cabd8df7 (diff) | |
download | emacs-0251bafb90e63cc7f428e1b91db436c32ad2677c.tar.gz |
(activate-mark-hook, deactivate-mark-hook): Add defvars.
(push-mark-command): Run activate-mark-hook.
Diffstat (limited to 'lisp/simple.el')
-rw-r--r-- | lisp/simple.el | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 00005ae355b..38c9bff4130 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2913,6 +2913,14 @@ START and END specify the portion of the current buffer to be copied." (put 'mark-inactive 'error-conditions '(mark-inactive error)) (put 'mark-inactive 'error-message "The mark is not active now") +(defvar activate-mark-hook nil + "Hook run when the mark becomes active. +It is also run at the end of a command, if the mark is active and +it is possible that the region may have changed") + +(defvar deactivate-mark-hook nil + "Hook run when the mark becomes inactive.") + (defun mark (&optional force) "Return this buffer's mark value as integer; error if mark inactive. If optional argument FORCE is non-nil, access the mark value @@ -3004,6 +3012,7 @@ Display `Mark set' unless the optional second arg NOMSG is non-nil." (if (or arg (null mark) (/= mark (point))) (push-mark nil nomsg t) (setq mark-active t) + (run-hooks 'activate-mark-hook) (unless nomsg (message "Mark activated"))))) |