aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-05-16 15:39:39 +0000
committerRichard M. Stallman1993-05-16 15:39:39 +0000
commitfd0f40564ff56cfc2c09571b83c8f64cfba82f81 (patch)
treeb6c971fc9e6b464931279b3a8cfbe666637c1d70
parent0ba911156b93dbb1db9aaf5c58de7bbf0816165b (diff)
downloademacs-fd0f40564ff56cfc2c09571b83c8f64cfba82f81.tar.gz
emacs-fd0f40564ff56cfc2c09571b83c8f64cfba82f81.zip
(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.
-rw-r--r--lisp/simple.el29
1 files changed, 20 insertions, 9 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 9481c3da14f..da522aca3ea 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -297,7 +297,7 @@ it is usually a mistake for a Lisp function to use any subroutine
297that uses or sets the mark." 297that uses or sets the mark."
298 (interactive) 298 (interactive)
299 (push-mark (point)) 299 (push-mark (point))
300 (push-mark (point-max)) 300 (push-mark (point-max) nil t)
301 (goto-char (point-min))) 301 (goto-char (point-min)))
302 302
303(defun count-lines-region (start end) 303(defun count-lines-region (start end)
@@ -1103,9 +1103,14 @@ comes the newest one."
1103 (setq this-command 'yank) 1103 (setq this-command 'yank)
1104 (let ((before (< (point) (mark t)))) 1104 (let ((before (< (point) (mark t))))
1105 (delete-region (point) (mark t)) 1105 (delete-region (point) (mark t))
1106 (set-mark (point)) 1106 (set-marker (mark-marker) (point) (current-buffer))
1107 (insert (current-kill arg)) 1107 (insert (current-kill arg))
1108 (if before (exchange-point-and-mark))) 1108 (if before
1109 ;; This is like exchange-point-and-mark, but doesn't activate the mark.
1110 ;; It is cleaner to avoid activation, even though the command
1111 ;; loop would deactivate the mark because we inserted text.
1112 (goto-char (prog1 (mark t)
1113 (set-marker (mark-marker) (point) (current-buffer))))))
1109 nil) 1114 nil)
1110 1115
1111(defun yank (&optional arg) 1116(defun yank (&optional arg)
@@ -1123,7 +1128,11 @@ See also the command \\[yank-pop]."
1123 ((eq arg '-) -1) 1128 ((eq arg '-) -1)
1124 (t (1- arg))))) 1129 (t (1- arg)))))
1125 (if (consp arg) 1130 (if (consp arg)
1126 (exchange-point-and-mark)) 1131 ;; This is like exchange-point-and-mark, but doesn't activate the mark.
1132 ;; It is cleaner to avoid activation, even though the command
1133 ;; loop would deactivate the mark because we inserted text.
1134 (goto-char (prog1 (mark t)
1135 (set-marker (mark-marker) (point) (current-buffer)))))
1127 nil) 1136 nil)
1128 1137
1129(defun rotate-yank-pointer (arg) 1138(defun rotate-yank-pointer (arg)
@@ -1244,16 +1253,16 @@ purposes. See the documentation of `set-mark' for more information."
1244 (interactive "P") 1253 (interactive "P")
1245 (if (null arg) 1254 (if (null arg)
1246 (progn 1255 (progn
1247 (push-mark) 1256 (push-mark nil nil t))
1248 (set-mark (mark t)))
1249 (if (null (mark t)) 1257 (if (null (mark t))
1250 (error "No mark set in this buffer") 1258 (error "No mark set in this buffer")
1251 (goto-char (mark t)) 1259 (goto-char (mark t))
1252 (pop-mark)))) 1260 (pop-mark))))
1253 1261
1254(defun push-mark (&optional location nomsg) 1262(defun push-mark (&optional location nomsg activate)
1255 "Set mark at LOCATION (point, by default) and push old mark on mark ring. 1263 "Set mark at LOCATION (point, by default) and push old mark on mark ring.
1256Displays \"Mark set\" unless the optional second arg NOMSG is non-nil. 1264Display `Mark set' unless the optional second arg NOMSG is non-nil.
1265Activate the mark if optional third arg ACTIVATE is non-nil.
1257 1266
1258Novice Emacs Lisp programmers often try to use the mark for the wrong 1267Novice Emacs Lisp programmers often try to use the mark for the wrong
1259purposes. See the documentation of `set-mark' for more information. 1268purposes. See the documentation of `set-mark' for more information.
@@ -1269,6 +1278,7 @@ In Transient Mark mode, this does not activate the mark."
1269 (set-marker (mark-marker) (or location (point)) (current-buffer)) 1278 (set-marker (mark-marker) (or location (point)) (current-buffer))
1270 (or nomsg executing-macro (> (minibuffer-depth) 0) 1279 (or nomsg executing-macro (> (minibuffer-depth) 0)
1271 (message "Mark set")) 1280 (message "Mark set"))
1281 (if activate (set-mark (mark t)))
1272 nil) 1282 nil)
1273 1283
1274(defun pop-mark () 1284(defun pop-mark ()
@@ -1757,7 +1767,8 @@ In programs, it is faster to call `forward-word' with negative arg."
1757 (push-mark 1767 (push-mark
1758 (save-excursion 1768 (save-excursion
1759 (forward-word arg) 1769 (forward-word arg)
1760 (point)))) 1770 (point))
1771 nil t))
1761 1772
1762(defun kill-word (arg) 1773(defun kill-word (arg)
1763 "Kill characters forward until encountering the end of a word. 1774 "Kill characters forward until encountering the end of a word.