aboutsummaryrefslogtreecommitdiffstats
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
parent19e7dd23ed5859155f955ff327bba9bfc4cf58de (diff)
downloademacs-8e669bbd42c254c32e3fffa489f4d97d48d9bd76.tar.gz
emacs-8e669bbd42c254c32e3fffa489f4d97d48d9bd76.zip
(Buffer Contents): Add filter-buffer-substring and buffer-substring-filters.
-rw-r--r--etc/NEWS22
-rw-r--r--lisp/ChangeLog15
-rw-r--r--lispref/ChangeLog5
-rw-r--r--lispref/text.texi35
-rw-r--r--man/ChangeLog7
5 files changed, 84 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index c3134d08880..8e85c86dde8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2436,6 +2436,17 @@ coding system.
2436* New modes and packages in Emacs 22.1 2436* New modes and packages in Emacs 22.1
2437 2437
2438+++ 2438+++
2439** The new package longlines.el provides a minor mode for editing text
2440files composed of long lines, based on the `use-hard-newlines'
2441mechanism. The long lines are broken up by inserting soft newlines,
2442which are automatically removed when saving the file to disk or
2443copying into the kill ring, clipboard, etc. By default, Longlines
2444mode inserts soft newlines automatically during editing, a behavior
2445referred to as "soft word wrap" in other text editors. This is
2446similar to Refill mode, but more reliable. To turn the word wrap
2447feature off, set `longlines-auto-wrap' to nil.
2448
2449+++
2439** The new package conf-mode.el handles thousands of configuration files, with 2450** The new package conf-mode.el handles thousands of configuration files, with
2440varying syntaxes for comments (;, #, //, /* */ or !), assignment (var = value, 2451varying syntaxes for comments (;, #, //, /* */ or !), assignment (var = value,
2441var : value, var value or keyword var value) and sections ([section] or 2452var : value, var value or keyword var value) and sections ([section] or
@@ -2712,6 +2723,17 @@ the command `undefined'. (In earlier Emacs versions, it used
2712* Lisp Changes in Emacs 22.1 2723* Lisp Changes in Emacs 22.1
2713 2724
2714+++ 2725+++
2726** The new function `filter-buffer-substring' extracts a buffer
2727substring, passes it through a set of filter functions, and returns
2728the filtered substring. It is used instead of `buffer-substring' or
2729`delete-and-extract-region' when copying text into a user-accessible
2730data structure, like the kill-ring, X clipboard, or a register. The
2731list of filter function is specified by the new variable
2732`buffer-substring-filters'. For example, Longlines mode uses
2733`buffer-substring-filters' to remove soft newlines from the copied
2734text.
2735
2736+++
2715** An element of buffer-undo-list can now have the form (apply FUNNAME 2737** An element of buffer-undo-list can now have the form (apply FUNNAME
2716. ARGS), where FUNNAME is a symbol other than t or nil. That stands 2738. ARGS), where FUNNAME is a symbol other than t or nil. That stands
2717for a high-level change that should be undone by evaluating (apply 2739for a high-level change that should be undone by evaluating (apply
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e2cdac00334..2ff35b7344d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,18 @@
12005-03-29 Richard M. Stallman <rms@gnu.org>
2
3 * simple.el (idle-update-delay): Move definition up.
4
52005-03-29 Chong Yidong <cyd@stupidchicken.com>
6
7 * longlines.el: New file.
8
9 * simple.el (buffer-substring-filters): New variable.
10 (filter-buffer-substring): New function.
11 (kill-region, copy-region-as-kill): Use it.
12
13 * register.el (copy-to-register, append-to-register)
14 (prepend-to-register): Use filter-buffer-substring.
15
12005-03-30 Nick Roberts <nickrob@snap.net.nz> 162005-03-30 Nick Roberts <nickrob@snap.net.nz>
2 17
3 * progmodes/gud.el (gdb): (Re)-initialise gud-filter-pending-text. 18 * progmodes/gud.el (gdb): (Re)-initialise gud-filter-pending-text.
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
diff --git a/man/ChangeLog b/man/ChangeLog
index ec6fbbdcced..c67256c5ec9 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,10 @@
12005-03-29 Chong Yidong <cyd@stupidchicken.com>
2
3 * text.texi (Refill): Refer to Long Lines Mode.
4 (Longlines): New node.
5 (Auto Fill): Don't index "word wrap" here.
6 (Filling): Add Longlines to menu.
7
12005-03-29 Richard M. Stallman <rms@gnu.org> 82005-03-29 Richard M. Stallman <rms@gnu.org>
2 9
3 * xresources.texi: Minor fixes. 10 * xresources.texi: Minor fixes.