emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r116733: * lisp/simple.el (set-mark): Ensure mark-ac


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r116733: * lisp/simple.el (set-mark): Ensure mark-active is nil if the mark is nil.
Date: Tue, 11 Mar 2014 17:10:15 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116733
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16975
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Tue 2014-03-11 13:10:07 -0400
message:
  * lisp/simple.el (set-mark): Ensure mark-active is nil if the mark is nil.
  Deactivate the mark before setting it to nil.
  (activate-mark): Do nothing if region is already active.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/simple.el                 simple.el-20091113204419-o5vbwnq5f7feedwu-403
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-03-11 01:44:51 +0000
+++ b/lisp/ChangeLog    2014-03-11 17:10:07 +0000
@@ -1,3 +1,9 @@
+2014-03-11  Stefan Monnier  <address@hidden>
+
+       * simple.el (set-mark): Ensure mark-active is nil if the mark is nil
+       (bug#16975).  Deactivate the mark before setting it to nil.
+       (activate-mark): Do nothing if region is already active.
+
 2014-03-11  Juanma Barranquero  <address@hidden>
 
        * frameset.el (frameset--target-display): Remove definition; declare.
@@ -42,8 +48,8 @@
 
 2014-03-10  Leo Liu  <address@hidden>
 
-       * emacs-lisp/eldoc.el (eldoc-minibuffer-message): Clear
-       eldoc-last-message.  (Bug#16920)
+       * emacs-lisp/eldoc.el (eldoc-minibuffer-message):
+       Clear eldoc-last-message.  (Bug#16920)
 
 2014-03-10  Stefan Monnier  <address@hidden>
 

=== modified file 'lisp/simple.el'
--- a/lisp/simple.el    2014-03-06 04:11:08 +0000
+++ b/lisp/simple.el    2014-03-11 17:10:07 +0000
@@ -4392,12 +4392,12 @@
   "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 (or transient-mark-mode no-tmm)
-      (setq transient-mark-mode 'lambda))
-    (run-hooks 'activate-mark-hook)))
+    (unless (region-active-p)
+      (force-mode-line-update) ;Refresh toolbar (bug#16382).
+      (setq mark-active t)
+      (unless (or transient-mark-mode no-tmm)
+        (setq transient-mark-mode 'lambda))
+      (run-hooks 'activate-mark-hook))))
 
 (defun set-mark (pos)
   "Set this buffer's mark to POS.  Don't use this function!
@@ -4415,14 +4415,18 @@
 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
-      (activate-mark 'no-tmm)
+      (progn
+        (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)))
+    (deactivate-mark t)
+    ;; `deactivate-mark' sometimes leaves mark-active non-nil, but
+    ;; it should never be nil if the mark is nil.
+    (setq mark-active nil)
+    (set-marker (mark-marker) nil)))
 
 (defcustom use-empty-active-region nil
   "Whether \"region-aware\" commands should act on empty regions.


reply via email to

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