From 684d44ef81d88387fd300588cd01ee5b9efdd617 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 8 Jan 2014 20:59:19 -0500 Subject: [PATCH] * lisp/simple.el (deactivate-mark, activate-mark): Force-mode-line-update. (activate-mark): Add `no-tmm' argument. (set-mark, push-mark-command): Use it instead of running activate-mark-hook by hand. Fixes: debbugs:16382 --- lisp/ChangeLog | 24 ++++++++++++++++-------- lisp/simple.el | 24 ++++++++++++------------ 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a1eef95d776..481c3cbc04a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2014-01-09 Stefan Monnier + + * simple.el (deactivate-mark, activate-mark): Force-mode-line-update + (bug#16382). + (activate-mark): Add `no-tmm' argument. + (set-mark, push-mark-command): Use it instead of running + activate-mark-hook by hand. + 2014-01-08 Eric S. Raymond In preparation for the move to git, sanitize out some @@ -11,8 +19,8 @@ 2014-01-08 David Engster - * help-fns.el (help-fns-describe-function-functions): New - variable to call functions for augmenting help buffers. + * help-fns.el (help-fns-describe-function-functions): + New variable to call functions for augmenting help buffers. (describe-function-1): Remove explicit calls to `help-fns--compiler-macro', `help-fns--parent-mode' and `help-fns--obsolete'. Put them in above new variable instead, and @@ -20,13 +28,13 @@ * emacs-lisp/eieio-opt.el (eieio-help-class): Rename from `eieio-describe-class'. Not meant for interactive use anymore, but to augment existing help buffers. Remove optional second - argument. Create proper button for file location. Rewrite - function to use `insert' instead of `princ' and `prin1' where + argument. Create proper button for file location. + Rewrite function to use `insert' instead of `princ' and `prin1' where possible. (eieio-help-class-slots): Rename from `eieio-describe-class-slots'. (eieio-method-def, eieio-class-def): Move further up. - (describe-method, describe-generic, eieio-describe-method): Remove - aliases. + (describe-method, describe-generic, eieio-describe-method): + Remove aliases. (eieio-help-constructor, eieio-help-generic): Rename from `eieio-describe-constructor' and `eieio-describe-generic', resp. Rewrite to use `insert' in the current buffer and use proper help @@ -36,8 +44,8 @@ arguments. (eieio-help-mode-augmentation-maybee): Remove. (eieio-describe-class-sb): Use `describe-function'. - * emacs-lisp/eieio.el (help-fns-describe-function-functions): Add - `eieio-help-generic' and `eieio-help-constructor'. + * emacs-lisp/eieio.el (help-fns-describe-function-functions): + Add `eieio-help-generic' and `eieio-help-constructor'. 2014-01-08 Paul Eggert diff --git a/lisp/simple.el b/lisp/simple.el index f9ebe129f7e..5c2f3c3db1d 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4322,6 +4322,7 @@ run `deactivate-mark-hook'." (null (x-selection-exists-p 'PRIMARY)))) (x-set-selection 'PRIMARY (funcall region-extract-function nil))))) + (when mark-active (force-mode-line-update)) ;Refresh toolbar (bug#16382). (if (and (null force) (or (eq transient-mark-mode 'lambda) (and (eq (car-safe transient-mark-mode) 'only) @@ -4334,11 +4335,14 @@ run `deactivate-mark-hook'." (setq mark-active nil) (run-hooks 'deactivate-mark-hook)))) -(defun activate-mark () - "Activate the mark." +(defun activate-mark (&optional no-tmm) + "Activate the mark. +If NO-TMM is non-nil, leave `transient-mark-mode' alone." (when (mark t) + (unless (and mark-active transient-mark-mode) + (force-mode-line-update)) ;Refresh toolbar (bug#16382). (setq mark-active t) - (unless transient-mark-mode + (unless (or transient-mark-mode no-tmm) (setq transient-mark-mode 'lambda)) (run-hooks 'activate-mark-hook))) @@ -4359,16 +4363,13 @@ store it in a Lisp variable. Example: (let ((beg (point))) (forward-line 1) (delete-region beg (point)))." + (set-marker (mark-marker) pos (current-buffer)) (if pos - (progn - (setq mark-active t) - (run-hooks 'activate-mark-hook) - (set-marker (mark-marker) pos (current-buffer))) + (activate-mark 'no-tmm) ;; Normally we never clear mark-active except in Transient Mark mode. ;; But when we actually clear out the mark value too, we must ;; clear mark-active in any mode. - (deactivate-mark t) - (set-marker (mark-marker) nil))) + (deactivate-mark t))) (defcustom use-empty-active-region nil "Whether \"region-aware\" commands should act on empty regions. @@ -4492,11 +4493,10 @@ Start discarding off end if gets this big." If no prefix ARG and mark is already set there, just activate it. Display `Mark set' unless the optional second arg NOMSG is non-nil." (interactive "P") - (let ((mark (marker-position (mark-marker)))) + (let ((mark (mark t))) (if (or arg (null mark) (/= mark (point))) (push-mark nil nomsg t) - (setq mark-active t) - (run-hooks 'activate-mark-hook) + (activate-mark 'no-tmm) (unless nomsg (message "Mark activated"))))) -- 2.39.2