Function: save-mark-and-excursion
save-mark-and-excursion is a macro defined in simple.el.gz.
Signature
(save-mark-and-excursion &rest BODY)
Documentation
Like save-excursion, but also save and restore the mark state.
This macro does what save-excursion did before Emacs 25.1.
Probably introduced at or before Emacs version 25.1.
Source Code
;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defmacro save-mark-and-excursion (&rest body)
"Like `save-excursion', but also save and restore the mark state.
This macro does what `save-excursion' did before Emacs 25.1."
(declare (indent 0) (debug t))
(let ((saved-marker-sym (make-symbol "saved-marker")))
`(let ((,saved-marker-sym (save-mark-and-excursion--save)))
(unwind-protect
(save-excursion ,@body)
(save-mark-and-excursion--restore ,saved-marker-sym)))))