Function: exchange-point-and-mark
exchange-point-and-mark is an interactive and byte-compiled function
defined in simple.el.gz.
Signature
(exchange-point-and-mark &optional ARG)
Documentation
Put the mark where point is now, and point where the mark is now.
This command works even when the mark is not active, and it reactivates the mark.
If Transient Mark mode is on, a prefix ARG deactivates the mark if it is active, and otherwise avoids reactivating it. If Transient Mark mode is off, a prefix ARG enables Transient Mark mode temporarily.
This function has :after advice: org-mark-jump-unhide.
Probably introduced at or before Emacs version 17.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defun exchange-point-and-mark (&optional arg)
"Put the mark where point is now, and point where the mark is now.
This command works even when the mark is not active,
and it reactivates the mark.
If Transient Mark mode is on, a prefix ARG deactivates the mark
if it is active, and otherwise avoids reactivating it. If
Transient Mark mode is off, a prefix ARG enables Transient Mark
mode temporarily."
(interactive "P")
(let ((omark (mark t))
(temp-highlight (eq (car-safe transient-mark-mode) 'only)))
(if (null omark)
(user-error "No mark set in this buffer"))
(set-mark (point))
(goto-char omark)
(or temp-highlight
(cond ((xor arg (not (region-active-p)))
(deactivate-mark))
(t (activate-mark))))
nil))