diff options
| author | Roland McGrath | 1994-02-07 04:48:18 +0000 |
|---|---|---|
| committer | Roland McGrath | 1994-02-07 04:48:18 +0000 |
| commit | f1382a3d0d1e7985bfcba34a2032f0ced0abf7d7 (patch) | |
| tree | 2c3bd59c6a57891d094cc67123e19d245facb700 | |
| parent | dc029f0bf1236fc04b554059982773dc45ac7173 (diff) | |
| download | emacs-f1382a3d0d1e7985bfcba34a2032f0ced0abf7d7.tar.gz emacs-f1382a3d0d1e7985bfcba34a2032f0ced0abf7d7.zip | |
(push-mark): Don't push on global-mark-ring if its car is a marker in the
current buffer.
| -rw-r--r-- | lisp/simple.el | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index c04be0f792c..f243eba664d 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -1338,7 +1338,8 @@ purposes. See the documentation of `set-mark' for more information." | |||
| 1338 | 1338 | ||
| 1339 | (defun push-mark (&optional location nomsg activate) | 1339 | (defun push-mark (&optional location nomsg activate) |
| 1340 | "Set mark at LOCATION (point, by default) and push old mark on mark ring. | 1340 | "Set mark at LOCATION (point, by default) and push old mark on mark ring. |
| 1341 | Also push LOCATION on the global mark ring. | 1341 | If the last global mark pushed was not in the current buffer, |
| 1342 | also push LOCATION on the global mark ring. | ||
| 1342 | Display `Mark set' unless the optional second arg NOMSG is non-nil. | 1343 | Display `Mark set' unless the optional second arg NOMSG is non-nil. |
| 1343 | In Transient Mark mode, activate mark if optional third arg ACTIVATE non-nil. | 1344 | In Transient Mark mode, activate mark if optional third arg ACTIVATE non-nil. |
| 1344 | 1345 | ||
| @@ -1355,12 +1356,17 @@ In Transient Mark mode, this does not activate the mark." | |||
| 1355 | (setcdr (nthcdr (1- mark-ring-max) mark-ring) nil)))) | 1356 | (setcdr (nthcdr (1- mark-ring-max) mark-ring) nil)))) |
| 1356 | (set-marker (mark-marker) (or location (point)) (current-buffer)) | 1357 | (set-marker (mark-marker) (or location (point)) (current-buffer)) |
| 1357 | ;; Now push the mark on the global mark ring. | 1358 | ;; Now push the mark on the global mark ring. |
| 1358 | (setq global-mark-ring (cons (copy-marker (mark-marker)) global-mark-ring)) | 1359 | (if (and global-mark-ring |
| 1360 | (eq (marker-buffer (car global-mark-ring) (current-buffer)))) | ||
| 1361 | ;; The last global mark pushed was in this same buffer. | ||
| 1362 | ;; Don't push another one. | ||
| 1363 | nil | ||
| 1364 | (setq global-mark-ring (cons (copy-marker (mark-marker)) global-mark-ring)) | ||
| 1359 | (if (> (length global-mark-ring) global-mark-ring-max) | 1365 | (if (> (length global-mark-ring) global-mark-ring-max) |
| 1360 | (progn | 1366 | (progn |
| 1361 | (move-marker (car (nthcdr global-mark-ring-max global-mark-ring)) | 1367 | (move-marker (car (nthcdr global-mark-ring-max global-mark-ring)) |
| 1362 | nil) | 1368 | nil) |
| 1363 | (setcdr (nthcdr (1- global-mark-ring-max) global-mark-ring) nil))) | 1369 | (setcdr (nthcdr (1- global-mark-ring-max) global-mark-ring) nil)))) |
| 1364 | (or nomsg executing-macro (> (minibuffer-depth) 0) | 1370 | (or nomsg executing-macro (> (minibuffer-depth) 0) |
| 1365 | (message "Mark set")) | 1371 | (message "Mark set")) |
| 1366 | (if (or activate (not transient-mark-mode)) | 1372 | (if (or activate (not transient-mark-mode)) |