From: Stefan Kangas Date: Fri, 8 Jul 2022 12:46:20 +0000 (+0200) Subject: Delete obsolete variable buffer-substring-filters X-Git-Tag: emacs-29.0.90~1447^2~1076 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ac7b90e323eb375d5ff48fb24df206dc6336e656;p=emacs.git 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. --- 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 The default filter function consults the obsolete wrapper hook @code{filter-buffer-substring-functions} (see the documentation string of the macro @code{with-wrapper-hook} for the details about this -obsolete facility), and the obsolete variable -@code{buffer-substring-filters}. If both of these are @code{nil}, it -returns the unaltered text from the buffer, i.e., what -@code{buffer-substring} would return. +obsolete facility). If it is @code{nil}, it returns the unaltered +text from the buffer, i.e., what @code{buffer-substring} would return. If @var{delete} is non-@code{nil}, the function deletes the text between @var{start} and @var{end} after copying it, like @@ -282,22 +280,12 @@ the same as those of @code{filter-buffer-substring}. The first hook function is passed a @var{fun} that is equivalent to the default operation of @code{filter-buffer-substring}, i.e., it -returns the buffer-substring between @var{start} and @var{end} -(processed by any @code{buffer-substring-filters}) and optionally -deletes the original text from the buffer. In most cases, the hook -function will call @var{fun} once, and then do its own processing of -the result. The next hook function receives a @var{fun} equivalent to -this, and so on. The actual return value is the result of all the -hook functions acting in sequence. -@end defvar - -@defvar buffer-substring-filters -The value of this obsolete variable should be a list of functions -that accept a single string argument and return another string. -The default @code{filter-buffer-substring} function 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 passed to @code{filter-buffer-substring-functions}. +returns the buffer-substring between @var{start} and @var{end} and +optionally deletes the original text from the buffer. In most cases, +the hook function will call @var{fun} once, and then do its own +processing of the result. The next hook function receives a @var{fun} +equivalent to this, and so on. The actual return value is the result +of all the hook functions acting in sequence. @end defvar @defun current-word &optional strict really-word diff --git a/etc/NEWS b/etc/NEWS index 5831bbefd4a..8c9a05775f2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2261,8 +2261,9 @@ This change is now applied in 'dired-insert-directory'. 'allout-mode-deactivate-hook', 'ansi-color-unfontify-region', 'auth-source-forget-user-or-password', 'auth-source-hide-passwords', 'auth-source-user-or-password', 'bibtex-complete', -'bibtex-entry-field-alist', 'byte-compile-disable-print-circle', -'cfengine-mode-abbrevs', 'chart-map', 'comint-dynamic-complete', +'bibtex-entry-field-alist', 'buffer-substring-filters', +'byte-compile-disable-print-circle', 'cfengine-mode-abbrevs', +'chart-map', 'comint-dynamic-complete', 'comint-dynamic-complete-as-filename', 'comint-dynamic-simple-complete', 'command-history-map', '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 buffer substring between BEG and END, after filtering. If DELETE is non-nil, it should delete the text between BEG and END from the buffer.") -(defvar buffer-substring-filters nil - "List of filter functions for `buffer-substring--filter'. -Each function must accept a single argument, a string, and return a string. -The buffer substring is passed to the first function in the list, -and the return value of each function is passed to the next. -As a special convention, point is set to the start of the buffer text -being operated on (i.e., the first argument of `buffer-substring--filter') -before these functions are called.") -(make-obsolete-variable 'buffer-substring-filters - 'filter-buffer-substring-function "24.1") - (defun filter-buffer-substring (beg end &optional delete) "Return the buffer substring between BEG and END, after filtering. 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." "Default function to use for `filter-buffer-substring-function'. Its arguments and return value are as specified for `filter-buffer-substring'. Also respects the obsolete wrapper hook `filter-buffer-substring-functions' -\(see `with-wrapper-hook' for details about wrapper hooks), -and the abnormal hook `buffer-substring-filters'. +(see `with-wrapper-hook' for details about wrapper hooks). No filtering is done unless a hook says to." (subr--with-wrapper-hook-no-warnings filter-buffer-substring-functions (beg end delete) (cond - ((or delete buffer-substring-filters) + (delete (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))) - string))) + (delete-and-extract-region beg end))) (t (buffer-substring beg end)))))