diff options
| author | Miles Bader <miles@gnu.org> | 2006-04-17 08:41:12 +0000 |
|---|---|---|
| committer | Miles Bader <miles@gnu.org> | 2006-04-17 08:41:12 +0000 |
| commit | cfc2051d0ed5a268528a647ab0911a2f5cc451de (patch) | |
| tree | cb622fe0b6c1ba8b97314fb80ba2fd8fad60a5a2 /lisp/simple.el | |
| parent | ca49cf1703cc20d50653c32ca2f438c8819b78bd (diff) | |
| parent | e4a89ccf738861d7b9c4f611185aa0f204c9c208 (diff) | |
| download | emacs-cfc2051d0ed5a268528a647ab0911a2f5cc451de.tar.gz | |
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-56
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 204-225)
- Update from CVS
- Sync from erc--emacs--0
- Merge from gnus--rel--5.10
- Improve tq.el.
- Update from CVS: src/puresize.h (PURESIZE_RATIO): Reduce to 10/6.
* gnus--rel--5.10 (patch 81-85)
- Update from CVS
- Merge from emacs--devo--0
Diffstat (limited to 'lisp/simple.el')
| -rw-r--r-- | lisp/simple.el | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 108ca8b10bd..36b2d8b8f21 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2332,7 +2332,7 @@ return value of `filter-buffer-substring'. If this variable is nil, no filtering is performed.") -(defun filter-buffer-substring (beg end &optional delete) +(defun filter-buffer-substring (beg end &optional delete noprops) "Return the buffer substring between BEG and END, after filtering. The buffer substring is passed through each of the filter functions in `buffer-substring-filters', and the value from the @@ -2342,21 +2342,36 @@ is nil, the buffer substring is returned unaltered. If DELETE is non-nil, the text between BEG and END is deleted from the buffer. +If NOPROPS is non-nil, final string returned does not include +text properties, while the string passed to the filters still +includes text properties from the buffer text. + Point is temporarily set to BEG before calling `buffer-substring-filters', in case the functions need to know where the text came from. -This function should be used instead of `buffer-substring' or -`delete-and-extract-region' when you want to allow filtering to -take place. For example, major or minor modes can use -`buffer-substring-filters' to extract characters that are special -to a buffer, and should not be copied into other buffers." - (save-excursion - (goto-char beg) - (let ((string (if delete (delete-and-extract-region beg end) - (buffer-substring beg end)))) - (dolist (filter buffer-substring-filters string) - (setq string (funcall filter string)))))) +This function should be used instead of `buffer-substring', +`buffer-substring-no-properties', or `delete-and-extract-region' +when you want to allow filtering to take place. For example, +major or minor modes can use `buffer-substring-filters' to +extract characters that are special to a buffer, and should not +be copied into other buffers." + (cond + ((or delete buffer-substring-filters) + (save-excursion + (goto-char beg) + (let ((string (if delete (delete-and-extract-region beg end) + (buffer-substring beg end)))) + (dolist (filter buffer-substring-filters) + (setq string (funcall filter string))) + (if noprops + (set-text-properties 0 (length string) nil string)) + string))) + (noprops + (buffer-substring-no-properties beg end)) + (t + (buffer-substring beg end)))) + ;;;; Window system cut and paste hooks. @@ -3742,7 +3757,7 @@ If point reaches the beginning or end of buffer, it stops there. To ignore intangibility, bind `inhibit-point-motion-hooks' to t." (interactive "p") (or arg (setq arg 1)) - + (let ((orig (point))) ;; Move by lines, if ARG is not 1 (the default). |
