comparison lisp/simple.el @ 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 ce5c67075d6b
children 47a57ff1da21 c7d2b6ee3a80
comparison
equal deleted inserted replaced
60462:df46d87c0c2f 60463:be3ac492036f
2911 (insert-buffer-substring oldbuf start end))))) 2911 (insert-buffer-substring oldbuf start end)))))
2912 2912
2913 (put 'mark-inactive 'error-conditions '(mark-inactive error)) 2913 (put 'mark-inactive 'error-conditions '(mark-inactive error))
2914 (put 'mark-inactive 'error-message "The mark is not active now") 2914 (put 'mark-inactive 'error-message "The mark is not active now")
2915 2915
2916 (defvar activate-mark-hook nil
2917 "Hook run when the mark becomes active.
2918 It is also run at the end of a command, if the mark is active and
2919 it is possible that the region may have changed")
2920
2921 (defvar deactivate-mark-hook nil
2922 "Hook run when the mark becomes inactive.")
2923
2916 (defun mark (&optional force) 2924 (defun mark (&optional force)
2917 "Return this buffer's mark value as integer; error if mark inactive. 2925 "Return this buffer's mark value as integer; error if mark inactive.
2918 If optional argument FORCE is non-nil, access the mark value 2926 If optional argument FORCE is non-nil, access the mark value
2919 even if the mark is not currently active, and return nil 2927 even if the mark is not currently active, and return nil
2920 if there is no mark at all. 2928 if there is no mark at all.
3002 (interactive "P") 3010 (interactive "P")
3003 (let ((mark (marker-position (mark-marker)))) 3011 (let ((mark (marker-position (mark-marker))))
3004 (if (or arg (null mark) (/= mark (point))) 3012 (if (or arg (null mark) (/= mark (point)))
3005 (push-mark nil nomsg t) 3013 (push-mark nil nomsg t)
3006 (setq mark-active t) 3014 (setq mark-active t)
3015 (run-hooks 'activate-mark-hook)
3007 (unless nomsg 3016 (unless nomsg
3008 (message "Mark activated"))))) 3017 (message "Mark activated")))))
3009 3018
3010 (defun set-mark-command (arg) 3019 (defun set-mark-command (arg)
3011 "Set mark at where point is, or jump to mark. 3020 "Set mark at where point is, or jump to mark.