unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 14714@debbugs.gnu.org
Subject: bug#14714: 24.3.50; `isearch-filter-predicate(s)'
Date: Fri, 28 Jun 2013 02:39:37 +0300	[thread overview]
Message-ID: <87ppv7cd7u.fsf@mail.jurta.org> (raw)
In-Reply-To: <jwvk3lg8hp1.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 26 Jun 2013 21:32:01 -0400")

> Basically, replace
>
>     (add-hook 'isearch-filter-predicate #'foo nil t)
> with
>     (add-function :before-while (local isearch-filter-predicate) #'foo)
>
>> (defvar isearch-filter-predicate nil)
>
> For add-function to work well, you want to change this default value to
> be a function, such as (lambda () t).

I'm trying this, but not sure how to implement toggling like
in `dired-isearch-filenames-toggle':

  (setq isearch-filter-predicates
	(if (memq 'dired-isearch-filter-filenames isearch-filter-predicates)
	    (delq 'dired-isearch-filter-filenames isearch-filter-predicates)
	  (cons 'dired-isearch-filter-filenames isearch-filter-predicates)))

Whereas it's clear how to add and remove an advice function, it's unclear
how to check its existence instead of `memq'.  Is `advice-member-p' intended
to do what `memq' does?  When I tried

  (defvar-local isearch-filter-predicate (lambda (b e) t))
  (defun test-b (b e) (message "b"))
  (defun test-a (b e) (message "a"))
  (add-function :before-while (local isearch-filter-predicate) #'test-b)
  (add-function :after-while  (local isearch-filter-predicate) #'test-a)

then

  (funcall isearch-filter-predicate 1 2)

works fine, but

  (advice-member-p #'test-a 'isearch-filter-predicate)

returns nil.





  reply	other threads:[~2013-06-27 23:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-25 17:26 bug#14714: 24.3.50; `isearch-filter-predicate(s)' Drew Adams
2013-06-25 18:46 ` Stefan Monnier
2013-06-25 20:18   ` Drew Adams
2013-06-26  0:20     ` Stefan Monnier
2013-06-26  2:34       ` Drew Adams
2013-06-26 13:08         ` Stefan Monnier
2013-06-26 14:19           ` Drew Adams
2013-06-26 14:36             ` Stefan Monnier
2013-06-26 21:31   ` Juri Linkov
2013-06-27  1:32     ` Stefan Monnier
2013-06-27 23:39       ` Juri Linkov [this message]
2013-07-04  0:26         ` Stefan Monnier
2013-08-04  7:45           ` Stefan Monnier
2013-08-05 18:07             ` 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=87ppv7cd7u.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=14714@debbugs.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).