aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2008-10-16 20:06:38 +0000
committerEli Zaretskii2008-10-16 20:06:38 +0000
commit2de17c73f345b7ad3030e7575a3c82fcff1e9da9 (patch)
treee4a6b124a4fc657c89d76e64778005c1f891156c
parentedd9ab1eb64656028f844ae3ee426c010964ce88 (diff)
downloademacs-2de17c73f345b7ad3030e7575a3c82fcff1e9da9.tar.gz
emacs-2de17c73f345b7ad3030e7575a3c82fcff1e9da9.zip
(The Mark): Document use-region-p.
-rw-r--r--doc/lispref/ChangeLog4
-rw-r--r--doc/lispref/markers.texi26
-rw-r--r--etc/NEWS1
3 files changed, 28 insertions, 3 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index e8139afdb2a..26da4b8e781 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,7 @@
12008-10-16 Eli Zaretskii <eliz@gnu.org>
2
3 * markers.texi (The Mark): Document use-region-p.
4
12008-10-15 Eli Zaretskii <eliz@gnu.org> 52008-10-15 Eli Zaretskii <eliz@gnu.org>
2 6
3 * internals.texi (Writing Emacs Primitives): The interactive spec 7 * internals.texi (Writing Emacs Primitives): The interactive spec
diff --git a/doc/lispref/markers.texi b/doc/lispref/markers.texi
index 54bf0bf2a3d..2793346c521 100644
--- a/doc/lispref/markers.texi
+++ b/doc/lispref/markers.texi
@@ -423,7 +423,11 @@ to the editor command loop by setting @code{deactivate-mark} to a
423non-@code{nil} value (but this causes deactivation only if Transient 423non-@code{nil} value (but this causes deactivation only if Transient
424Mark mode is enabled). 424Mark mode is enabled).
425 425
426 The main motivation for using Transient Mark mode is that this mode 426 Certain editing commands that normally apply to text near point,
427work on the region when Transient Mode is enabled and the mark is
428active. This is the main motivation for using Transient Mark mode.
429
430 Another motivation for using Transient Mark mode is that this mode
427also enables highlighting of the region when the mark is active. 431also enables highlighting of the region when the mark is active.
428@xref{Display}. 432@xref{Display}.
429 433
@@ -555,6 +559,11 @@ every buffer-modifying primitive sets @code{deactivate-mark}. The
555consequence of this is that commands that modify the buffer normally 559consequence of this is that commands that modify the buffer normally
556make the mark inactive. 560make the mark inactive.
557 561
562Certain commands normally apply to text near point, but in Transient
563Mark mode when the mark is active, they apply to the region instead.
564These commands should call @code{use-region-p} to test whether they
565should operate on the region.
566
558Lisp programs can set @code{transient-mark-mode} to non-@code{nil}, 567Lisp programs can set @code{transient-mark-mode} to non-@code{nil},
559non-@code{t} values to enable Transient Mark mode temporarily. If the 568non-@code{t} values to enable Transient Mark mode temporarily. If the
560value is @code{lambda}, Transient Mark mode is automatically turned 569value is @code{lambda}, Transient Mark mode is automatically turned
@@ -566,6 +575,14 @@ any subsequent command that moves point and is not shift-translated
566action that would normally deactivate the mark. 575action that would normally deactivate the mark.
567@end defopt 576@end defopt
568 577
578@deffn Subroutine use-region-p
579This function returns @code{t} if Transient Mark mode is enabled, the
580mark is active, and there's a valid region in the buffer. Commands
581that operate on the region (instead of on text near point) when
582there's an active mark should use this subroutine to test whether to
583do that.
584@end deffn
585
569@defopt mark-even-if-inactive 586@defopt mark-even-if-inactive
570If this is non-@code{nil}, Lisp programs and the Emacs user can use the 587If this is non-@code{nil}, Lisp programs and the Emacs user can use the
571mark even when it is inactive. This option affects the behavior of 588mark even when it is inactive. This option affects the behavior of
@@ -598,8 +615,11 @@ Otherwise it does nothing.
598@end defun 615@end defun
599 616
600@defvar mark-active 617@defvar mark-active
601The mark is active when this variable is non-@code{nil}. This variable 618The mark is active when this variable is non-@code{nil}. This
602is always buffer-local in each buffer. 619variable is always buffer-local in each buffer. Do @emph{not} use the
620value of this variable to decide whether a command that normally
621operates on text near point should operate on the region instead. Use
622the @code{use-region-p} subroutine (see above) for that.
603@end defvar 623@end defvar
604 624
605@defvar activate-mark-hook 625@defvar activate-mark-hook
diff --git a/etc/NEWS b/etc/NEWS
index 22ff4f8496d..727beb346cd 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1177,6 +1177,7 @@ interactive forms to subroutines.
1177 1177
1178** Region changes 1178** Region changes
1179 1179
1180+++
1180*** Commands should use `use-region-p' to test whether there is 1181*** Commands should use `use-region-p' to test whether there is
1181an active region that they should operate on. 1182an active region that they should operate on.
1182 1183