Function: mark

mark is a byte-compiled function defined in simple.el.gz.

Signature

(mark &optional FORCE)

Documentation

Return this buffer's mark value as integer, or nil if never set.

In Transient Mark mode, this function signals an error if the mark is not active. However, if mark-even-if-inactive is non-nil, or the argument FORCE is non-nil, it disregards whether the mark is active, and returns an integer or nil in the usual way.

If you are using this in an editing command, you are most likely making a mistake; see the documentation of set-mark.

View in manual

Probably introduced at or before Emacs version 29.1.

Source Code

;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defun mark (&optional force)
  "Return this buffer's mark value as integer, or nil if never set.

In Transient Mark mode, this function signals an error if
the mark is not active.  However, if `mark-even-if-inactive' is non-nil,
or the argument FORCE is non-nil, it disregards whether the mark
is active, and returns an integer or nil in the usual way.

If you are using this in an editing command, you are most likely making
a mistake; see the documentation of `set-mark'."
  (declare (ftype (function (&optional t) (or integer null)))
           (side-effect-free t))
  (if (or force (not transient-mark-mode) mark-active mark-even-if-inactive)
      (marker-position (mark-marker))
    (signal 'mark-inactive nil)))