From: Paul Eggert <eggert@cs.ucla.edu>
To: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: with-wrapper-hook is obsolete; how to replace it?
Date: Mon, 16 May 2016 11:18:41 -0700 [thread overview]
Message-ID: <acf3c55f-b2ab-d291-9a4a-654615839d24@cs.ucla.edu> (raw)
In-Reply-To: <jwv8tzb17xk.fsf-monnier+gmane.emacs.devel@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 504 bytes --]
On 05/15/2016 11:43 AM, Stefan Monnier wrote:
> I don't think you can do it in a backward-compatible way.
> Which is why buffer-substring--filter still uses with-wrapper-hook (but
> only to implement the obsolete filter-buffer-substring-functions variable).
OK, thanks, how about the attached patch instead? The idea is to pacify
the byte compiler without attempting to use add-function, by creating an
internal-use-only version of the obsolete macro, a version that does not
generate the warnings.
[-- Attachment #2: with-wrapper-hook.diff --]
[-- Type: text/x-patch, Size: 2480 bytes --]
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index 7814ea2..163dc8e 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -848,7 +848,7 @@ abbrev--default-expand
"Default function to use for `abbrev-expand-function'.
This respects the wrapper hook `abbrev-expand-functions'.
Calls `abbrev-insert' to insert any expansion, and returns what it does."
- (with-wrapper-hook abbrev-expand-functions ()
+ (subr--with-wrapper-hook-no-warnings abbrev-expand-functions ()
(pcase-let ((`(,sym ,name ,wordstart ,wordend) (abbrev--before-point)))
(when sym
(let ((startpos (copy-marker (point) t))
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 1ee05d3..9190c1f 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1970,7 +1970,7 @@ completion--in-region
"Default function to use for `completion-in-region-function'.
Its arguments and return value are as specified for `completion-in-region'.
This respects the wrapper hook `completion-in-region-functions'."
- (with-wrapper-hook
+ (subr--with-wrapper-hook-no-warnings
;; FIXME: Maybe we should use this hook to provide a "display
;; completions" operation as well.
completion-in-region-functions (start end collection predicate)
diff --git a/lisp/simple.el b/lisp/simple.el
index e257062..65664c9 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4061,7 +4061,8 @@ buffer-substring--filter
This respects the wrapper hook `filter-buffer-substring-functions',
and the abnormal hook `buffer-substring-filters'.
No filtering is done unless a hook says to."
- (with-wrapper-hook filter-buffer-substring-functions (beg end delete)
+ (subr--with-wrapper-hook-no-warnings
+ filter-buffer-substring-functions (beg end delete)
(cond
((or delete buffer-substring-filters)
(save-excursion
diff --git a/lisp/subr.el b/lisp/subr.el
index 0fa6404..438f00a 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1546,6 +1546,10 @@ with-wrapper-hook
(declare (indent 2) (debug (form sexp body))
(obsolete "use a <foo>-function variable modified by `add-function'."
"24.4"))
+ `(subr--with-wrapper-hook-no-warnings ,hook ,args ,@body))
+
+(defmacro subr--with-wrapper-hook-no-warnings (hook args &rest body)
+ "Like (with-wrapper-hook HOOK ARGS BODY), but without warnings."
;; We need those two gensyms because CL's lexical scoping is not available
;; for function arguments :-(
(let ((funs (make-symbol "funs"))
next prev parent reply other threads:[~2016-05-16 18:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-15 17:01 with-wrapper-hook is obsolete; how to replace it? Paul Eggert
2016-05-15 18:43 ` Stefan Monnier
2016-05-16 18:18 ` Paul Eggert [this message]
2016-05-16 18:25 ` Stefan Monnier
2016-05-16 17:40 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=acf3c55f-b2ab-d291-9a4a-654615839d24@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).