diff options
| author | Eli Zaretskii | 2008-10-16 20:06:38 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2008-10-16 20:06:38 +0000 |
| commit | 2de17c73f345b7ad3030e7575a3c82fcff1e9da9 (patch) | |
| tree | e4a6b124a4fc657c89d76e64778005c1f891156c | |
| parent | edd9ab1eb64656028f844ae3ee426c010964ce88 (diff) | |
| download | emacs-2de17c73f345b7ad3030e7575a3c82fcff1e9da9.tar.gz emacs-2de17c73f345b7ad3030e7575a3c82fcff1e9da9.zip | |
(The Mark): Document use-region-p.
| -rw-r--r-- | doc/lispref/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/lispref/markers.texi | 26 | ||||
| -rw-r--r-- | etc/NEWS | 1 |
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 @@ | |||
| 1 | 2008-10-16 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * markers.texi (The Mark): Document use-region-p. | ||
| 4 | |||
| 1 | 2008-10-15 Eli Zaretskii <eliz@gnu.org> | 5 | 2008-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 | |||
| 423 | non-@code{nil} value (but this causes deactivation only if Transient | 423 | non-@code{nil} value (but this causes deactivation only if Transient |
| 424 | Mark mode is enabled). | 424 | Mark 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, |
| 427 | work on the region when Transient Mode is enabled and the mark is | ||
| 428 | active. This is the main motivation for using Transient Mark mode. | ||
| 429 | |||
| 430 | Another motivation for using Transient Mark mode is that this mode | ||
| 427 | also enables highlighting of the region when the mark is active. | 431 | also 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 | |||
| 555 | consequence of this is that commands that modify the buffer normally | 559 | consequence of this is that commands that modify the buffer normally |
| 556 | make the mark inactive. | 560 | make the mark inactive. |
| 557 | 561 | ||
| 562 | Certain commands normally apply to text near point, but in Transient | ||
| 563 | Mark mode when the mark is active, they apply to the region instead. | ||
| 564 | These commands should call @code{use-region-p} to test whether they | ||
| 565 | should operate on the region. | ||
| 566 | |||
| 558 | Lisp programs can set @code{transient-mark-mode} to non-@code{nil}, | 567 | Lisp programs can set @code{transient-mark-mode} to non-@code{nil}, |
| 559 | non-@code{t} values to enable Transient Mark mode temporarily. If the | 568 | non-@code{t} values to enable Transient Mark mode temporarily. If the |
| 560 | value is @code{lambda}, Transient Mark mode is automatically turned | 569 | value is @code{lambda}, Transient Mark mode is automatically turned |
| @@ -566,6 +575,14 @@ any subsequent command that moves point and is not shift-translated | |||
| 566 | action that would normally deactivate the mark. | 575 | action that would normally deactivate the mark. |
| 567 | @end defopt | 576 | @end defopt |
| 568 | 577 | ||
| 578 | @deffn Subroutine use-region-p | ||
| 579 | This function returns @code{t} if Transient Mark mode is enabled, the | ||
| 580 | mark is active, and there's a valid region in the buffer. Commands | ||
| 581 | that operate on the region (instead of on text near point) when | ||
| 582 | there's an active mark should use this subroutine to test whether to | ||
| 583 | do that. | ||
| 584 | @end deffn | ||
| 585 | |||
| 569 | @defopt mark-even-if-inactive | 586 | @defopt mark-even-if-inactive |
| 570 | If this is non-@code{nil}, Lisp programs and the Emacs user can use the | 587 | If this is non-@code{nil}, Lisp programs and the Emacs user can use the |
| 571 | mark even when it is inactive. This option affects the behavior of | 588 | mark 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 |
| 601 | The mark is active when this variable is non-@code{nil}. This variable | 618 | The mark is active when this variable is non-@code{nil}. This |
| 602 | is always buffer-local in each buffer. | 619 | variable is always buffer-local in each buffer. Do @emph{not} use the |
| 620 | value of this variable to decide whether a command that normally | ||
| 621 | operates on text near point should operate on the region instead. Use | ||
| 622 | the @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 |
| @@ -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 |
| 1181 | an active region that they should operate on. | 1182 | an active region that they should operate on. |
| 1182 | 1183 | ||