all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Noam Postavsky <npostavs@users.sourceforge.net>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: RE: 1) (elisp) `Advising Named Functions', 2) search filtering example
Date: Mon, 17 Oct 2016 08:40:32 -0700 (PDT)	[thread overview]
Message-ID: <9f1cf1a7-6f05-449a-a4a2-c013cf326e9c@default> (raw)
In-Reply-To: <CAM-tV-_gAj7hq90aWtPL+7+j=fAJsEEjsJzjhYF=Sygpu9sCQA@mail.gmail.com>

> > Do you think that that information does not apply also
> > to this code, from dired-aux.el?  If so, why?
> >
> > (add-function :before-while (local 'isearch-filter-predicate)
> >               #'dired-isearch-filter-filenames
> >               '((isearch-message-prefix . "filename ")))
> 
> I think it falls under this case in `(elisp) Hooks' (which should be
> updated to mention `-predicate' as a possible suffix)
> 
>        If the variable’s name ends in ‘-function’, then its value is just
>     a single function, not a list of functions.  ‘add-hook’ cannot be used
>     to modify such a _single function hook_, and you have to use
>     ‘add-function’ instead (*note Advising Functions::).

I think that is wrong also.  `add-hook' _can_ be used to modify a _single
function hook_.  And the doc of `add-hook' tells you so, in its last line -
`C-h f add-hook':

  ...
  If HOOK's value is a single function, it is changed to a list of
  functions.

Again, I do question whether we should now be advising against using
hooks and in favor of the new advice.  But I guess I'm OK with that,
if it's really the decision.  As I mentioned, I already took the
latter approach in my Isearch filtering feature.



  parent reply	other threads:[~2016-10-17 15:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-17  5:25 1) (elisp) `Advising Named Functions', 2) search filtering example Drew Adams
2016-10-17 12:20 ` Noam Postavsky
2016-10-17 14:02   ` Drew Adams
2016-10-17 14:37     ` Noam Postavsky
2016-10-17 14:52       ` Stefan Monnier
2016-10-17 15:40         ` Drew Adams
2016-10-17 15:51           ` Stefan Monnier
2016-10-17 17:05             ` Drew Adams
2016-10-17 17:47               ` Stefan Monnier
2016-10-17 15:40       ` Drew Adams [this message]
2016-10-17 16:16         ` Noam Postavsky
2016-10-17 17:05           ` Drew Adams
2016-10-17 17:53             ` Stefan Monnier
2016-10-17 18:41               ` Drew Adams
2016-10-17 19:25                 ` Stefan Monnier
2016-10-18 19:47                   ` Richard Stallman
2016-10-19  6:15                     ` Eli Zaretskii
2016-10-19 20:00                       ` Richard Stallman
2016-10-19 20:18                         ` Stefan Monnier
2016-10-20  7:17                           ` Eli Zaretskii
2016-10-20  7:06                         ` Eli Zaretskii
2016-10-20 18:06                           ` Richard Stallman

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9f1cf1a7-6f05-449a-a4a2-c013cf326e9c@default \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=npostavs@users.sourceforge.net \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.