diff options
| author | Stefan Kangas | 2022-07-08 14:46:20 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2022-07-09 11:47:52 +0200 |
| commit | ac7b90e323eb375d5ff48fb24df206dc6336e656 (patch) | |
| tree | d0757172ea73f5d73927cf053502deccd32420ab | |
| parent | 6caade631ef9b80f751ce94d14252c1fb802fce0 (diff) | |
| download | emacs-ac7b90e323eb375d5ff48fb24df206dc6336e656.tar.gz emacs-ac7b90e323eb375d5ff48fb24df206dc6336e656.zip | |
Delete obsolete variable buffer-substring-filters
* lisp/simple.el (buffer-substring-filters): Delete variable obsolete
since 24.1.
(buffer-substring--filter): Adjust for deleted variable.
* doc/lispref/text.texi (Buffer Contents): Adjust documentation
for deleted variable.
| -rw-r--r-- | doc/lispref/text.texi | 28 | ||||
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/simple.el | 22 |
3 files changed, 14 insertions, 41 deletions
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 0c04d01261b..ab46afc838b 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi | |||
| @@ -243,10 +243,8 @@ using a function specified by the variable | |||
| 243 | The default filter function consults the obsolete wrapper hook | 243 | The default filter function consults the obsolete wrapper hook |
| 244 | @code{filter-buffer-substring-functions} (see the documentation string | 244 | @code{filter-buffer-substring-functions} (see the documentation string |
| 245 | of the macro @code{with-wrapper-hook} for the details about this | 245 | of the macro @code{with-wrapper-hook} for the details about this |
| 246 | obsolete facility), and the obsolete variable | 246 | obsolete facility). If it is @code{nil}, it returns the unaltered |
| 247 | @code{buffer-substring-filters}. If both of these are @code{nil}, it | 247 | text from the buffer, i.e., what @code{buffer-substring} would return. |
| 248 | returns the unaltered text from the buffer, i.e., what | ||
| 249 | @code{buffer-substring} would return. | ||
| 250 | 248 | ||
| 251 | If @var{delete} is non-@code{nil}, the function deletes the text | 249 | If @var{delete} is non-@code{nil}, the function deletes the text |
| 252 | between @var{start} and @var{end} after copying it, like | 250 | between @var{start} and @var{end} after copying it, like |
| @@ -282,22 +280,12 @@ the same as those of @code{filter-buffer-substring}. | |||
| 282 | 280 | ||
| 283 | The first hook function is passed a @var{fun} that is equivalent to | 281 | The first hook function is passed a @var{fun} that is equivalent to |
| 284 | the default operation of @code{filter-buffer-substring}, i.e., it | 282 | the default operation of @code{filter-buffer-substring}, i.e., it |
| 285 | returns the buffer-substring between @var{start} and @var{end} | 283 | returns the buffer-substring between @var{start} and @var{end} and |
| 286 | (processed by any @code{buffer-substring-filters}) and optionally | 284 | optionally deletes the original text from the buffer. In most cases, |
| 287 | deletes the original text from the buffer. In most cases, the hook | 285 | the hook function will call @var{fun} once, and then do its own |
| 288 | function will call @var{fun} once, and then do its own processing of | 286 | processing of the result. The next hook function receives a @var{fun} |
| 289 | the result. The next hook function receives a @var{fun} equivalent to | 287 | equivalent to this, and so on. The actual return value is the result |
| 290 | this, and so on. The actual return value is the result of all the | 288 | of all the hook functions acting in sequence. |
| 291 | hook functions acting in sequence. | ||
| 292 | @end defvar | ||
| 293 | |||
| 294 | @defvar buffer-substring-filters | ||
| 295 | The value of this obsolete variable should be a list of functions | ||
| 296 | that accept a single string argument and return another string. | ||
| 297 | The default @code{filter-buffer-substring} function passes the buffer | ||
| 298 | substring to the first function in this list, and the return value of | ||
| 299 | each function is passed to the next function. The return value of the | ||
| 300 | last function is passed to @code{filter-buffer-substring-functions}. | ||
| 301 | @end defvar | 289 | @end defvar |
| 302 | 290 | ||
| 303 | @defun current-word &optional strict really-word | 291 | @defun current-word &optional strict really-word |
| @@ -2261,8 +2261,9 @@ This change is now applied in 'dired-insert-directory'. | |||
| 2261 | 'allout-mode-deactivate-hook', 'ansi-color-unfontify-region', | 2261 | 'allout-mode-deactivate-hook', 'ansi-color-unfontify-region', |
| 2262 | 'auth-source-forget-user-or-password', 'auth-source-hide-passwords', | 2262 | 'auth-source-forget-user-or-password', 'auth-source-hide-passwords', |
| 2263 | 'auth-source-user-or-password', 'bibtex-complete', | 2263 | 'auth-source-user-or-password', 'bibtex-complete', |
| 2264 | 'bibtex-entry-field-alist', 'byte-compile-disable-print-circle', | 2264 | 'bibtex-entry-field-alist', 'buffer-substring-filters', |
| 2265 | 'cfengine-mode-abbrevs', 'chart-map', 'comint-dynamic-complete', | 2265 | 'byte-compile-disable-print-circle', 'cfengine-mode-abbrevs', |
| 2266 | 'chart-map', 'comint-dynamic-complete', | ||
| 2266 | 'comint-dynamic-complete-as-filename', | 2267 | 'comint-dynamic-complete-as-filename', |
| 2267 | 'comint-dynamic-simple-complete', 'command-history-map', | 2268 | 'comint-dynamic-simple-complete', 'command-history-map', |
| 2268 | 'completion-annotate-function', 'condition-case-no-debug', | 2269 | 'completion-annotate-function', 'condition-case-no-debug', |
diff --git a/lisp/simple.el b/lisp/simple.el index 1d251dbf5e6..caba924f6a5 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -5352,17 +5352,6 @@ that `filter-buffer-substring' received. It should return the | |||
| 5352 | buffer substring between BEG and END, after filtering. If DELETE is | 5352 | buffer substring between BEG and END, after filtering. If DELETE is |
| 5353 | non-nil, it should delete the text between BEG and END from the buffer.") | 5353 | non-nil, it should delete the text between BEG and END from the buffer.") |
| 5354 | 5354 | ||
| 5355 | (defvar buffer-substring-filters nil | ||
| 5356 | "List of filter functions for `buffer-substring--filter'. | ||
| 5357 | Each function must accept a single argument, a string, and return a string. | ||
| 5358 | The buffer substring is passed to the first function in the list, | ||
| 5359 | and the return value of each function is passed to the next. | ||
| 5360 | As a special convention, point is set to the start of the buffer text | ||
| 5361 | being operated on (i.e., the first argument of `buffer-substring--filter') | ||
| 5362 | before these functions are called.") | ||
| 5363 | (make-obsolete-variable 'buffer-substring-filters | ||
| 5364 | 'filter-buffer-substring-function "24.1") | ||
| 5365 | |||
| 5366 | (defun filter-buffer-substring (beg end &optional delete) | 5355 | (defun filter-buffer-substring (beg end &optional delete) |
| 5367 | "Return the buffer substring between BEG and END, after filtering. | 5356 | "Return the buffer substring between BEG and END, after filtering. |
| 5368 | If DELETE is non-nil, delete the text between BEG and END from the buffer. | 5357 | If DELETE is non-nil, delete the text between BEG and END from the buffer. |
| @@ -5383,20 +5372,15 @@ that are special to a buffer, and should not be copied into other buffers." | |||
| 5383 | "Default function to use for `filter-buffer-substring-function'. | 5372 | "Default function to use for `filter-buffer-substring-function'. |
| 5384 | Its arguments and return value are as specified for `filter-buffer-substring'. | 5373 | Its arguments and return value are as specified for `filter-buffer-substring'. |
| 5385 | Also respects the obsolete wrapper hook `filter-buffer-substring-functions' | 5374 | Also respects the obsolete wrapper hook `filter-buffer-substring-functions' |
| 5386 | \(see `with-wrapper-hook' for details about wrapper hooks), | 5375 | (see `with-wrapper-hook' for details about wrapper hooks). |
| 5387 | and the abnormal hook `buffer-substring-filters'. | ||
| 5388 | No filtering is done unless a hook says to." | 5376 | No filtering is done unless a hook says to." |
| 5389 | (subr--with-wrapper-hook-no-warnings | 5377 | (subr--with-wrapper-hook-no-warnings |
| 5390 | filter-buffer-substring-functions (beg end delete) | 5378 | filter-buffer-substring-functions (beg end delete) |
| 5391 | (cond | 5379 | (cond |
| 5392 | ((or delete buffer-substring-filters) | 5380 | (delete |
| 5393 | (save-excursion | 5381 | (save-excursion |
| 5394 | (goto-char beg) | 5382 | (goto-char beg) |
| 5395 | (let ((string (if delete (delete-and-extract-region beg end) | 5383 | (delete-and-extract-region beg end))) |
| 5396 | (buffer-substring beg end)))) | ||
| 5397 | (dolist (filter buffer-substring-filters) | ||
| 5398 | (setq string (funcall filter string))) | ||
| 5399 | string))) | ||
| 5400 | (t | 5384 | (t |
| 5401 | (buffer-substring beg end))))) | 5385 | (buffer-substring beg end))))) |
| 5402 | 5386 | ||