aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2009-04-06 01:20:55 +0000
committerChong Yidong2009-04-06 01:20:55 +0000
commit47af2f4b96cd4ef4c2a28ca6b217409b8d1ae384 (patch)
tree4e3b923124f2007eb1d0ff5a416bb183856cf772
parent38145b39b915ef131188875bf9f4ce4882a42a9e (diff)
downloademacs-47af2f4b96cd4ef4c2a28ca6b217409b8d1ae384.tar.gz
emacs-47af2f4b96cd4ef4c2a28ca6b217409b8d1ae384.zip
* markers.texi (The Mark): Copyedits. Improve description of
handle-shift-selection. (The Region): Move use-region-p here from The Mark.
-rw-r--r--doc/lispref/ChangeLog4
-rw-r--r--doc/lispref/markers.texi150
2 files changed, 67 insertions, 87 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index ebd2f54d07d..e8ebb3ee1ce 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,5 +1,9 @@
12009-04-05 Chong Yidong <cyd@stupidchicken.com> 12009-04-05 Chong Yidong <cyd@stupidchicken.com>
2 2
3 * markers.texi (The Mark): Copyedits. Improve description of
4 handle-shift-selection.
5 (The Region): Move use-region-p here from The Mark.
6
3 * positions.texi (Screen Lines): Document (cols . lines) argument 7 * positions.texi (Screen Lines): Document (cols . lines) argument
4 for vertical-motion. 8 for vertical-motion.
5 9
diff --git a/doc/lispref/markers.texi b/doc/lispref/markers.texi
index 54b674b4669..78dbbefd790 100644
--- a/doc/lispref/markers.texi
+++ b/doc/lispref/markers.texi
@@ -392,44 +392,42 @@ This is another name for @code{set-marker}.
392@cindex mark, the 392@cindex mark, the
393@cindex mark ring 393@cindex mark ring
394 394
395 One special marker in each buffer is designated @dfn{the mark}. It 395 Each buffer has a special marker, which is designated @dfn{the
396specifies a position to bound a range of text for commands such as 396mark}. When a buffer is newly created, this marker exists but does
397@code{kill-region} and @code{indent-rigidly}. Lisp programs should 397not point anywhere; this means that the mark ``doesn't exist'' in that
398set the mark only to values that have a potential use to the user, and 398buffer yet. Subsequent commands can set the mark.
399never for their own internal purposes. For example, the 399
400@code{replace-regexp} command sets the mark to the value of point 400 The mark specifies a position to bound a range of text for many
401before doing any replacements, because this enables the user to move 401commands, such as @code{kill-region} and @code{indent-rigidly}. These
402back there conveniently after the replace is finished. 402commands typically act on the text between point and the mark, which
403 403is called the @dfn{region}. If you are writing a command that
404 Many commands are designed to operate on the text between point and 404operates on the region, don't examine the mark directly; instead, use
405the mark when called interactively. If you are writing such a
406command, don't examine the mark directly; instead, use
407@code{interactive} with the @samp{r} specification. This provides the 405@code{interactive} with the @samp{r} specification. This provides the
408values of point and the mark as arguments to the command in an 406values of point and the mark as arguments to the command in an
409interactive call, but permits other Lisp programs to specify arguments 407interactive call, but permits other Lisp programs to specify arguments
410explicitly. @xref{Interactive Codes}. 408explicitly. @xref{Interactive Codes}.
411 409
412 Each buffer has a marker which represents the value of the mark in 410 Some commands set the mark as a side-effect. Commands should do
413that buffer, independent of any other buffer. When a buffer is newly 411this only if it has a potential use to the user, and never for their
414created, this marker exists but does not point anywhere. That means 412own internal purposes. For example, the @code{replace-regexp} command
415the mark ``doesn't exist'' in that buffer as yet. 413sets the mark to the value of point before doing any replacements,
414because this enables the user to move back there conveniently after
415the replace is finished.
416 416
417 Once the mark ``exists'' in a buffer, it normally never ceases to 417 Once the mark ``exists'' in a buffer, it normally never ceases to
418exist. However, it may become @dfn{inactive}, if Transient Mark mode is 418exist. However, it may become @dfn{inactive}, if Transient Mark mode
419enabled. The variable @code{mark-active}, which is always buffer-local 419is enabled. The buffer-local variable @code{mark-active}, if
420in all buffers, indicates whether the mark is active: non-@code{nil} 420non-@code{nil}, means that the mark is active. A command can call the
421means yes. A command can request deactivation of the mark upon return 421function @code{deactivate-mark} to deactivate the mark directly, or it
422to the editor command loop by setting @code{deactivate-mark} to a 422can request deactivation of the mark upon return to the editor command
423non-@code{nil} value (but this causes deactivation only if Transient 423loop by setting the variable @code{deactivate-mark} to a
424Mark mode is enabled). 424non-@code{nil} value.
425 425
426 Certain editing commands that normally apply to text near point, 426 If Transient Mode is enabled, certain editing commands that normally
427work on the region when Transient Mode is enabled and the mark is 427apply to text near point, apply instead to the region when the mark is
428active. This is the main motivation for using Transient Mark mode. 428active. This is the main motivation for using Transient Mark mode.
429 429(Another is that this enables highlighting of the region when the mark
430 Another motivation for using Transient Mark mode is that this mode 430is active. @xref{Display}.)
431also enables highlighting of the region when the mark is active.
432@xref{Display}.
433 431
434 In addition to the mark, each buffer has a @dfn{mark ring} which is a 432 In addition to the mark, each buffer has a @dfn{mark ring} which is a
435list of markers containing previous values of the mark. When editing 433list of markers containing previous values of the mark. When editing
@@ -450,8 +448,8 @@ or @code{nil} if no mark has ever been set in this buffer.
450If Transient Mark mode is enabled, and @code{mark-even-if-inactive} is 448If Transient Mark mode is enabled, and @code{mark-even-if-inactive} is
451@code{nil}, @code{mark} signals an error if the mark is inactive. 449@code{nil}, @code{mark} signals an error if the mark is inactive.
452However, if @var{force} is non-@code{nil}, then @code{mark} disregards 450However, if @var{force} is non-@code{nil}, then @code{mark} disregards
453inactivity of the mark, and returns the mark position anyway (or 451inactivity of the mark, and returns the mark position (or @code{nil})
454@code{nil}). 452anyway.
455@end defun 453@end defun
456 454
457@defun mark-marker 455@defun mark-marker
@@ -481,20 +479,6 @@ it is the mark, it will yield perfectly consistent, but rather odd,
481results. We recommend that you not do it! 479results. We recommend that you not do it!
482@end defun 480@end defun
483 481
484@ignore
485@deffn Command set-mark-command jump
486If @var{jump} is @code{nil}, this command sets the mark to the value
487of point and pushes the previous value of the mark on the mark ring. The
488message @samp{Mark set} is also displayed in the echo area.
489
490If @var{jump} is not @code{nil}, this command sets point to the value
491of the mark, and sets the mark to the previous saved mark value, which
492is popped off the mark ring.
493
494This function is @emph{only} intended for interactive use.
495@end deffn
496@end ignore
497
498@defun set-mark position 482@defun set-mark position
499This function sets the mark to @var{position}, and activates the mark. 483This function sets the mark to @var{position}, and activates the mark.
500The old value of the mark is @emph{not} pushed onto the mark ring. 484The old value of the mark is @emph{not} pushed onto the mark ring.
@@ -522,14 +506,6 @@ example:
522@end example 506@end example
523@end defun 507@end defun
524 508
525@c for interactive use only
526@ignore
527@deffn Command exchange-point-and-mark
528This function exchanges the positions of point and the mark.
529It is intended for interactive use.
530@end deffn
531@end ignore
532
533@defun push-mark &optional position nomsg activate 509@defun push-mark &optional position nomsg activate
534This function sets the current buffer's mark to @var{position}, and 510This function sets the current buffer's mark to @var{position}, and
535pushes a copy of the previous mark onto @code{mark-ring}. If 511pushes a copy of the previous mark onto @code{mark-ring}. If
@@ -553,16 +529,15 @@ The return value is not meaningful.
553@end defun 529@end defun
554 530
555@defopt transient-mark-mode 531@defopt transient-mark-mode
556@c @cindex Transient Mark mode Redundant 532This variable, if non-@code{nil}, enables Transient Mark mode. In
557This variable if non-@code{nil} enables Transient Mark mode, in which 533Transient Mark mode, every buffer-modifying primitive sets
558every buffer-modifying primitive sets @code{deactivate-mark}. The 534@code{deactivate-mark}. As a consequence, most commands that modify
559consequence of this is that commands that modify the buffer normally 535the buffer also deactivate the mark.
560make the mark inactive.
561 536
562Certain commands normally apply to text near point, but in Transient 537When Transient Mark mode is enabled and the mark is active, many
563Mark mode when the mark is active, they apply to the region instead. 538commands that normally apply to the text near point instead apply to
564These commands should call @code{use-region-p} to test whether they 539the region. Such commands should use the function @code{use-region-p}
565should operate on the region. 540to test whether they should operate on the region. @xref{The Region}.
566 541
567Lisp programs can set @code{transient-mark-mode} to non-@code{nil}, 542Lisp programs can set @code{transient-mark-mode} to non-@code{nil},
568non-@code{t} values to enable Transient Mark mode temporarily. If the 543non-@code{t} values to enable Transient Mark mode temporarily. If the
@@ -575,14 +550,6 @@ any subsequent command that moves point and is not shift-translated
575action that would normally deactivate the mark. 550action that would normally deactivate the mark.
576@end defopt 551@end defopt
577 552
578@defun 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 defun
585
586@defopt mark-even-if-inactive 553@defopt mark-even-if-inactive
587If this is non-@code{nil}, Lisp programs and the Emacs user can use the 554If this is non-@code{nil}, Lisp programs and the Emacs user can use the
588mark even when it is inactive. This option affects the behavior of 555mark even when it is inactive. This option affects the behavior of
@@ -619,7 +586,7 @@ The mark is active when this variable is non-@code{nil}. This
619variable is always buffer-local in each buffer. Do @emph{not} use the 586variable is always buffer-local in each buffer. Do @emph{not} use the
620value of this variable to decide whether a command that normally 587value of this variable to decide whether a command that normally
621operates on text near point should operate on the region instead. Use 588operates on text near point should operate on the region instead. Use
622the @code{use-region-p} subroutine (see above) for that. 589the function @code{use-region-p} for that (@pxref{The Region}).
623@end defvar 590@end defvar
624 591
625@defvar activate-mark-hook 592@defvar activate-mark-hook
@@ -630,6 +597,23 @@ also run at the end of a command if the mark is active and it is
630possible that the region may have changed. 597possible that the region may have changed.
631@end defvar 598@end defvar
632 599
600@defun handle-shift-selection
601This function implements the ``shift-selection'' behavior of
602point-motion commands. @xref{Shift Selection,,, emacs, The GNU Emacs
603Manual}. It is called automatically by the Emacs command loop
604whenever a command with a @samp{^} character in its @code{interactive}
605spec is invoked, before the command itself is executed
606(@pxref{Interactive Codes, ^}).
607
608If @code{shift-select-mode} is non-@code{nil} and the current command
609was invoked via shift translation (@pxref{Key Sequence Input,
610shift-translation}), this function sets the mark and temporarily
611activates the region, unless the region was already temporarily
612activated in this way. Otherwise, if the region has been activated
613temporarily, it deactivates the mark and restores the variable
614@code{transient-mark-mode} to its earlier value.
615@end defun
616
633@defvar mark-ring 617@defvar mark-ring
634The value of this buffer-local variable is the list of saved former 618The value of this buffer-local variable is the list of saved former
635marks of the current buffer, most recent first. 619marks of the current buffer, most recent first.
@@ -650,21 +634,6 @@ more marks than this are pushed onto the @code{mark-ring},
650@code{push-mark} discards an old mark when it adds a new one. 634@code{push-mark} discards an old mark when it adds a new one.
651@end defopt 635@end defopt
652 636
653@defun handle-shift-selection
654This function checks whether the current command was invoked via shift
655translation (@pxref{Key Sequence Input, shift-translation}), and if
656so, sets the mark and temporarily activates the region, unless the
657region is already temporarily activated in this way. If the command
658was invoked without shift translation and the region is temporarily
659active, or if the region was activated by the mouse, the function
660deactivates the mark.
661
662This function is called whenever a command with a @samp{^} character
663in its @code{interactive} spec (@pxref{Interactive Codes, ^}) is
664invoked while @code{shift-select-mode} (@pxref{Shift Selection,,,
665emacs, The GNU Emacs Manual}) is non-@code{nil}.
666@end defun
667
668@node The Region 637@node The Region
669@section The Region 638@section The Region
670@cindex region (between point and mark) 639@cindex region (between point and mark)
@@ -698,6 +667,13 @@ to find the beginning and end of the region. This lets other Lisp
698programs specify the bounds explicitly as arguments. (@xref{Interactive 667programs specify the bounds explicitly as arguments. (@xref{Interactive
699Codes}.) 668Codes}.)
700 669
670@defun use-region-p
671This function returns @code{t} if Transient Mark mode is enabled, the
672mark is active, and there's a valid region in the buffer. Commands
673that operate on the region (instead of on text near point) when
674there's an active mark should use this to test whether to do that.
675@end defun
676
701@ignore 677@ignore
702 arch-tag: b1ba2e7a-a0f3-4c5e-875c-7d8e22d73299 678 arch-tag: b1ba2e7a-a0f3-4c5e-875c-7d8e22d73299
703@end ignore 679@end ignore