From 5d2638bd31586fc276ddd4444a49627e855cf7fa Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 23 Jun 2014 11:32:24 -0400 Subject: [PATCH] * lisp/simple.el (handle-shift-selection, exchange-point-and-mark) (activate-mark): Set transient-mark-mode buffer-locally. (transient-mark-mode): Use&set the global value. * lisp/mouse.el (mouse-set-region-1, mouse-drag-track): Idem. * lisp/org/org-compat.el (activate-mark): Idem. * lisp/emulation/edt.el (edt-emulation-off): Save&restore the global transient-mark-mode setting. * lisp/obsolete/pc-select.el (pc-selection-mode): Use the transient-mark-mode function. Fixes: debbugs:6316 --- lisp/ChangeLog | 31 +++++++++++++++++++++---------- lisp/emulation/edt.el | 5 +++-- lisp/mouse.el | 16 ++++++++-------- lisp/obsolete/pc-select.el | 2 +- lisp/org/ChangeLog | 4 ++++ lisp/org/org-compat.el | 2 +- lisp/simple.el | 14 +++++++------- 7 files changed, 45 insertions(+), 29 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4f99f83eeb9..8c2fb12da4e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,7 +1,18 @@ +2014-06-23 Stefan Monnier + + * simple.el (handle-shift-selection, exchange-point-and-mark) + (activate-mark): Set transient-mark-mode buffer-locally (bug#6316). + (transient-mark-mode): Use&set the global value. + * mouse.el (mouse-set-region-1, mouse-drag-track): Idem. + * emulation/edt.el (edt-emulation-off): Save&restore the global + transient-mark-mode setting. + * obsolete/pc-select.el (pc-selection-mode): Use the + transient-mark-mode function. + 2014-06-23 Eli Zaretskii - * international/fontset.el (script-representative-chars): Add - representative characters for scripts added in Unicode 7.0. + * international/fontset.el (script-representative-chars): + Add representative characters for scripts added in Unicode 7.0. (otf-script-alist): Synchronize with the latest registry of OTF script tags. @@ -29,8 +40,8 @@ * obsolete/vi.el (vi-set-mark): * term.el (term-handle-scroll): * textmodes/bibtex.el (bibtex-fill-field, bibtex-fill-entry): - * wid-edit.el (widget-editable-list-value-create): Prefer - point-marker to copy-marker of point. + * wid-edit.el (widget-editable-list-value-create): + Prefer point-marker to copy-marker of point. 2014-06-21 Fabián Ezequiel Gallina @@ -233,9 +244,9 @@ (calculator-expt, calculator-truncate): Minor code improvements. (calculator-need-3-lines): New function pulling out code from `calculator'. - (calculator-get-display): Renamed from `calculator-get-prompt', and + (calculator-get-display): Rename from `calculator-get-prompt', and improved. - (calculator-push-curnum): Renamed from `calculator-curnum-value', and + (calculator-push-curnum): Rename from `calculator-curnum-value', and extended for all uses of it. All callers changed. (calculator-groupize-number): New utility for splitting a number into groups. @@ -247,11 +258,11 @@ `pcase' for conciseness and clarity). (calculator-reduce-stack): Now doing just the reduction loop using `calculator-reduce-stack-once'. - (calculator-funcall): Improved code, make it work in v24.3.1 too. - (calculator-last-input): Improved code, remove some old cruft. + (calculator-funcall): Improve code, make it work in v24.3.1 too. + (calculator-last-input): Improve code, remove some old cruft. (calculator-quit): Kill `calculator-buffer' in electric mode too. - (calculator-integer-p): Removed. - (calculator-fact): Improved code, make it work on non-integer values + (calculator-integer-p): Remove. + (calculator-fact): Improve code, make it work on non-integer values too (using truncated numbers). 2014-06-15 Michael Albinus diff --git a/lisp/emulation/edt.el b/lisp/emulation/edt.el index a32fb612adb..e0e2660b70a 100644 --- a/lisp/emulation/edt.el +++ b/lisp/emulation/edt.el @@ -2033,7 +2033,8 @@ created." ;; Make highlighting of selected text work properly for EDT commands. (if (featurep 'emacs) (progn - (setq edt-orig-transient-mark-mode transient-mark-mode) + (setq edt-orig-transient-mark-mode + (default-value 'transient-mark-mode)) (add-hook 'activate-mark-hook (function (lambda () @@ -2068,7 +2069,7 @@ created." (edt-reset) (force-mode-line-update t) (if (featurep 'emacs) - (setq transient-mark-mode edt-orig-transient-mark-mode)) + (setq-default transient-mark-mode edt-orig-transient-mark-mode)) (message "Original key bindings restored; EDT Emulation disabled")) (defun edt-default-menu-bar-update-buffers () diff --git a/lisp/mouse.el b/lisp/mouse.el index f5a09f45a07..7beea8e26e6 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -579,10 +579,10 @@ command alters the kill ring or not." (defun mouse-set-region-1 () ;; Set transient-mark-mode for a little while. (unless (eq (car-safe transient-mark-mode) 'only) - (setq transient-mark-mode - (cons 'only - (unless (eq transient-mark-mode 'lambda) - transient-mark-mode)))) + (setq-local transient-mark-mode + (cons 'only + (unless (eq transient-mark-mode 'lambda) + transient-mark-mode)))) (setq mouse-last-region-beg (region-beginning)) (setq mouse-last-region-end (region-end)) (setq mouse-last-region-tick (buffer-modified-tick))) @@ -801,10 +801,10 @@ The region will be defined with mark and point." ;; Activate the region, using `mouse-start-end' to determine where ;; to put point and mark (e.g., double-click will select a word). - (setq transient-mark-mode - (if (eq transient-mark-mode 'lambda) - '(only) - (cons 'only transient-mark-mode))) + (setq-local transient-mark-mode + (if (eq transient-mark-mode 'lambda) + '(only) + (cons 'only transient-mark-mode))) (let ((range (mouse-start-end start-point start-point click-count))) (push-mark (nth 0 range) t t) (goto-char (nth 1 range))) diff --git a/lisp/obsolete/pc-select.el b/lisp/obsolete/pc-select.el index e5ac1e1427d..5ee0818a1e5 100644 --- a/lisp/obsolete/pc-select.el +++ b/lisp/obsolete/pc-select.el @@ -388,7 +388,7 @@ but before calling PC Selection mode): (fboundp 'normal-erase-is-backspace-mode)) (normal-erase-is-backspace-mode 1)) (setq highlight-nonselected-windows nil) - (setq transient-mark-mode t) + (transient-mark-mode 1) (setq mark-even-if-inactive t) (delete-selection-mode 1)) ;;else diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog index 0a11eafb959..7ad601b1719 100644 --- a/lisp/org/ChangeLog +++ b/lisp/org/ChangeLog @@ -1,3 +1,7 @@ +2014-06-23 Stefan Monnier + + * org-compat.el (activate-mark): Set transient-mark-mode buffer-locally. + 2014-06-22 Mario Lang * org-list.el (org-list-insert-item): The the -> the. diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el index e5d6a49f318..c3ccf062db9 100644 --- a/lisp/org/org-compat.el +++ b/lisp/org/org-compat.el @@ -295,7 +295,7 @@ Works on both Emacs and XEmacs." (setq mark-active t) (when (and (boundp 'transient-mark-mode) (not transient-mark-mode)) - (setq transient-mark-mode 'lambda)) + (set (make-local-variable 'transient-mark-mode) 'lambda)) (when (boundp 'zmacs-regions) (setq zmacs-regions t))))) diff --git a/lisp/simple.el b/lisp/simple.el index 63bfbb51419..9983943298f 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4522,7 +4522,7 @@ If NO-TMM is non-nil, leave `transient-mark-mode' alone." (force-mode-line-update) ;Refresh toolbar (bug#16382). (setq mark-active t) (unless (or transient-mark-mode no-tmm) - (setq transient-mark-mode 'lambda)) + (setq-local transient-mark-mode 'lambda)) (run-hooks 'activate-mark-hook)))) (defun set-mark (pos) @@ -4828,7 +4828,7 @@ mode temporarily." (set-mark (point)) (goto-char omark) (cond (temp-highlight - (setq transient-mark-mode (cons 'only transient-mark-mode))) + (setq-local transient-mark-mode (cons 'only transient-mark-mode))) ((or (and arg (region-active-p)) ; (xor arg (not (region-active-p))) (not (or arg (region-active-p)))) (deactivate-mark)) @@ -4867,10 +4867,10 @@ its earlier value." (cond ((and shift-select-mode this-command-keys-shift-translated) (unless (and mark-active (eq (car-safe transient-mark-mode) 'only)) - (setq transient-mark-mode - (cons 'only - (unless (eq transient-mark-mode 'lambda) - transient-mark-mode))) + (setq-local transient-mark-mode + (cons 'only + (unless (eq transient-mark-mode 'lambda) + transient-mark-mode))) (push-mark nil nil t))) ((eq (car-safe transient-mark-mode) 'only) (setq transient-mark-mode (cdr transient-mark-mode)) @@ -4901,7 +4901,7 @@ Transient Mark mode, invoke \\[apropos-documentation] and type \"transient\" or \"mark.*active\" at the prompt." :global t ;; It's defined in C/cus-start, this stops the d-m-m macro defining it again. - :variable transient-mark-mode) + :variable (default-value 'transient-mark-mode)) (defvar widen-automatically t "Non-nil means it is ok for commands to call `widen' when they want to. -- 2.39.5