Function: push-mark
push-mark is a byte-compiled function defined in simple.el.gz.
Signature
(push-mark &optional LOCATION NOMSG ACTIVATE)
Documentation
Set mark at LOCATION (point, by default) and push old mark on 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.
Novice Emacs Lisp programmers often try to use the mark for the wrong
purposes. See the documentation of set-mark for more information.
In Transient Mark mode, activate mark if optional third arg ACTIVATE non-nil.
Source Code
;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defun push-mark (&optional location nomsg activate)
"Set mark at LOCATION (point, by default) and push old mark on 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.
Novice Emacs Lisp programmers often try to use the mark for the wrong
purposes. See the documentation of `set-mark' for more information.
In Transient Mark mode, activate mark if optional third arg ACTIVATE non-nil."
(when (mark t)
(let ((old (nth mark-ring-max mark-ring))
(history-delete-duplicates nil))
(add-to-history 'mark-ring (copy-marker (mark-marker)) mark-ring-max t)
(when old
(set-marker old nil))))
(set-marker (mark-marker) (or location (point)) (current-buffer))
;; Don't push the mark on the global mark ring if the last global
;; mark pushed was in this same buffer.
(unless (and global-mark-ring
(eq (marker-buffer (car global-mark-ring)) (current-buffer)))
(let ((old (nth global-mark-ring-max global-mark-ring))
(history-delete-duplicates nil))
(add-to-history
'global-mark-ring (copy-marker (mark-marker)) global-mark-ring-max t)
(when old
(set-marker old nil))))
(or nomsg executing-kbd-macro (> (minibuffer-depth) 0)
(message "Mark set"))
(if (or activate (not transient-mark-mode))
(set-mark (mark t)))
nil)