aboutsummaryrefslogtreecommitdiffstats
path: root/lispref
diff options
context:
space:
mode:
authorRichard M. Stallman2005-03-29 21:08:37 +0000
committerRichard M. Stallman2005-03-29 21:08:37 +0000
commit8e669bbd42c254c32e3fffa489f4d97d48d9bd76 (patch)
tree5a8048440a13b38a921565b3458f66d420cd583f /lispref
parent19e7dd23ed5859155f955ff327bba9bfc4cf58de (diff)
downloademacs-8e669bbd42c254c32e3fffa489f4d97d48d9bd76.tar.gz
emacs-8e669bbd42c254c32e3fffa489f4d97d48d9bd76.zip
(Buffer Contents): Add filter-buffer-substring and buffer-substring-filters.
Diffstat (limited to 'lispref')
-rw-r--r--lispref/ChangeLog5
-rw-r--r--lispref/text.texi35
2 files changed, 40 insertions, 0 deletions
diff --git a/lispref/ChangeLog b/lispref/ChangeLog
index 232e992e658..7f22ad2e485 100644
--- a/lispref/ChangeLog
+++ b/lispref/ChangeLog
@@ -1,3 +1,8 @@
12005-03-29 Chong Yidong <cyd@stupidchicken.com>
2
3 * text.texi (Buffer Contents): Add filter-buffer-substring and
4 buffer-substring-filters.
5
12005-03-26 Chong Yidong <cyd@stupidchicken.com> 62005-03-26 Chong Yidong <cyd@stupidchicken.com>
2 7
3 * anti.texi (Antinews): Mention `G' interactive code. 8 * anti.texi (Antinews): Mention `G' interactive code.
diff --git a/lispref/text.texi b/lispref/text.texi
index e300b345454..1d4dc0fce8a 100644
--- a/lispref/text.texi
+++ b/lispref/text.texi
@@ -207,6 +207,41 @@ This is like @code{buffer-substring}, except that it does not copy text
207properties, just the characters themselves. @xref{Text Properties}. 207properties, just the characters themselves. @xref{Text Properties}.
208@end defun 208@end defun
209 209
210@defun filter-buffer-substring start end &optional delete
211This function passes the buffer text between @var{start} and @var{end}
212through the filter functions specified by the variable
213@code{buffer-substring-filters}, and returns the value from the last
214filter function. If @code{buffer-substring-filters} is @code{nil},
215the value is the unaltered text from the buffer, what
216@code{buffer-substring} would return.
217
218If @var{delete} is non-@code{nil}, this function deletes the text
219between @var{start} and @var{end} after copying it, like
220@code{delete-and-extract-region}.
221
222Lisp code should use this function instead of @code{buffer-substring}
223or @code{delete-and-extract-region} when copying into user-accessible
224data structures such as the kill-ring, X clipboard, and registers.
225Major and minor modes can add functions to
226@code{buffer-substring-filters} to alter such text as it is copied out
227of the buffer.
228@end defun
229
230@defvar buffer-substring-filters
231This variable should be a list of functions that accept a single
232argument, a string, and return a string.
233@code{filter-buffer-substring} passes the buffer substring to the
234first function in this list, and the return value of each function is
235passed to the next function. The return value of the last function is
236used as the return value of @code{filter-buffer-substring}.
237
238As a special convention, point is set to the start of the buffer text
239being operated on (i.e., the @var{start} argument for
240@code{filter-buffer-substring}) before these functions are called.
241
242If this variable is @code{nil}, no filtering is performed.
243@end defvar
244
210@defun buffer-string 245@defun buffer-string
211This function returns the contents of the entire accessible portion of 246This function returns the contents of the entire accessible portion of
212the current buffer as a string. It is equivalent to 247the current buffer as a string. It is equivalent to