Mercurial > emacs
changeset 5812:1959e5c4a563
(push-mark): Don't push on global-mark-ring if its car is a marker in the
current buffer.
author | Roland McGrath <roland@gnu.org> |
---|---|
date | Mon, 07 Feb 1994 04:48:18 +0000 |
parents | 7cc27fc3c661 |
children | 1560c0f4ba84 |
files | lisp/simple.el |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/simple.el Mon Feb 07 02:24:01 1994 +0000 +++ b/lisp/simple.el Mon Feb 07 04:48:18 1994 +0000 @@ -1338,7 +1338,8 @@ (defun push-mark (&optional location nomsg activate) "Set mark at LOCATION (point, by default) and push old mark on mark ring. -Also push LOCATION on the global mark ring. +If the last global mark pushed was not in the current buffer, +also push LOCATION on the global mark ring. Display `Mark set' unless the optional second arg NOMSG is non-nil. In Transient Mark mode, activate mark if optional third arg ACTIVATE non-nil. @@ -1355,12 +1356,17 @@ (setcdr (nthcdr (1- mark-ring-max) mark-ring) nil)))) (set-marker (mark-marker) (or location (point)) (current-buffer)) ;; Now push the mark on the global mark ring. - (setq global-mark-ring (cons (copy-marker (mark-marker)) global-mark-ring)) + (if (and global-mark-ring + (eq (marker-buffer (car global-mark-ring) (current-buffer)))) + ;; The last global mark pushed was in this same buffer. + ;; Don't push another one. + nil + (setq global-mark-ring (cons (copy-marker (mark-marker)) global-mark-ring)) (if (> (length global-mark-ring) global-mark-ring-max) (progn (move-marker (car (nthcdr global-mark-ring-max global-mark-ring)) nil) - (setcdr (nthcdr (1- global-mark-ring-max) global-mark-ring) nil))) + (setcdr (nthcdr (1- global-mark-ring-max) global-mark-ring) nil)))) (or nomsg executing-macro (> (minibuffer-depth) 0) (message "Mark set")) (if (or activate (not transient-mark-mode))