changeset 2824:c684bce3e977

(yank, yank-pop): Don't activate the mark. (mark-whole-buffer, mark-word): Activate the mark. (push-mark): Optional arg ACTIVATE. (set-mark-command): Use that.
author Richard M. Stallman <rms@gnu.org>
date Sun, 16 May 1993 15:39:39 +0000
parents 8ab0e280fbf0
children bddd28afcc26
files lisp/simple.el
diffstat 1 files changed, 20 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Sun May 16 15:28:52 1993 +0000
+++ b/lisp/simple.el	Sun May 16 15:39:39 1993 +0000
@@ -297,7 +297,7 @@
 that uses or sets the mark."
   (interactive)
   (push-mark (point))
-  (push-mark (point-max))
+  (push-mark (point-max) nil t)
   (goto-char (point-min)))
 
 (defun count-lines-region (start end)
@@ -1103,9 +1103,14 @@
   (setq this-command 'yank)
   (let ((before (< (point) (mark t))))
     (delete-region (point) (mark t))
-    (set-mark (point))
+    (set-marker (mark-marker) (point) (current-buffer))
     (insert (current-kill arg))
-    (if before (exchange-point-and-mark)))
+    (if before
+	;; This is like exchange-point-and-mark, but doesn't activate the mark.
+	;; It is cleaner to avoid activation, even though the command
+	;; loop would deactivate the mark because we inserted text.
+	(goto-char (prog1 (mark t)
+		     (set-marker (mark-marker) (point) (current-buffer))))))
   nil)
 
 (defun yank (&optional arg)
@@ -1123,7 +1128,11 @@
 			 ((eq arg '-) -1)
 			 (t (1- arg)))))
   (if (consp arg)
-      (exchange-point-and-mark))
+      ;; This is like exchange-point-and-mark, but doesn't activate the mark.
+      ;; It is cleaner to avoid activation, even though the command
+      ;; loop would deactivate the mark because we inserted text.
+      (goto-char (prog1 (mark t)
+		   (set-marker (mark-marker) (point) (current-buffer)))))
   nil)
 
 (defun rotate-yank-pointer (arg)
@@ -1244,16 +1253,16 @@
   (interactive "P")
   (if (null arg)
       (progn
-	(push-mark)
-	(set-mark (mark t)))
+	(push-mark nil nil t))
     (if (null (mark t))
 	(error "No mark set in this buffer")
       (goto-char (mark t))
       (pop-mark))))
 
-(defun push-mark (&optional location nomsg)
+(defun push-mark (&optional location nomsg activate)
   "Set mark at LOCATION (point, by default) and push old mark on mark ring.
-Displays \"Mark set\" unless the optional second arg NOMSG is non-nil.
+Display `Mark set' unless the optional second arg NOMSG is non-nil.
+Activate the mark if optional third arg ACTIVATE is non-nil.
 
 Novice Emacs Lisp programmers often try to use the mark for the wrong
 purposes.  See the documentation of `set-mark' for more information.
@@ -1269,6 +1278,7 @@
   (set-marker (mark-marker) (or location (point)) (current-buffer))
   (or nomsg executing-macro (> (minibuffer-depth) 0)
       (message "Mark set"))
+  (if activate (set-mark (mark t)))
   nil)
 
 (defun pop-mark ()
@@ -1757,7 +1767,8 @@
   (push-mark
     (save-excursion
       (forward-word arg)
-      (point))))
+      (point))
+    nil t))
 
 (defun kill-word (arg)
   "Kill characters forward until encountering the end of a word.