diff options
| author | Glenn Morris | 2012-02-04 11:48:06 -0800 |
|---|---|---|
| committer | Glenn Morris | 2012-02-04 11:48:06 -0800 |
| commit | 34c999980444dc3aea494fbf87d71d858fbc3f0f (patch) | |
| tree | b9a4a056c0cc3f5137e464e208a5a44a66ab8c90 /lisp | |
| parent | 79c1cc1e971d0f8766e62d60f459d5253b913f05 (diff) | |
| download | emacs-34c999980444dc3aea494fbf87d71d858fbc3f0f.tar.gz emacs-34c999980444dc3aea494fbf87d71d858fbc3f0f.zip | |
Try to document filter-buffer-substring changes
* doc/lispref/text.texi (Buffer Contents):
Update filter-buffer-substring description.
* lisp/simple.el (filter-buffer-substring-functions)
(buffer-substring-filters, filter-buffer-substring): Doc fixes.
* etc/NEWS: Related edits.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/simple.el | 38 |
2 files changed, 33 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 888b7e20307..89ce0f67408 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-02-04 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * simple.el (filter-buffer-substring-functions) | ||
| 4 | (buffer-substring-filters, filter-buffer-substring): Doc fixes. | ||
| 5 | |||
| 1 | 2012-02-04 Lars Ljung <lars@matholka.se> (tiny change) | 6 | 2012-02-04 Lars Ljung <lars@matholka.se> (tiny change) |
| 2 | 7 | ||
| 3 | * eshell/esh-ext.el (eshell-windows-shell-file): Match "cmdproxy" | 8 | * eshell/esh-ext.el (eshell-windows-shell-file): Match "cmdproxy" |
diff --git a/lisp/simple.el b/lisp/simple.el index cc56dfe04ce..8bd32a8db8d 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -2914,28 +2914,46 @@ These commands include \\[set-mark-command] and \\[start-kbd-macro]." | |||
| 2914 | 2914 | ||
| 2915 | 2915 | ||
| 2916 | (defvar filter-buffer-substring-functions nil | 2916 | (defvar filter-buffer-substring-functions nil |
| 2917 | "Wrapper hook around `filter-buffer-substring'. | 2917 | "This variable is a wrapper hook around `filter-buffer-substring'. |
| 2918 | The functions on this special hook are called with four arguments: | 2918 | Each member of the hook should be a function accepting four arguments: |
| 2919 | NEXT-FUN BEG END DELETE | 2919 | \(FUN BEG END DELETE), where FUN is itself a function of three arguments |
| 2920 | NEXT-FUN is a function of three arguments (BEG END DELETE) | 2920 | \(BEG END DELETE). The arguments BEG, END, and DELETE are the same |
| 2921 | that performs the default operation. The other three arguments | 2921 | as those of `filter-buffer-substring' in each case. |
| 2922 | are like the ones passed to `filter-buffer-substring'.") | 2922 | |
| 2923 | The first hook function to be called receives a FUN equivalent | ||
| 2924 | to the default operation of `filter-buffer-substring', | ||
| 2925 | i.e. one that returns the buffer-substring between BEG and | ||
| 2926 | END (processed by any `buffer-substring-filters'). Normally, | ||
| 2927 | the hook function will call FUN and then do its own processing | ||
| 2928 | of the result. The next hook function receives a FUN equivalent | ||
| 2929 | to the previous hook function, calls it, and does its own | ||
| 2930 | processing, and so on. The overall result is that of all hook | ||
| 2931 | functions acting in sequence. | ||
| 2932 | |||
| 2933 | Any hook may choose not to call FUN though, in which case it | ||
| 2934 | effectively replaces the default behavior with whatever it chooses. | ||
| 2935 | Of course, a later hook function may do the same thing.") | ||
| 2923 | 2936 | ||
| 2924 | (defvar buffer-substring-filters nil | 2937 | (defvar buffer-substring-filters nil |
| 2925 | "List of filter functions for `filter-buffer-substring'. | 2938 | "List of filter functions for `filter-buffer-substring'. |
| 2926 | Each function must accept a single argument, a string, and return | 2939 | Each function must accept a single argument, a string, and return |
| 2927 | a string. The buffer substring is passed to the first function | 2940 | a string. The buffer substring is passed to the first function |
| 2928 | in the list, and the return value of each function is passed to | 2941 | in the list, and the return value of each function is passed to |
| 2929 | the next. The return value of the last function is used as the | 2942 | the next. The final result (if `buffer-substring-filters' is |
| 2930 | return value of `filter-buffer-substring'. | 2943 | nil, this is the unfiltered buffer-substring) is passed to the |
| 2944 | first function on `filter-buffer-substring-functions'. | ||
| 2931 | 2945 | ||
| 2932 | If this variable is nil, no filtering is performed.") | 2946 | As a special convention, point is set to the start of the buffer text |
| 2947 | being operated on (i.e., the first argument of `filter-buffer-substring') | ||
| 2948 | before these functions are called.") | ||
| 2933 | (make-obsolete-variable 'buffer-substring-filters | 2949 | (make-obsolete-variable 'buffer-substring-filters |
| 2934 | 'filter-buffer-substring-functions "24.1") | 2950 | 'filter-buffer-substring-functions "24.1") |
| 2935 | 2951 | ||
| 2936 | (defun filter-buffer-substring (beg end &optional delete) | 2952 | (defun filter-buffer-substring (beg end &optional delete) |
| 2937 | "Return the buffer substring between BEG and END, after filtering. | 2953 | "Return the buffer substring between BEG and END, after filtering. |
| 2938 | The filtering is performed by `filter-buffer-substring-functions'. | 2954 | The wrapper hook `filter-buffer-substring-functions' performs |
| 2955 | the actual filtering. The obsolete variable `buffer-substring-filters' | ||
| 2956 | is also consulted. If both of these are nil, no filtering is done. | ||
| 2939 | 2957 | ||
| 2940 | If DELETE is non-nil, the text between BEG and END is deleted | 2958 | If DELETE is non-nil, the text between BEG and END is deleted |
| 2941 | from the buffer. | 2959 | from the buffer. |