aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorJoakim Verona2012-03-07 09:41:43 +0100
committerJoakim Verona2012-03-07 09:41:43 +0100
commit1e3a41b29b5bd263cde651d9f23517c8a29155dc (patch)
tree521dbc7d21eff3acefe3e74e2585f49923924534 /doc
parent28485daaf752ff5264ed2f6a32ec15588beaa929 (diff)
parent3266b56f817e562638f0ab7ca36fe5e01a44f831 (diff)
downloademacs-1e3a41b29b5bd263cde651d9f23517c8a29155dc.tar.gz
emacs-1e3a41b29b5bd263cde651d9f23517c8a29155dc.zip
upstream
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/ChangeLog24
-rw-r--r--doc/lispref/markers.texi88
-rw-r--r--doc/lispref/text.texi75
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 @@
12012-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
82012-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
192012-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
12012-03-05 Chong Yidong <cyd@gnu.org> 252012-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
31marker can be used to represent a position in the functions that 31marker can be used to represent a position in functions that
32require one, just as an integer could be used. In that case, the 32require one, just as an integer could be used. In that case, the
33marker's buffer is normally ignored. Of course, a marker used in this 33marker's buffer is normally ignored. Of course, a marker used in this
34way usually points to a position in the buffer that the function 34way 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
39buffer, and the insertion type. The marker position is an integer 39buffer, and the insertion type. The marker position is an integer
40that is equivalent (at a given time) to the marker as a position in 40that is equivalent (at a given time) to the marker as a position in
41that buffer. But the marker's position value can change often during 41that buffer. But the marker's position value can change during
42the life of the marker. Insertion and deletion of text in the buffer 42the life of the marker, and often does. Insertion and deletion of
43relocate the marker. The idea is that a marker positioned between two 43text in the buffer relocate the marker. The idea is that a marker
44characters remains between those two characters despite insertion and 44positioned between two characters remains between those two characters
45deletion elsewhere in the buffer. Relocation changes the integer 45despite insertion and deletion elsewhere in the buffer. Relocation
46equivalent of the marker. 46changes 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}).
58relocate them if necessary. This slows processing in a buffer with a 58relocate them if necessary. This slows processing in a buffer with a
59large number of markers. For this reason, it is a good idea to make a 59large number of markers. For this reason, it is a good idea to make a
60marker point nowhere if you are sure you don't need it any more. 60marker point nowhere if you are sure you don't need it any more.
61Unreferenced markers are garbage collected eventually, but until then 61Markers that can no longer be accessed are eventually removed
62will 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
66position, most of the arithmetic operations (including @code{+} and 66position, 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
68stands for its current position. 68stands 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
422loop by setting the variable @code{deactivate-mark} to a 422loop by setting the variable @code{deactivate-mark} to a
423non-@code{nil} value. 423non-@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
426apply to text near point, apply instead to the region when the mark is 426normally apply to text near point, apply instead to the region when
427active. This is the main motivation for using Transient Mark mode. 427the mark is active. This is the main motivation for using Transient
428(Another is that this enables highlighting of the region when the mark 428Mark mode. (Another is that this enables highlighting of the region
429is active. @xref{Display}.) 429when 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
432list of markers containing previous values of the mark. When editing 432list of markers containing previous values of the mark. When editing
@@ -509,7 +509,8 @@ example:
509This function sets the current buffer's mark to @var{position}, and 509This function sets the current buffer's mark to @var{position}, and
510pushes a copy of the previous mark onto @code{mark-ring}. If 510pushes 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
514The function @code{push-mark} normally @emph{does not} activate the 515The function @code{push-mark} normally @emph{does not} activate the
515mark. To do that, specify @code{t} for the argument @var{activate}. 516mark. 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
523that mark become the buffer's actual mark. This does not move point in 524that mark become the buffer's actual mark. This does not move point in
524the buffer, and it does nothing if @code{mark-ring} is empty. It 525the buffer, and it does nothing if @code{mark-ring} is empty. It
525deactivates the mark. 526deactivates the mark.
526 527@c
527The 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
594These normal hooks are run, respectively, when the mark becomes active 596These normal hooks are run, respectively, when the mark becomes active
595and when it becomes inactive. The hook @code{activate-mark-hook} is 597and when it becomes inactive. The hook @code{activate-mark-hook} is
596also run at the end of a command if the mark is active and it is 598also run at the end of the command loop if the mark is active and it
597possible that the region may have changed. 599is possible that the region may have changed.
600@ignore
601This 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
660larger. 673larger.
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 677command designed to operate on a region should normally use
665should normally use @code{interactive} with the @samp{r} specification 678@code{interactive} with the @samp{r} specification to find the
666to find the beginning and end of the region. This lets other Lisp 679beginning and end of the region. This lets other Lisp programs
667programs specify the bounds explicitly as arguments. (@xref{Interactive 680specify the bounds explicitly as arguments. @xref{Interactive Codes}.
668Codes}.)
669 681
670@defun use-region-p 682@defun use-region-p
671This function returns @code{t} if Transient Mark mode is enabled, the 683This function returns @code{t} if Transient Mark mode is enabled, the
672mark is active, and there's a valid region in the buffer. Commands 684mark is active, and there is a valid region in the buffer. This
673that operate on the region (instead of on text near point) when 685function is intended to be used by commands that operate on the
674there's an active mark should use this to test whether to do that. 686region, instead of on text near point, when the mark is active.
687
688A 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
692cases, you should not use @code{region-active-p}, since if the region
693is 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
170This function returns a string containing a copy of the text of the 170This function returns a string containing a copy of the text of the
171region defined by positions @var{start} and @var{end} in the current 171region defined by positions @var{start} and @var{end} in the current
172buffer. If the arguments are not positions in the accessible portion of 172buffer. If the arguments are not positions in the accessible portion
173the buffer, @code{buffer-substring} signals an @code{args-out-of-range} 173of the buffer, @code{buffer-substring} signals an
174error. 174@code{args-out-of-range} error.
175
176It is not necessary for @var{start} to be less than @var{end}; the
177arguments can be given in either order. But most often the smaller
178argument is written first.
179 175
180Here's an example which assumes Font-Lock mode is not enabled: 176Here'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
218properties, just the characters themselves. @xref{Text Properties}. 214properties, just the characters themselves. @xref{Text Properties}.
219@end defun 215@end defun
220 216
217@defun buffer-string
218This function returns the contents of the entire accessible portion of
219the 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
222This function passes the buffer text between @var{start} and @var{end} 224This function passes the buffer text between @var{start} and @var{end}
223through the filter functions specified by the wrapper hook 225through 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
225result of applying all filters. The obsolete variable 227obsolete variable @code{buffer-substring-filters} is also consulted.
226@code{buffer-substring-filters} is also consulted. If both of these 228If both of these variables are @code{nil}, the value is the unaltered
227variables are @code{nil}, the value is the unaltered text from the 229text from the buffer, i.e.@: what @code{buffer-substring} would
228buffer, as @code{buffer-substring} would return. 230return.
229 231
230If @var{delete} is non-@code{nil}, this function deletes the text 232If @var{delete} is non-@code{nil}, this function deletes the text
231between @var{start} and @var{end} after copying it, like 233between @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
260hook functions acting in sequence. 262hook functions acting in sequence.
261@end defvar 263@end defvar
262 264
263@defun buffer-string 265@defvar buffer-substring-filters
264This function returns the contents of the entire accessible portion of 266This variable is obsoleted by
265the current buffer as a string. It is equivalent to 267@code{filter-buffer-substring-functions}, but is still supported for
266 268backward compatibility. Its value should should be a list of
267@example 269functions which accept a single string argument and return another
268(buffer-substring (point-min) (point-max)) 270string. @code{filter-buffer-substring} passes the buffer substring to
269@end example 271the first function in this list, and the return value of each function
270 272is passed to the next function. The return value of the last function
271@example 273is passed to @code{filter-buffer-substring-functions}.
272@group 274@end defvar
273---------- Buffer: foo ----------
274This 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
285This function returns the symbol (or word) at or near point, as a string. 277This function returns the symbol (or word) at or near point, as a
286The return value includes no text properties. 278string. The return value includes no text properties.
287 279
288If the optional argument @var{really-word} is non-@code{nil}, it finds a 280If the optional argument @var{really-word} is non-@code{nil}, it finds a
289word; otherwise, it finds a symbol (which includes both word 281word; 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
1112the other strings are pushed onto the kill ring, for easy access by 1104the other strings are pushed onto the kill ring, for easy access by
1113@code{yank-pop}. 1105@code{yank-pop}.
1114 1106
1115The normal use of this function is to get the window system's primary 1107The normal use of this function is to get the window system's
1116selection as the most recent kill, even if the selection belongs to 1108clipboard as the most recent kill, even if the selection belongs to
1117another application. @xref{Window System Selections}. However, if 1109another application. @xref{Window System Selections}. However, if
1118the selection was provided by the current Emacs session, this function 1110the clipboard contents come from the current Emacs session, this
1119should return @code{nil}. (If it is hard to tell whether Emacs or 1111function should return @code{nil}.
1120some other program provided the selection, it should be good enough to
1121use @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
1129If the value is a function, @code{kill-new} and @code{kill-append} call 1119If the value is a function, @code{kill-new} and @code{kill-append} call
1130it with the new first element of the kill ring as the argument. 1120it with the new first element of the kill ring as the argument.
1131 1121
1132The normal use of this function is to set the window system's primary 1122The normal use of this function is to put newly killed text in the
1133selection from the newly killed text. 1123window 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