From 6372fc12fe9c5d22a825e2c812c4a788cda175f6 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 1 Jul 2014 14:13:28 -0400 Subject: [PATCH] * lisp/simple.el (deactivate-mark, set-mark-command, handle-shift-selection): Don't keep transient-mark-mode buffer-local when not needed. Fixes: debbugs:6316 --- lisp/ChangeLog | 3 +++ lisp/simple.el | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 054bef5697d..6f279c7b454 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2014-07-01 Stefan Monnier + * simple.el (deactivate-mark, set-mark-command, handle-shift-selection): + Don't keep transient-mark-mode buffer-local when not needed (bug#6316). + * xt-mouse.el (turn-on-xterm-mouse-tracking-on-terminal) (turn-off-xterm-mouse-tracking-on-terminal): Don't burp if the terminal is suspended (bug#17857). diff --git a/lisp/simple.el b/lisp/simple.el index a8689aaf2e3..6fd50197a10 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4527,9 +4527,11 @@ run `deactivate-mark-hook'." (when mark-active (force-mode-line-update)) ;Refresh toolbar (bug#16382). (cond ((eq (car-safe transient-mark-mode) 'only) - (setq transient-mark-mode (cdr transient-mark-mode))) + (setq transient-mark-mode (cdr transient-mark-mode)) + (if (eq transient-mark-mode (default-value 'transient-mark-mode)) + (kill-local-variable 'transient-mark-mode))) ((eq transient-mark-mode 'lambda) - (setq transient-mark-mode nil))) + (kill-local-variable 'transient-mark-mode))) (setq mark-active nil) (run-hooks 'deactivate-mark-hook) (redisplay--update-region-highlight (selected-window)))) @@ -4756,7 +4758,7 @@ Novice Emacs Lisp programmers often try to use the mark for the wrong purposes. See the documentation of `set-mark' for more information." (interactive "P") (cond ((eq transient-mark-mode 'lambda) - (setq transient-mark-mode nil)) + (kill-local-variable 'transient-mark-mode)) ((eq (car-safe transient-mark-mode) 'only) (deactivate-mark))) (cond @@ -4894,6 +4896,8 @@ its earlier value." (push-mark nil nil t))) ((eq (car-safe transient-mark-mode) 'only) (setq transient-mark-mode (cdr transient-mark-mode)) + (if (eq transient-mark-mode (default-value 'transient-mark-mode)) + (kill-local-variable 'transient-mark-mode)) (deactivate-mark)))) (define-minor-mode transient-mark-mode -- 2.39.5