emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 0ab572d5c9: Add new value `dont-save' to `deactivate-mark'


From: Po Lu
Subject: master 0ab572d5c9: Add new value `dont-save' to `deactivate-mark'
Date: Sat, 13 Aug 2022 09:14:17 -0400 (EDT)

branch: master
commit 0ab572d5c991dee4818d364a65e004d20f1f45a1
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Add new value `dont-save' to `deactivate-mark'
    
    * 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       | 6 ++++++
 lisp/simple.el | 4 +++-
 src/keyboard.c | 8 ++++++--
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 6ff8548921..7d3608b2fc 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2565,6 +2565,12 @@ patcomp.el, pc-mode.el, pc-select.el, s-region.el, and 
sregex.el.
 
 * 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'
diff --git a/lisp/simple.el b/lisp/simple.el
index a4ea345ca5..ce3895176e 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -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
diff --git a/src/keyboard.c b/src/keyboard.c
index 719226caed..05c68ea7fb 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -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);
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]