From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: 1) (elisp) `Advising Named Functions', 2) search filtering example Date: Mon, 17 Oct 2016 13:47:29 -0400 Message-ID: References: <5a44a850-e4fc-4c9f-a266-c74766810ba1@default> <1807679d-1125-4afe-81b7-b8d8e78aa2c6@default> <14560de9-7ab9-4d97-80dd-d4b84274affb@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1476726516 6990 195.159.176.226 (17 Oct 2016 17:48:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 17 Oct 2016 17:48:36 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 17 19:48:31 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 1bwC1S-0000Y7-EJ for ged-emacs-devel@m.gmane.org; Mon, 17 Oct 2016 19:48:26 +0200 Original-Received: from localhost ([::1]:34754 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwC1U-0006oz-IR for ged-emacs-devel@m.gmane.org; Mon, 17 Oct 2016 13:48:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53785) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwC0e-0006o5-Oe for emacs-devel@gnu.org; Mon, 17 Oct 2016 13:47:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwC0a-0001Zj-Q8 for emacs-devel@gnu.org; Mon, 17 Oct 2016 13:47:36 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:54487) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bwC0a-0001ZB-KD for emacs-devel@gnu.org; Mon, 17 Oct 2016 13:47:32 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AEBQALW9BX/3zt92hdGgEBAQECAQEBAYMtAQEBAQEehE2FUK92ggOGFgQCAoFpOhMBAgEBAQEBAQFeJ4RiAQEDAVYjBQsLNBIUGA0kiFUIvFUBAQEHAiWKfYocBY4nizKZDYYLkEsfATSEbCCGCgEBAQ X-IPAS-Result: A0AEBQALW9BX/3zt92hdGgEBAQECAQEBAYMtAQEBAQEehE2FUK92ggOGFgQCAoFpOhMBAgEBAQEBAQFeJ4RiAQEDAVYjBQsLNBIUGA0kiFUIvFUBAQEHAiWKfYocBY4nizKZDYYLkEsfATSEbCCGCgEBAQ X-IronPort-AV: E=Sophos;i="5.30,296,1470715200"; d="scan'208";a="276188175" Original-Received: from 104-247-237-124.cpe.teksavvy.com (HELO pastel.home) ([104.247.237.124]) by smtp.teksavvy.com with ESMTP; 17 Oct 2016 13:47:30 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id F35D364346; Mon, 17 Oct 2016 13:47:29 -0400 (EDT) In-Reply-To: <14560de9-7ab9-4d97-80dd-d4b84274affb@default> (Drew Adams's message of "Mon, 17 Oct 2016 10:05:51 -0700 (PDT)") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:208373 Archived-At: > #[128 [apply (lambda (b e) (save-excursion > (goto-char e) (eolp))) isearch-filter-visible ((name . "eol") > (isearch-message-prefix . "eol, "))] 4 nil] > Dunno what you want to call such a thing. A function object (a closure). More specifically a function which is the composition of two or more functions. You could get a similar function without using add-function, but using instead something like (setq isearch-filter-predicate (let ((old isearch-filter-predicate)) (lambda (&rest args) (and (apply args) (apply old args))))) > To me, the new advice doc is not as helpful as it should be, > and the thingies dealt with are not clear or clearly presented. To me, they're not as obscure as they should be: in my world, functions are black boxes (you only get to know their type). If you do (setq isearch-filter-predicate (symbol-function isearch-filter-predicate)) you end up with a variable that behaves pretty much exactly as before, but if you look at the value of `isearch-filter-predicate` it will suddenly look like some gobbledygook as well. The fact that sometimes you get a symbol is just an accident. > If you cannot or will not, I'm still hoping that someone else will > improve the doc and make things clearer, for all. I have no idea how to improve the doc, so feel free to try and do it. In the past I've had some luck with a "generate&test" approach, where someone writes a tentative doc, and I point out the factual errors in it, repeating the process until the doc is both understandable and correct. Stefan