From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: 1) (elisp) `Advising Named Functions', 2) search filtering example Date: Mon, 17 Oct 2016 08:40:32 -0700 (PDT) Message-ID: <9f1cf1a7-6f05-449a-a4a2-c013cf326e9c@default> References: <5a44a850-e4fc-4c9f-a266-c74766810ba1@default> <1807679d-1125-4afe-81b7-b8d8e78aa2c6@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1476718876 14383 195.159.176.226 (17 Oct 2016 15:41:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 17 Oct 2016 15:41:16 +0000 (UTC) Cc: emacs-devel To: Noam Postavsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 17 17:41:12 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bwA1u-0000J4-0n for ged-emacs-devel@m.gmane.org; Mon, 17 Oct 2016 17:40:46 +0200 Original-Received: from localhost ([::1]:33957 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwA1v-0002wm-Gh for ged-emacs-devel@m.gmane.org; Mon, 17 Oct 2016 11:40:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44502) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwA1p-0002wV-O2 for emacs-devel@gnu.org; Mon, 17 Oct 2016 11:40:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwA1k-0008A0-SV for emacs-devel@gnu.org; Mon, 17 Oct 2016 11:40:41 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:17541) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bwA1k-00089q-Lt for emacs-devel@gnu.org; Mon, 17 Oct 2016 11:40:36 -0400 Original-Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u9HFeZN4016261 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 17 Oct 2016 15:40:35 GMT Original-Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u9HFeY6c030911 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 17 Oct 2016 15:40:35 GMT Original-Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id u9HFeYEu029917; Mon, 17 Oct 2016 15:40:34 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6753.5000 (x86)] X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:208362 Archived-At: > > 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 "))) >=20 > I think it falls under this case in `(elisp) Hooks' (which should be > updated to mention `-predicate' as a possible suffix) >=20 > If the variable=E2=80=99s name ends in =E2=80=98-function=E2=80=99= , then its value is just > a single function, not a list of functions. =E2=80=98add-hook=E2=80= =99 cannot be used > to modify such a _single function hook_, and you have to use > =E2=80=98add-function=E2=80=99 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.