emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/simple.el,v


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/simple.el,v
Date: Wed, 26 Mar 2008 03:40:43 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        08/03/26 03:40:42

Index: simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.911
retrieving revision 1.912
diff -u -b -r1.911 -r1.912
--- simple.el   23 Mar 2008 22:52:20 -0000      1.911
+++ simple.el   26 Mar 2008 03:40:40 -0000      1.912
@@ -3347,6 +3347,13 @@
     (setq mark-active nil)
     (run-hooks 'deactivate-mark-hook))))
 
+(defun activate-mark ()
+  "Activate the mark."
+  (when (mark t)
+    (setq mark-active t)
+    (unless transient-mark-mode
+      (setq transient-mark-mode 'lambda))))
+
 (defcustom select-active-regions nil
   "If non-nil, an active region automatically becomes the window selection."
   :type 'boolean
@@ -3520,13 +3527,13 @@
    (arg
     (setq this-command 'pop-to-mark-command)
     (pop-to-mark-command))
-   ((and (eq last-command 'set-mark-command)
-        mark-active (null transient-mark-mode))
-    (setq transient-mark-mode 'lambda)
-    (message "Transient-mark-mode temporarily enabled"))
-   ((and (eq last-command 'set-mark-command)
-         transient-mark-mode)
-    (deactivate-mark))
+   ((eq last-command 'set-mark-command)
+    (if (region-active-p)
+        (progn
+          (deactivate-mark)
+          (message "Mark deactivated"))
+      (activate-mark)
+      (message "Mark activated")))
    (t
     (push-mark-command nil))))
 
@@ -3580,18 +3587,17 @@
 and it reactivates the mark.
 With prefix arg, `transient-mark-mode' is enabled temporarily."
   (interactive "P")
-  (if arg
-      (if mark-active
-         (if (null transient-mark-mode)
-             (setq transient-mark-mode 'lambda))
-       (setq arg nil)))
-  (unless arg
+  (deactivate-mark)
     (let ((omark (mark t)))
       (if (null omark)
          (error "No mark set in this buffer"))
       (set-mark (point))
       (goto-char omark)
-      nil)))
+    (if (or (and arg (region-active-p)) ; (xor arg (not (region-active-p)))
+            (not (or arg (region-active-p))))
+        (deactivate-mark)
+      (activate-mark))
+    nil))
 
 (define-minor-mode transient-mark-mode
   "Toggle Transient Mark mode.




reply via email to

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