]> git.eshelyaron.com Git - emacs.git/commitdiff
Add new value `dont-save' to `deactivate-mark'
authorPo Lu <luangruo@yahoo.com>
Sat, 13 Aug 2022 13:12:20 +0000 (21:12 +0800)
committerPo Lu <luangruo@yahoo.com>
Sat, 13 Aug 2022 13:14:07 +0000 (21:14 +0800)
* etc/NEWS: Announce new value of `deactivate-mark'.

* lisp/simple.el (deactivate-mark): Handle new value.
(bug#57147)

* src/keyboard.c (syms_of_keyboard): Update doc string of
`deactivate-mark'.

etc/NEWS
lisp/simple.el
src/keyboard.c

index 6ff8548921fcbef3d4fc30f19551ac6b06d5a5f3..7d3608b2fcf94ba7eae4341d78a358b95aee45ca 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2565,6 +2565,12 @@ patcomp.el, pc-mode.el, pc-select.el, s-region.el, and sregex.el.
 \f
 * Lisp Changes in Emacs 29.1
 
+---
+** New 'dont-save' value of 'deactivate-mark'.
+This value means that Emacs should deactivate the mark as usual, but
+without setting the primary selection should 'select-active-regions'
+be enabled.
+
 +++
 ** New 'declare' form 'interactive-args'.
 This can be used to specify what forms to put into 'command-history'
index a4ea345ca5f020f069282b14d50999aa9030a2ae..ce3895176e1febc0dd8a07695f071b3ca80d1d33 100644 (file)
@@ -6731,7 +6731,8 @@ If Transient Mark mode is disabled, this function normally does
 nothing; but if FORCE is non-nil, it deactivates the mark anyway.
 
 Deactivating the mark sets `mark-active' to nil, updates the
-primary selection according to `select-active-regions', and runs
+primary selection according to `select-active-regions' (unless
+`deactivate-mark' is `dont-save'), and runs
 `deactivate-mark-hook'.
 
 If Transient Mark mode was temporarily enabled, reset the value
@@ -6742,6 +6743,7 @@ run `deactivate-mark-hook'."
     (when (and (if (eq select-active-regions 'only)
                   (eq (car-safe transient-mark-mode) 'only)
                 select-active-regions)
+               (not (eq deactivate-mark 'dont-save))
               (region-active-p)
               (display-selections-p))
       ;; The var `saved-region-selection', if non-nil, is the text in
index 719226caedc85ae15873d973233cdde30bf2e4a4..05c68ea7fbc933f1e909cee45f131e4bccb542d1 100644 (file)
@@ -12650,10 +12650,14 @@ cancels any modification.  */);
 
   DEFSYM (Qdeactivate_mark, "deactivate-mark");
   DEFVAR_LISP ("deactivate-mark", Vdeactivate_mark,
-              doc: /* If an editing command sets this to t, deactivate the mark afterward.
+    doc: /* If an editing command sets this to t, deactivate the mark afterward.
 The command loop sets this to nil before each command,
 and tests the value when the command returns.
-Buffer modification stores t in this variable.  */);
+Buffer modification stores t in this variable.
+
+By default, deactivating the mark will save the contents of the region
+according to `select-active-regions'.  If this is set to the symbol
+`dont-save', the region will not be saved.*/);
   Vdeactivate_mark = Qnil;
   Fmake_variable_buffer_local (Qdeactivate_mark);