Function: region-active-p
region-active-p is a byte-compiled function defined in simple.el.gz.
Signature
(region-active-p)
Documentation
Return t if Transient Mark mode is enabled and the mark is active.
Some commands act specially on the region when Transient Mark
mode is enabled. Usually, such commands should use
use-region-p instead of this function, because use-region-p
also checks the value of use-empty-active-region.
Probably introduced at or before Emacs version 23.1.
Aliases
allout-region-active-p (obsolete since 28.1)
Source Code
;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defun region-active-p ()
"Return t if Transient Mark mode is enabled and the mark is active.
Some commands act specially on the region when Transient Mark
mode is enabled. Usually, such commands should use
`use-region-p' instead of this function, because `use-region-p'
also checks the value of `use-empty-active-region'."
(and transient-mark-mode mark-active
;; FIXME: Somehow we sometimes end up with mark-active non-nil but
;; without the mark being set (e.g. bug#17324). We really should fix
;; that problem, but in the mean time, let's make sure we don't say the
;; region is active when there's no mark.
(progn (cl-assert (mark)) t)))