changeset 93561:e39e5bb86d6b

(beginning-of-buffer, end-of-buffer, goto-line, undo) (copy-region-as-kill, kill-ring-save, use-region-p, mark-word) (keyboard-escape-quit): Check region-active-p i.s.o transient-mark-mode.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 03 Apr 2008 02:16:17 +0000
parents 6649daf7bf6f
children 01f16f0a9645
files lisp/ChangeLog lisp/simple.el
diffstat 2 files changed, 24 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Apr 03 01:27:31 2008 +0000
+++ b/lisp/ChangeLog	Thu Apr 03 02:16:17 2008 +0000
@@ -1,7 +1,13 @@
+2008-04-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* simple.el (beginning-of-buffer, end-of-buffer, goto-line, undo)
+	(copy-region-as-kill, kill-ring-save, use-region-p, mark-word)
+	(keyboard-escape-quit): Check region-active-p i.s.o transient-mark-mode.
+
 2008-04-02  Alan Mackenzie  <acm@muc.de>
 
-	* progmodes/cc-cmds.el (c-defun-name, c-cpp-define-name): New
-	optimised functions to get the name of the current defun/macro.
+	* progmodes/cc-cmds.el (c-defun-name, c-cpp-define-name):
+	New optimised functions to get the name of the current defun/macro.
 
 	* add-log.el (add-log-current-defun): Move the functionality which
 	gets the current function name for C like modes to cc-cmds.el,
@@ -11,8 +17,7 @@
 
 	* simple.el (deactivate-mark): When the mark is temporarily
 	active, restore the original value of transient-mark-mode.
-	(set-mark-command): First deactivate the mark if was temporarily
-	active.
+	(set-mark-command): First deactivate the mark if was temporarily active.
 	(exchange-point-and-mark): Reactivate the mark if it was
 	temporarily active.
 	(handle-shift-selection): New fun.
@@ -35,8 +40,8 @@
 
 2008-04-02  Michael Albinus  <michael.albinus@gmx.de>
 
-	* net/tramp.el (tramp-make-tramp-temp-file): Use
-	`tramp-drop-volume-letter' for the local file name part.
+	* net/tramp.el (tramp-make-tramp-temp-file):
+	Use `tramp-drop-volume-letter' for the local file name part.
 
 2008-04-02  Dan Nicolaescu  <dann@ics.uci.edu>
 
@@ -95,8 +100,7 @@
 
 2008-04-01  Jari Aalto  <jari.aalto@cante.net>
 
-	* find-dired.el (find-dired-filter): Align columns by padding file
-	sizes.
+	* find-dired.el (find-dired-filter): Align columns by padding file sizes.
 
 2008-04-01  Jason Rumney  <jasonr@gnu.org>
 
--- a/lisp/simple.el	Thu Apr 03 01:27:31 2008 +0000
+++ b/lisp/simple.el	Thu Apr 03 02:16:17 2008 +0000
@@ -759,7 +759,7 @@
 \(goto-char (point-min)) is faster and avoids clobbering the mark."
   (interactive "^P")
   (or (consp arg)
-      (and transient-mark-mode mark-active)
+      (region-active-p)
       (push-mark))
   (let ((size (- (point-max) (point-min))))
     (goto-char (if (and arg (not (consp arg)))
@@ -783,9 +783,7 @@
 Don't use this command in Lisp programs!
 \(goto-char (point-max)) is faster and avoids clobbering the mark."
   (interactive "^P")
-  (or (consp arg)
-      (and transient-mark-mode mark-active)
-      (push-mark))
+  (or (consp arg) (region-active-p) (push-mark))
   (let ((size (- (point-max) (point-min))))
     (goto-char (if (and arg (not (consp arg)))
 		   (- (point-max)
@@ -861,8 +859,7 @@
 	(if window (select-window window)
 	  (switch-to-buffer-other-window buffer))))
   ;; Leave mark at previous position
-  (or (and transient-mark-mode mark-active)
-      (push-mark))
+  (or (region-active-p) (push-mark))
   ;; Move to the specified line number in that buffer.
   (save-restriction
     (widen)
@@ -1619,7 +1616,7 @@
 		       ;; it shows nothing else happened in between.
 		       (gethash list undo-equiv-table))))
       (setq undo-in-region
-	    (if transient-mark-mode mark-active (and arg (not (numberp arg)))))
+	    (or (region-active-p) (and arg (not (numberp arg)))))
       (if undo-in-region
 	  (undo-start (region-beginning) (region-end))
 	(undo-start))
@@ -1641,7 +1638,7 @@
 		 (if next (setq equiv next))))
 	(setq pending-undo-list equiv)))
     (undo-more
-     (if (or transient-mark-mode (numberp arg))
+     (if (numberp arg)
 	 (prefix-numeric-value arg)
        1))
     ;; Record the fact that the just-generated undo records come from an
@@ -2857,8 +2854,7 @@
   (if (eq last-command 'kill-region)
       (kill-append (filter-buffer-substring beg end) (< end beg))
     (kill-new (filter-buffer-substring beg end)))
-  (if transient-mark-mode
-      (setq deactivate-mark t))
+  (setq deactivate-mark t)
   nil)
 
 (defun kill-ring-save (beg end)
@@ -2883,7 +2879,9 @@
 	    ;; look like a C-g typed as a command.
 	    (inhibit-quit t))
 	(if (pos-visible-in-window-p other-end (selected-window))
-	    (unless (and transient-mark-mode
+            ;; Swap point-and-mark quickly so as to show the region that
+            ;; was selected.  Don't do it if the region is highlighted.
+	    (unless (and (region-active-p)
 			 (face-background 'region))
 	      ;; Swap point and mark.
 	      (set-marker (mark-marker) (point) (current-buffer))
@@ -3453,7 +3451,7 @@
 test whether to do that.
 
 This function also obeys `use-empty-active-region'."
-  (and transient-mark-mode mark-active
+  (and (region-active-p)
        (or use-empty-active-region (> (region-end) (region-beginning)))))
 
 (defun region-active-p ()
@@ -4445,7 +4443,7 @@
   (interactive "P\np")
   (cond ((and allow-extend
 	      (or (and (eq last-command this-command) (mark t))
-		  (and transient-mark-mode mark-active)))
+		  (region-active-p)))
 	 (setq arg (if arg (prefix-numeric-value arg)
 		     (if (< (mark) (point)) -1 1)))
 	 (set-mark
@@ -4986,7 +4984,7 @@
 	 (abort-recursive-edit))
 	(current-prefix-arg
 	 nil)
-	((and transient-mark-mode mark-active)
+	((region-active-p)
 	 (deactivate-mark))
 	((> (recursion-depth) 0)
 	 (exit-recursive-edit))