changeset 60463:be3ac492036f

(activate-mark-hook, deactivate-mark-hook): Add defvars. (push-mark-command): Run activate-mark-hook.
author Richard M. Stallman <rms@gnu.org>
date Sun, 06 Mar 2005 20:15:50 +0000
parents df46d87c0c2f
children e87ceb26377f
files lisp/simple.el
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Sun Mar 06 18:32:32 2005 +0000
+++ b/lisp/simple.el	Sun Mar 06 20:15:50 2005 +0000
@@ -2913,6 +2913,14 @@
 (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 @@
     (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")))))