diff options
| author | Joakim Verona | 2012-03-07 09:41:43 +0100 |
|---|---|---|
| committer | Joakim Verona | 2012-03-07 09:41:43 +0100 |
| commit | 1e3a41b29b5bd263cde651d9f23517c8a29155dc (patch) | |
| tree | 521dbc7d21eff3acefe3e74e2585f49923924534 /doc | |
| parent | 28485daaf752ff5264ed2f6a32ec15588beaa929 (diff) | |
| parent | 3266b56f817e562638f0ab7ca36fe5e01a44f831 (diff) | |
| download | emacs-1e3a41b29b5bd263cde651d9f23517c8a29155dc.tar.gz emacs-1e3a41b29b5bd263cde651d9f23517c8a29155dc.zip | |
upstream
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/ChangeLog | 24 | ||||
| -rw-r--r-- | doc/lispref/markers.texi | 88 | ||||
| -rw-r--r-- | doc/lispref/text.texi | 75 |
3 files changed, 110 insertions, 77 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 7f11c65f9e1..42ec24fac5f 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,27 @@ | |||
| 1 | 2012-03-07 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * markers.texi (The Region): Briefly mention use-empty-active-region | ||
| 4 | and region-active-p. | ||
| 5 | (Overview of Markers): Reword garbage collection, add cross-ref. | ||
| 6 | (The Mark): Tiny clarification re command loop and activate-mark-hook. | ||
| 7 | |||
| 8 | 2012-03-07 Chong Yidong <cyd@gnu.org> | ||
| 9 | |||
| 10 | * text.texi (Buffer Contents): Don't duplicate explanation of | ||
| 11 | region arguments from Text node. Put doc of obsolete var | ||
| 12 | buffer-substring-filters back, since it is referred to. | ||
| 13 | (Low-Level Kill Ring): Yank now uses clipboard instead of primary | ||
| 14 | selection by default. | ||
| 15 | |||
| 16 | * markers.texi (The Mark): Fix typo. | ||
| 17 | (The Region): Copyedits. | ||
| 18 | |||
| 19 | 2012-03-07 Glenn Morris <rgm@gnu.org> | ||
| 20 | |||
| 21 | * markers.texi (Overview of Markers): Copyedits. | ||
| 22 | (Creating Markers): Update approximate example buffer size. | ||
| 23 | (The Mark): Don't mention uninteresting return values. | ||
| 24 | |||
| 1 | 2012-03-05 Chong Yidong <cyd@gnu.org> | 25 | 2012-03-05 Chong Yidong <cyd@gnu.org> |
| 2 | 26 | ||
| 3 | * positions.texi (Text Lines): Document count-words. | 27 | * positions.texi (Text Lines): Document count-words. |
diff --git a/doc/lispref/markers.texi b/doc/lispref/markers.texi index e8a009de401..25a9fc88fc5 100644 --- a/doc/lispref/markers.texi +++ b/doc/lispref/markers.texi | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | @c -*-texinfo-*- | 1 | @c -*-texinfo-*- |
| 2 | @c This is part of the GNU Emacs Lisp Reference Manual. | 2 | @c This is part of the GNU Emacs Lisp Reference Manual. |
| 3 | @c Copyright (C) 1990-1995, 1998-1999, 2001-2012 Free Software Foundation, Inc. | 3 | @c Copyright (C) 1990-1995, 1998-1999, 2001-2012 Free Software Foundation, Inc. |
| 4 | @c See the file elisp.texi for copying conditions. | 4 | @c See the file elisp.texi for copying conditions. |
| 5 | @setfilename ../../info/markers | 5 | @setfilename ../../info/markers |
| 6 | @node Markers, Text, Positions, Top | 6 | @node Markers, Text, Positions, Top |
| @@ -27,8 +27,8 @@ deleted, so that it stays with the two characters on either side of it. | |||
| 27 | @node Overview of Markers | 27 | @node Overview of Markers |
| 28 | @section Overview of Markers | 28 | @section Overview of Markers |
| 29 | 29 | ||
| 30 | A marker specifies a buffer and a position in that buffer. The | 30 | A marker specifies a buffer and a position in that buffer. A |
| 31 | marker can be used to represent a position in the functions that | 31 | marker can be used to represent a position in functions that |
| 32 | require one, just as an integer could be used. In that case, the | 32 | require one, just as an integer could be used. In that case, the |
| 33 | marker's buffer is normally ignored. Of course, a marker used in this | 33 | marker's buffer is normally ignored. Of course, a marker used in this |
| 34 | way usually points to a position in the buffer that the function | 34 | way usually points to a position in the buffer that the function |
| @@ -38,12 +38,12 @@ operates on, but that is entirely the programmer's responsibility. | |||
| 38 | A marker has three attributes: the marker position, the marker | 38 | A marker has three attributes: the marker position, the marker |
| 39 | buffer, and the insertion type. The marker position is an integer | 39 | buffer, and the insertion type. The marker position is an integer |
| 40 | that is equivalent (at a given time) to the marker as a position in | 40 | that is equivalent (at a given time) to the marker as a position in |
| 41 | that buffer. But the marker's position value can change often during | 41 | that buffer. But the marker's position value can change during |
| 42 | the life of the marker. Insertion and deletion of text in the buffer | 42 | the life of the marker, and often does. Insertion and deletion of |
| 43 | relocate the marker. The idea is that a marker positioned between two | 43 | text in the buffer relocate the marker. The idea is that a marker |
| 44 | characters remains between those two characters despite insertion and | 44 | positioned between two characters remains between those two characters |
| 45 | deletion elsewhere in the buffer. Relocation changes the integer | 45 | despite insertion and deletion elsewhere in the buffer. Relocation |
| 46 | equivalent of the marker. | 46 | changes the integer equivalent of the marker. |
| 47 | 47 | ||
| 48 | @cindex marker relocation | 48 | @cindex marker relocation |
| 49 | Deleting text around a marker's position leaves the marker between the | 49 | Deleting text around a marker's position leaves the marker between the |
| @@ -58,12 +58,12 @@ with @code{insert-before-markers} (@pxref{Insertion}). | |||
| 58 | relocate them if necessary. This slows processing in a buffer with a | 58 | relocate them if necessary. This slows processing in a buffer with a |
| 59 | large number of markers. For this reason, it is a good idea to make a | 59 | large number of markers. For this reason, it is a good idea to make a |
| 60 | marker point nowhere if you are sure you don't need it any more. | 60 | marker point nowhere if you are sure you don't need it any more. |
| 61 | Unreferenced markers are garbage collected eventually, but until then | 61 | Markers that can no longer be accessed are eventually removed |
| 62 | will continue to use time if they do point somewhere. | 62 | (@pxref{Garbage Collection}). |
| 63 | 63 | ||
| 64 | @cindex markers as numbers | 64 | @cindex markers as numbers |
| 65 | Because it is common to perform arithmetic operations on a marker | 65 | Because it is common to perform arithmetic operations on a marker |
| 66 | position, most of the arithmetic operations (including @code{+} and | 66 | position, most of these operations (including @code{+} and |
| 67 | @code{-}) accept markers as arguments. In such cases, the marker | 67 | @code{-}) accept markers as arguments. In such cases, the marker |
| 68 | stands for its current position. | 68 | stands for its current position. |
| 69 | 69 | ||
| @@ -188,7 +188,7 @@ chapter. | |||
| 188 | (point-min-marker) | 188 | (point-min-marker) |
| 189 | @result{} #<marker at 1 in markers.texi> | 189 | @result{} #<marker at 1 in markers.texi> |
| 190 | (point-max-marker) | 190 | (point-max-marker) |
| 191 | @result{} #<marker at 15573 in markers.texi> | 191 | @result{} #<marker at 24080 in markers.texi> |
| 192 | @end group | 192 | @end group |
| 193 | 193 | ||
| 194 | @group | 194 | @group |
| @@ -229,8 +229,8 @@ buffer. | |||
| 229 | @end group | 229 | @end group |
| 230 | 230 | ||
| 231 | @group | 231 | @group |
| 232 | (copy-marker 20000) | 232 | (copy-marker 90000) |
| 233 | @result{} #<marker at 7572 in markers.texi> | 233 | @result{} #<marker at 24080 in markers.texi> |
| 234 | @end group | 234 | @end group |
| 235 | @end example | 235 | @end example |
| 236 | 236 | ||
| @@ -422,11 +422,11 @@ can request deactivation of the mark upon return to the editor command | |||
| 422 | loop by setting the variable @code{deactivate-mark} to a | 422 | loop by setting the variable @code{deactivate-mark} to a |
| 423 | non-@code{nil} value. | 423 | non-@code{nil} value. |
| 424 | 424 | ||
| 425 | If Transient Mode is enabled, certain editing commands that normally | 425 | If Transient Mark mode is enabled, certain editing commands that |
| 426 | apply to text near point, apply instead to the region when the mark is | 426 | normally apply to text near point, apply instead to the region when |
| 427 | active. This is the main motivation for using Transient Mark mode. | 427 | the mark is active. This is the main motivation for using Transient |
| 428 | (Another is that this enables highlighting of the region when the mark | 428 | Mark mode. (Another is that this enables highlighting of the region |
| 429 | is active. @xref{Display}.) | 429 | when the mark is active. @xref{Display}.) |
| 430 | 430 | ||
| 431 | In addition to the mark, each buffer has a @dfn{mark ring} which is a | 431 | In addition to the mark, each buffer has a @dfn{mark ring} which is a |
| 432 | list of markers containing previous values of the mark. When editing | 432 | list of markers containing previous values of the mark. When editing |
| @@ -509,7 +509,8 @@ example: | |||
| 509 | This function sets the current buffer's mark to @var{position}, and | 509 | This function sets the current buffer's mark to @var{position}, and |
| 510 | pushes a copy of the previous mark onto @code{mark-ring}. If | 510 | pushes a copy of the previous mark onto @code{mark-ring}. If |
| 511 | @var{position} is @code{nil}, then the value of point is used. | 511 | @var{position} is @code{nil}, then the value of point is used. |
| 512 | @code{push-mark} returns @code{nil}. | 512 | @c Doesn't seem relevant. |
| 513 | @c @code{push-mark} returns @code{nil}. | ||
| 513 | 514 | ||
| 514 | The function @code{push-mark} normally @emph{does not} activate the | 515 | The function @code{push-mark} normally @emph{does not} activate the |
| 515 | mark. To do that, specify @code{t} for the argument @var{activate}. | 516 | mark. To do that, specify @code{t} for the argument @var{activate}. |
| @@ -523,8 +524,9 @@ This function pops off the top element of @code{mark-ring} and makes | |||
| 523 | that mark become the buffer's actual mark. This does not move point in | 524 | that mark become the buffer's actual mark. This does not move point in |
| 524 | the buffer, and it does nothing if @code{mark-ring} is empty. It | 525 | the buffer, and it does nothing if @code{mark-ring} is empty. It |
| 525 | deactivates the mark. | 526 | deactivates the mark. |
| 526 | 527 | @c | |
| 527 | The return value is not meaningful. | 528 | @c Seems even less relevant. |
| 529 | @c The return value is not meaningful. | ||
| 528 | @end defun | 530 | @end defun |
| 529 | 531 | ||
| 530 | @defopt transient-mark-mode | 532 | @defopt transient-mark-mode |
| @@ -593,8 +595,16 @@ the function @code{use-region-p} for that (@pxref{The Region}). | |||
| 593 | @defvarx deactivate-mark-hook | 595 | @defvarx deactivate-mark-hook |
| 594 | These normal hooks are run, respectively, when the mark becomes active | 596 | These normal hooks are run, respectively, when the mark becomes active |
| 595 | and when it becomes inactive. The hook @code{activate-mark-hook} is | 597 | and when it becomes inactive. The hook @code{activate-mark-hook} is |
| 596 | also run at the end of a command if the mark is active and it is | 598 | also run at the end of the command loop if the mark is active and it |
| 597 | possible that the region may have changed. | 599 | is possible that the region may have changed. |
| 600 | @ignore | ||
| 601 | This piece of command_loop_1, run unless deactivating the mark: | ||
| 602 | if (current_buffer != prev_buffer || MODIFF != prev_modiff) | ||
| 603 | { | ||
| 604 | Lisp_Object hook = intern ("activate-mark-hook"); | ||
| 605 | Frun_hooks (1, &hook); | ||
| 606 | } | ||
| 607 | @end ignore | ||
| 598 | @end defvar | 608 | @end defvar |
| 599 | 609 | ||
| 600 | @defun handle-shift-selection | 610 | @defun handle-shift-selection |
| @@ -634,6 +644,9 @@ more marks than this are pushed onto the @code{mark-ring}, | |||
| 634 | @code{push-mark} discards an old mark when it adds a new one. | 644 | @code{push-mark} discards an old mark when it adds a new one. |
| 635 | @end defopt | 645 | @end defopt |
| 636 | 646 | ||
| 647 | @c There is also global-mark-ring-max, but this chapter explicitly | ||
| 648 | @c does not talk about the global mark. | ||
| 649 | |||
| 637 | @node The Region | 650 | @node The Region |
| 638 | @section The Region | 651 | @section The Region |
| 639 | @cindex region (between point and mark) | 652 | @cindex region (between point and mark) |
| @@ -660,16 +673,23 @@ integer). This is the position of either point or the mark, whichever is | |||
| 660 | larger. | 673 | larger. |
| 661 | @end defun | 674 | @end defun |
| 662 | 675 | ||
| 663 | Few programs need to use the @code{region-beginning} and | 676 | Instead of using @code{region-beginning} and @code{region-end}, a |
| 664 | @code{region-end} functions. A command designed to operate on a region | 677 | command designed to operate on a region should normally use |
| 665 | should normally use @code{interactive} with the @samp{r} specification | 678 | @code{interactive} with the @samp{r} specification to find the |
| 666 | to find the beginning and end of the region. This lets other Lisp | 679 | beginning and end of the region. This lets other Lisp programs |
| 667 | programs specify the bounds explicitly as arguments. (@xref{Interactive | 680 | specify the bounds explicitly as arguments. @xref{Interactive Codes}. |
| 668 | Codes}.) | ||
| 669 | 681 | ||
| 670 | @defun use-region-p | 682 | @defun use-region-p |
| 671 | This function returns @code{t} if Transient Mark mode is enabled, the | 683 | This function returns @code{t} if Transient Mark mode is enabled, the |
| 672 | mark is active, and there's a valid region in the buffer. Commands | 684 | mark is active, and there is a valid region in the buffer. This |
| 673 | that operate on the region (instead of on text near point) when | 685 | function is intended to be used by commands that operate on the |
| 674 | there's an active mark should use this to test whether to do that. | 686 | region, instead of on text near point, when the mark is active. |
| 687 | |||
| 688 | A region is valid if it has a non-zero size, or if the user option | ||
| 689 | @code{use-empty-active-region} is non-@code{nil} (by default, it is | ||
| 690 | @code{nil}). The function @code{region-active-p} is similar to | ||
| 691 | @code{use-region-p}, but considers all regions as valid. In most | ||
| 692 | cases, you should not use @code{region-active-p}, since if the region | ||
| 693 | is empty it is often more appropriate to operate on point. | ||
| 675 | @end defun | 694 | @end defun |
| 695 | |||
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 416bfef4a60..88cb6a157f8 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi | |||
| @@ -169,13 +169,9 @@ convert any portion of the text in the buffer into a string. | |||
| 169 | @defun buffer-substring start end | 169 | @defun buffer-substring start end |
| 170 | This function returns a string containing a copy of the text of the | 170 | This function returns a string containing a copy of the text of the |
| 171 | region defined by positions @var{start} and @var{end} in the current | 171 | region defined by positions @var{start} and @var{end} in the current |
| 172 | buffer. If the arguments are not positions in the accessible portion of | 172 | buffer. If the arguments are not positions in the accessible portion |
| 173 | the buffer, @code{buffer-substring} signals an @code{args-out-of-range} | 173 | of the buffer, @code{buffer-substring} signals an |
| 174 | error. | 174 | @code{args-out-of-range} error. |
| 175 | |||
| 176 | It is not necessary for @var{start} to be less than @var{end}; the | ||
| 177 | arguments can be given in either order. But most often the smaller | ||
| 178 | argument is written first. | ||
| 179 | 175 | ||
| 180 | Here's an example which assumes Font-Lock mode is not enabled: | 176 | Here's an example which assumes Font-Lock mode is not enabled: |
| 181 | 177 | ||
| @@ -218,14 +214,20 @@ This is like @code{buffer-substring}, except that it does not copy text | |||
| 218 | properties, just the characters themselves. @xref{Text Properties}. | 214 | properties, just the characters themselves. @xref{Text Properties}. |
| 219 | @end defun | 215 | @end defun |
| 220 | 216 | ||
| 217 | @defun buffer-string | ||
| 218 | This function returns the contents of the entire accessible portion of | ||
| 219 | the current buffer as a string. It is equivalent to | ||
| 220 | @w{@code{(buffer-substring (point-min) (point-max))}}. | ||
| 221 | @end defun | ||
| 222 | |||
| 221 | @defun filter-buffer-substring start end &optional delete | 223 | @defun filter-buffer-substring start end &optional delete |
| 222 | This function passes the buffer text between @var{start} and @var{end} | 224 | This function passes the buffer text between @var{start} and @var{end} |
| 223 | through the filter functions specified by the wrapper hook | 225 | through the filter functions specified by the wrapper hook |
| 224 | @code{filter-buffer-substring-functions}, and returns the final | 226 | @code{filter-buffer-substring-functions}, and returns the result. The |
| 225 | result of applying all filters. The obsolete variable | 227 | obsolete variable @code{buffer-substring-filters} is also consulted. |
| 226 | @code{buffer-substring-filters} is also consulted. If both of these | 228 | If both of these variables are @code{nil}, the value is the unaltered |
| 227 | variables are @code{nil}, the value is the unaltered text from the | 229 | text from the buffer, i.e.@: what @code{buffer-substring} would |
| 228 | buffer, as @code{buffer-substring} would return. | 230 | return. |
| 229 | 231 | ||
| 230 | If @var{delete} is non-@code{nil}, this function deletes the text | 232 | If @var{delete} is non-@code{nil}, this function deletes the text |
| 231 | between @var{start} and @var{end} after copying it, like | 233 | between @var{start} and @var{end} after copying it, like |
| @@ -260,30 +262,20 @@ this, and so on. The actual return value is the result of all the | |||
| 260 | hook functions acting in sequence. | 262 | hook functions acting in sequence. |
| 261 | @end defvar | 263 | @end defvar |
| 262 | 264 | ||
| 263 | @defun buffer-string | 265 | @defvar buffer-substring-filters |
| 264 | This function returns the contents of the entire accessible portion of | 266 | This variable is obsoleted by |
| 265 | the current buffer as a string. It is equivalent to | 267 | @code{filter-buffer-substring-functions}, but is still supported for |
| 266 | 268 | backward compatibility. Its value should should be a list of | |
| 267 | @example | 269 | functions which accept a single string argument and return another |
| 268 | (buffer-substring (point-min) (point-max)) | 270 | string. @code{filter-buffer-substring} passes the buffer substring to |
| 269 | @end example | 271 | the first function in this list, and the return value of each function |
| 270 | 272 | is passed to the next function. The return value of the last function | |
| 271 | @example | 273 | is passed to @code{filter-buffer-substring-functions}. |
| 272 | @group | 274 | @end defvar |
| 273 | ---------- Buffer: foo ---------- | ||
| 274 | This is the contents of buffer foo | ||
| 275 | |||
| 276 | ---------- Buffer: foo ---------- | ||
| 277 | |||
| 278 | (buffer-string) | ||
| 279 | @result{} "This is the contents of buffer foo\n" | ||
| 280 | @end group | ||
| 281 | @end example | ||
| 282 | @end defun | ||
| 283 | 275 | ||
| 284 | @defun current-word &optional strict really-word | 276 | @defun current-word &optional strict really-word |
| 285 | This function returns the symbol (or word) at or near point, as a string. | 277 | This function returns the symbol (or word) at or near point, as a |
| 286 | The return value includes no text properties. | 278 | string. The return value includes no text properties. |
| 287 | 279 | ||
| 288 | If the optional argument @var{really-word} is non-@code{nil}, it finds a | 280 | If the optional argument @var{really-word} is non-@code{nil}, it finds a |
| 289 | word; otherwise, it finds a symbol (which includes both word | 281 | word; otherwise, it finds a symbol (which includes both word |
| @@ -1112,13 +1104,11 @@ case, the first string is used as the ``most recent kill'', and all | |||
| 1112 | the other strings are pushed onto the kill ring, for easy access by | 1104 | the other strings are pushed onto the kill ring, for easy access by |
| 1113 | @code{yank-pop}. | 1105 | @code{yank-pop}. |
| 1114 | 1106 | ||
| 1115 | The normal use of this function is to get the window system's primary | 1107 | The normal use of this function is to get the window system's |
| 1116 | selection as the most recent kill, even if the selection belongs to | 1108 | clipboard as the most recent kill, even if the selection belongs to |
| 1117 | another application. @xref{Window System Selections}. However, if | 1109 | another application. @xref{Window System Selections}. However, if |
| 1118 | the selection was provided by the current Emacs session, this function | 1110 | the clipboard contents come from the current Emacs session, this |
| 1119 | should return @code{nil}. (If it is hard to tell whether Emacs or | 1111 | function should return @code{nil}. |
| 1120 | some other program provided the selection, it should be good enough to | ||
| 1121 | use @code{string=} to compare it with the last text Emacs provided.) | ||
| 1122 | @end defvar | 1112 | @end defvar |
| 1123 | 1113 | ||
| 1124 | @defvar interprogram-cut-function | 1114 | @defvar interprogram-cut-function |
| @@ -1129,9 +1119,8 @@ programs, when you are using a window system. Its value should be | |||
| 1129 | If the value is a function, @code{kill-new} and @code{kill-append} call | 1119 | If the value is a function, @code{kill-new} and @code{kill-append} call |
| 1130 | it with the new first element of the kill ring as the argument. | 1120 | it with the new first element of the kill ring as the argument. |
| 1131 | 1121 | ||
| 1132 | The normal use of this function is to set the window system's primary | 1122 | The normal use of this function is to put newly killed text in the |
| 1133 | selection from the newly killed text. | 1123 | window system's clipboard. @xref{Window System Selections}. |
| 1134 | @xref{Window System Selections}. | ||
| 1135 | @end defvar | 1124 | @end defvar |
| 1136 | 1125 | ||
| 1137 | @node Internals of Kill Ring | 1126 | @node Internals of Kill Ring |