From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#25581: 25.1; Incorrect statement in (elisp) `Hooks' Date: Thu, 09 Feb 2017 20:42:59 -0500 Message-ID: <87d1eqn7mk.fsf@users.sourceforge.net> References: <8e81acfe-ecaa-4fac-9484-24541b232ba1@default> <87k29cq68h.fsf@users.sourceforge.net> <4218ccf3-da3c-43e3-9901-183e4ec81f71@default> <87efzjrhi7.fsf@users.sourceforge.net> <1578ae0e-be68-47b0-a834-69da76fed9cd@default> <87zii6por2.fsf@users.sourceforge.net> <874m09pt6t.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1486690936 16158 195.159.176.226 (10 Feb 2017 01:42:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 10 Feb 2017 01:42:16 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) Cc: 25581@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 10 02:42:11 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1cc0Dx-0003og-Os for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 Feb 2017 02:42:09 +0100 Original-Received: from localhost ([::1]:41235 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cc0E3-00044r-4d for geb-bug-gnu-emacs@m.gmane.org; Thu, 09 Feb 2017 20:42:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cc0Dt-00044b-WD for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2017 20:42:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cc0Dp-0004wZ-V3 for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2017 20:42:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35421) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cc0Dp-0004wH-RI for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2017 20:42:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cc0Dp-0000B2-Im for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2017 20:42:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 Feb 2017 01:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25581 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25581-submit@debbugs.gnu.org id=B25581.1486690918670 (code B ref 25581); Fri, 10 Feb 2017 01:42:01 +0000 Original-Received: (at 25581) by debbugs.gnu.org; 10 Feb 2017 01:41:58 +0000 Original-Received: from localhost ([127.0.0.1]:33620 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cc0Dl-0000Aj-QY for submit@debbugs.gnu.org; Thu, 09 Feb 2017 20:41:58 -0500 Original-Received: from mail-io0-f181.google.com ([209.85.223.181]:36606) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cc0Dj-0000AX-Ve for 25581@debbugs.gnu.org; Thu, 09 Feb 2017 20:41:56 -0500 Original-Received: by mail-io0-f181.google.com with SMTP id j13so39837345iod.3 for <25581@debbugs.gnu.org>; Thu, 09 Feb 2017 17:41:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=ZfaQDVx+ZgCqQYdnijp1G4tQxmARSrrX21Sp6nFgp8g=; b=svBnPfKBMQmpoUW9VfoQ1CxlvWrIFcF0VCEeP0oIoSwXHfWouu/4op5SXvgdaRxLeb jCattYMsqQg+d0ybY0l3+El4IMqQgSNCqomhSUb3NiSl1WfXxRlyTBZNjjZxuBpEdhnO TXEHo6xlxt80nwFGrU44CL811L3rXHU+ADQZ/cOUqsX9No2tsEehozMym4/PRgH7UwBZ jP6nUL3SBTwYS2EuyH1C+GNsFRm2pF7vH909gzngE3WOLNYJ+53MxVJJMXkPycXo0OMw 2SlIU+wQbZAWM3fHMHbUerKAU3OsRlNiJcsDkRCIpq864a3zLHHO4KhKnzdvGMyh4/+6 usxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=ZfaQDVx+ZgCqQYdnijp1G4tQxmARSrrX21Sp6nFgp8g=; b=IHBR7nf2DhhtwV2xuOv8B75qDhCU6Z5S9tBn9zwaw5QInVDkF6ykb+sYCl7BUeUq5L sJiV/QecoETonXLwOwKZ7C5PEdyJBLtnrcNzJ4zBa7NCsnwSJ4WH9z99Ow4ZH+bAlZyN JpQKc8CliPkqJVb63rt+8nuPQhXkkCP5mNaMkpoQG9Bz77KgZzQcUKk3JCNkaOD6BA9F ENChgf+AYo5r+T2I2Ga7DWPTKIKT0hOAmY+u95WTn+Y/boP3e3T8EwBPf7+UubIjiH6k pjEtzn7p21kNoCe+Xru7uCO/msLwXrd5ulUbMdKXfdeAZRErnb8HphVQy6/SYOcfFayl JkPQ== X-Gm-Message-State: AMke39m5VkXcXZ6XmInrwuusO/K6LqC3BP6AAWDtOqPldaFlLLSqaASdbnFuDbBos894Bg== X-Received: by 10.107.17.94 with SMTP id z91mr6810892ioi.37.1486690910229; Thu, 09 Feb 2017 17:41:50 -0800 (PST) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id p81sm317922ioi.9.2017.02.09.17.41.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Feb 2017 17:41:49 -0800 (PST) In-Reply-To: (Drew Adams's message of "Sat, 4 Feb 2017 18:11:11 -0800 (PST)") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:129172 Archived-At: Drew Adams writes: > It's hard for me to read this style of `diff' output, so I may > have missed some of the real changes. I think I'm generally OK > with your proposed changes, but I made a few comments below. Yeah, it's a bit hard to pick out the real changes from the whitespace changes. Basically, my idea is to mvoe the separate explanations about using add-hook/function for hooks, abnormal hooks, and -function/-predicate variables and merge them into a single paragraph at the bottom. >> +functions (@pxref{What Is a Function}) to be called on a particular > > OK. I think the only real change there is to xref {What Is a > Function}. (Right?) Yes, moved here from below. >> -You can use @code{add-hook} to add a function to an abnormal >> -hook, but you must write the function to follow the hook's >> -calling convention. > > I think this statement was removed. Don't you think that we > should say that you can use `add-hook' with an abnormal (or > a normal) hook? Should be covered below, but I guess I didn't actually abnormal hooks sepcifically there. >> +If the name of the variable ends in @samp{-predicate} or >> +@samp{-function} (singular) then its value must be a function, not a > > Is this the (new) policy, adding the suffix `-predicate'? > In my previous comments I was sticking to the old policy, and > pointing out that `isearch-filter-predicate', now that it is > being advised here and there with `add-function', is being used > as a hook, and so it should be named accordingly, as `*-function'. Not sure, I was under the impression that -predicate is the same idea as -function, with the added implication about the return value's meaning. No idea if this is "new" or not. > > But the addition of nadvice.el and subsequent encouragement > of advising functions with it applies to all functions. It in > effect makes every function-valued variable into a hook. Yes. > Can or should users expect that such variables will by convention have > such a conventional suffix? I guess? > >> +values can be modified with @code{setq} or temporarily with >> +@code{let}. > > Yes, but I'd say something like this (using "set" and "bind" > instead of "modified"): > > Since a hook is a variable you can set or bind it to a different > value (using `setq' or `let', for example). This applies to any > hook, regardless of its value. > > If you want to point out that this is true for both multi-function > and single-function hooks, OK, but it's not strictly necessary. > The point is about variables, not their values, and I think the > last sentence I added is enough to cover this. Makes sense. >> +Most normal hook variables are initially void; @code{add-hook} knows >> +how to deal with this. You can add hooks either globally or > > "You can add hooks" is wrong. Oops, that was a thinko, I meant "you can add functions". > >> +buffer-locally with @code{add-hook}. > > I would split the paragraph here, before talking about > hooks whose values can only be a single-function. Yes, it is a bit long. [...] > Now, since you can apply `add-function' to any function, it > can happen that someone defines a variable - of whatever > name - whose value can be a (single) function or nil (or > a number or a symbol or a character or...). In a general > sense, since the value CAN be a function, someone could > call such a variable a "hook", if s?he wants. > > But that is, I think, NOT what we are talking about in > this doc. We are talking here about naming conventions > for variables whose values are either (1) a function > whose name ends in `-function' (or `-predicate'?) and > whose value MUST BE a function or (2) a list of functions > (normal & abnormal hooks, for which you can use `add-hook'). Hmm, I'm not sure if making this division is helpful. I do think we need some kind of name for these kind of "hooks". Just not sure what it should be...