Commit 8e669bbd authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(Buffer Contents): Add filter-buffer-substring and buffer-substring-filters.

parent 19e7dd23
......@@ -2435,6 +2435,17 @@ coding system.
* New modes and packages in Emacs 22.1
 
+++
** The new package longlines.el provides a minor mode for editing text
files composed of long lines, based on the `use-hard-newlines'
mechanism. The long lines are broken up by inserting soft newlines,
which are automatically removed when saving the file to disk or
copying into the kill ring, clipboard, etc. By default, Longlines
mode inserts soft newlines automatically during editing, a behavior
referred to as "soft word wrap" in other text editors. This is
similar to Refill mode, but more reliable. To turn the word wrap
feature off, set `longlines-auto-wrap' to nil.
+++
** The new package conf-mode.el handles thousands of configuration files, with
varying syntaxes for comments (;, #, //, /* */ or !), assignment (var = value,
......@@ -2711,6 +2722,17 @@ the command `undefined'. (In earlier Emacs versions, it used
* Lisp Changes in Emacs 22.1
 
+++
** The new function `filter-buffer-substring' extracts a buffer
substring, passes it through a set of filter functions, and returns
the filtered substring. It is used instead of `buffer-substring' or
`delete-and-extract-region' when copying text into a user-accessible
data structure, like the kill-ring, X clipboard, or a register. The
list of filter function is specified by the new variable
`buffer-substring-filters'. For example, Longlines mode uses
`buffer-substring-filters' to remove soft newlines from the copied
text.
+++
** An element of buffer-undo-list can now have the form (apply FUNNAME
. ARGS), where FUNNAME is a symbol other than t or nil. That stands
......
2005-03-29 Richard M. Stallman <rms@gnu.org>
* simple.el (idle-update-delay): Move definition up.
2005-03-29 Chong Yidong <cyd@stupidchicken.com>
* longlines.el: New file.
* simple.el (buffer-substring-filters): New variable.
(filter-buffer-substring): New function.
(kill-region, copy-region-as-kill): Use it.
* register.el (copy-to-register, append-to-register)
(prepend-to-register): Use filter-buffer-substring.
2005-03-30 Nick Roberts <nickrob@snap.net.nz>
 
* progmodes/gud.el (gdb): (Re)-initialise gud-filter-pending-text.
......
2005-03-29 Chong Yidong <cyd@stupidchicken.com>
* text.texi (Buffer Contents): Add filter-buffer-substring and
buffer-substring-filters.
2005-03-26 Chong Yidong <cyd@stupidchicken.com>
* anti.texi (Antinews): Mention `G' interactive code.
......
......@@ -207,6 +207,41 @@ This is like @code{buffer-substring}, except that it does not copy text
properties, just the characters themselves. @xref{Text Properties}.
@end defun
@defun filter-buffer-substring start end &optional delete
This function passes the buffer text between @var{start} and @var{end}
through the filter functions specified by the variable
@code{buffer-substring-filters}, and returns the value from the last
filter function. If @code{buffer-substring-filters} is @code{nil},
the value is the unaltered text from the buffer, what
@code{buffer-substring} would return.
If @var{delete} is non-@code{nil}, this function deletes the text
between @var{start} and @var{end} after copying it, like
@code{delete-and-extract-region}.
Lisp code should use this function instead of @code{buffer-substring}
or @code{delete-and-extract-region} when copying into user-accessible
data structures such as the kill-ring, X clipboard, and registers.
Major and minor modes can add functions to
@code{buffer-substring-filters} to alter such text as it is copied out
of the buffer.
@end defun
@defvar buffer-substring-filters
This variable should be a list of functions that accept a single
argument, a string, and return a string.
@code{filter-buffer-substring} passes the buffer substring to the
first function in this list, and the return value of each function is
passed to the next function. The return value of the last function is
used as the return value of @code{filter-buffer-substring}.
As a special convention, point is set to the start of the buffer text
being operated on (i.e., the @var{start} argument for
@code{filter-buffer-substring}) before these functions are called.
If this variable is @code{nil}, no filtering is performed.
@end defvar
@defun buffer-string
This function returns the contents of the entire accessible portion of
the current buffer as a string. It is equivalent to
......
2005-03-29 Chong Yidong <cyd@stupidchicken.com>
* text.texi (Refill): Refer to Long Lines Mode.
(Longlines): New node.
(Auto Fill): Don't index "word wrap" here.
(Filling): Add Longlines to menu.
2005-03-29 Richard M. Stallman <rms@gnu.org>
* xresources.texi: Minor fixes.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment