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 07:02:42 -0700 (PDT) Message-ID: <1807679d-1125-4afe-81b7-b8d8e78aa2c6@default> References: <5a44a850-e4fc-4c9f-a266-c74766810ba1@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 1476713070 8856 195.159.176.226 (17 Oct 2016 14:04:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 17 Oct 2016 14:04:30 +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 16:04:27 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 1bw8W7-0006Xb-BN for ged-emacs-devel@m.gmane.org; Mon, 17 Oct 2016 16:03:51 +0200 Original-Received: from localhost ([::1]:33280 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bw8W9-0002CW-DD for ged-emacs-devel@m.gmane.org; Mon, 17 Oct 2016 10:03:53 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47524) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bw8VB-0001XA-8c for emacs-devel@gnu.org; Mon, 17 Oct 2016 10:02:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bw8V6-0007Qi-GP for emacs-devel@gnu.org; Mon, 17 Oct 2016 10:02:53 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:43203) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bw8V6-0007QO-7x for emacs-devel@gnu.org; Mon, 17 Oct 2016 10:02:48 -0400 Original-Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u9HE2jqJ032115 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 17 Oct 2016 14:02:46 GMT Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u9HE2j0A002464 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 17 Oct 2016 14:02:45 GMT Original-Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u9HE2hlP029965; Mon, 17 Oct 2016 14:02:44 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: 156.151.31.81 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:208354 Archived-At: > `advice-add' puts advice on a function, `add-function' > does not. I don't think so. AFAICS, `add-function' certainly does "put advice on a function". `advice-add' is essentially `add-function' for a _named_ function. It does not apply to lambda forms etc. It is a wrapper around `add-function' that also deals with the symbol itself (e.g. adding doc, handling macro symbols,...). But you raise a reasonable point about that doc. AFAICT, nearly everything that is said in that node about potential problems and reserving advice for when you cannot modify a=20 function's behavior any other way applies just as well to `add-function' etc. as to `advice-add' etc. AFAICS, that info and advice is about advising functions. It is not just about advising named functions, and even if it were, it should apply equally to `add-function' for a named function. 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 "))) (The local value of `isearch-filter-predicate' can of course be a named function. But it need not be.) > `isearch-filter-predicate' is not a function, it's a > variable containing a function value. Yes, I know that. (And its value is not necessarily a symbol.)