diff options
| author | Richard M. Stallman | 2005-03-29 21:08:37 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-03-29 21:08:37 +0000 |
| commit | 8e669bbd42c254c32e3fffa489f4d97d48d9bd76 (patch) | |
| tree | 5a8048440a13b38a921565b3458f66d420cd583f | |
| parent | 19e7dd23ed5859155f955ff327bba9bfc4cf58de (diff) | |
| download | emacs-8e669bbd42c254c32e3fffa489f4d97d48d9bd76.tar.gz emacs-8e669bbd42c254c32e3fffa489f4d97d48d9bd76.zip | |
(Buffer Contents): Add filter-buffer-substring and buffer-substring-filters.
| -rw-r--r-- | etc/NEWS | 22 | ||||
| -rw-r--r-- | lisp/ChangeLog | 15 | ||||
| -rw-r--r-- | lispref/ChangeLog | 5 | ||||
| -rw-r--r-- | lispref/text.texi | 35 | ||||
| -rw-r--r-- | man/ChangeLog | 7 |
5 files changed, 84 insertions, 0 deletions
| @@ -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 | ||
| 2440 | files composed of long lines, based on the `use-hard-newlines' | ||
| 2441 | mechanism. The long lines are broken up by inserting soft newlines, | ||
| 2442 | which are automatically removed when saving the file to disk or | ||
| 2443 | copying into the kill ring, clipboard, etc. By default, Longlines | ||
| 2444 | mode inserts soft newlines automatically during editing, a behavior | ||
| 2445 | referred to as "soft word wrap" in other text editors. This is | ||
| 2446 | similar to Refill mode, but more reliable. To turn the word wrap | ||
| 2447 | feature 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 |
| 2440 | varying syntaxes for comments (;, #, //, /* */ or !), assignment (var = value, | 2451 | varying syntaxes for comments (;, #, //, /* */ or !), assignment (var = value, |
| 2441 | var : value, var value or keyword var value) and sections ([section] or | 2452 | var : 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 | ||
| 2727 | substring, passes it through a set of filter functions, and returns | ||
| 2728 | the filtered substring. It is used instead of `buffer-substring' or | ||
| 2729 | `delete-and-extract-region' when copying text into a user-accessible | ||
| 2730 | data structure, like the kill-ring, X clipboard, or a register. The | ||
| 2731 | list 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 | ||
| 2734 | text. | ||
| 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 |
| 2717 | for a high-level change that should be undone by evaluating (apply | 2739 | for 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 @@ | |||
| 1 | 2005-03-29 Richard M. Stallman <rms@gnu.org> | ||
| 2 | |||
| 3 | * simple.el (idle-update-delay): Move definition up. | ||
| 4 | |||
| 5 | 2005-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 | |||
| 1 | 2005-03-30 Nick Roberts <nickrob@snap.net.nz> | 16 | 2005-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 @@ | |||
| 1 | 2005-03-29 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * text.texi (Buffer Contents): Add filter-buffer-substring and | ||
| 4 | buffer-substring-filters. | ||
| 5 | |||
| 1 | 2005-03-26 Chong Yidong <cyd@stupidchicken.com> | 6 | 2005-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 | |||
| 207 | properties, just the characters themselves. @xref{Text Properties}. | 207 | properties, just the characters themselves. @xref{Text Properties}. |
| 208 | @end defun | 208 | @end defun |
| 209 | 209 | ||
| 210 | @defun filter-buffer-substring start end &optional delete | ||
| 211 | This function passes the buffer text between @var{start} and @var{end} | ||
| 212 | through the filter functions specified by the variable | ||
| 213 | @code{buffer-substring-filters}, and returns the value from the last | ||
| 214 | filter function. If @code{buffer-substring-filters} is @code{nil}, | ||
| 215 | the value is the unaltered text from the buffer, what | ||
| 216 | @code{buffer-substring} would return. | ||
| 217 | |||
| 218 | If @var{delete} is non-@code{nil}, this function deletes the text | ||
| 219 | between @var{start} and @var{end} after copying it, like | ||
| 220 | @code{delete-and-extract-region}. | ||
| 221 | |||
| 222 | Lisp code should use this function instead of @code{buffer-substring} | ||
| 223 | or @code{delete-and-extract-region} when copying into user-accessible | ||
| 224 | data structures such as the kill-ring, X clipboard, and registers. | ||
| 225 | Major and minor modes can add functions to | ||
| 226 | @code{buffer-substring-filters} to alter such text as it is copied out | ||
| 227 | of the buffer. | ||
| 228 | @end defun | ||
| 229 | |||
| 230 | @defvar buffer-substring-filters | ||
| 231 | This variable should be a list of functions that accept a single | ||
| 232 | argument, a string, and return a string. | ||
| 233 | @code{filter-buffer-substring} passes the buffer substring to the | ||
| 234 | first function in this list, and the return value of each function is | ||
| 235 | passed to the next function. The return value of the last function is | ||
| 236 | used as the return value of @code{filter-buffer-substring}. | ||
| 237 | |||
| 238 | As a special convention, point is set to the start of the buffer text | ||
| 239 | being operated on (i.e., the @var{start} argument for | ||
| 240 | @code{filter-buffer-substring}) before these functions are called. | ||
| 241 | |||
| 242 | If this variable is @code{nil}, no filtering is performed. | ||
| 243 | @end defvar | ||
| 244 | |||
| 210 | @defun buffer-string | 245 | @defun buffer-string |
| 211 | This function returns the contents of the entire accessible portion of | 246 | This function returns the contents of the entire accessible portion of |
| 212 | the current buffer as a string. It is equivalent to | 247 | the 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 @@ | |||
| 1 | 2005-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 | |||
| 1 | 2005-03-29 Richard M. Stallman <rms@gnu.org> | 8 | 2005-03-29 Richard M. Stallman <rms@gnu.org> |
| 2 | 9 | ||
| 3 | * xresources.texi: Minor fixes. | 10 | * xresources.texi: Minor fixes. |