From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Brian Jenkins Newsgroups: gmane.emacs.devel Subject: Fwd: [PATCH] frame.c: focus hooks Date: Mon, 18 Nov 2013 08:33:11 -0500 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bf1656ed29c9b04eb7397fb X-Trace: ger.gmane.org 1384781621 28658 80.91.229.3 (18 Nov 2013 13:33:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 18 Nov 2013 13:33:41 +0000 (UTC) To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 18 14:33:47 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ViOxR-0000rF-N8 for ged-emacs-devel@m.gmane.org; Mon, 18 Nov 2013 14:33:41 +0100 Original-Received: from localhost ([::1]:43300 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ViOxR-0006XF-0k for ged-emacs-devel@m.gmane.org; Mon, 18 Nov 2013 08:33:41 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ViOxK-0006Wx-9p for emacs-devel@gnu.org; Mon, 18 Nov 2013 08:33:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ViOxF-0002nK-Ci for emacs-devel@gnu.org; Mon, 18 Nov 2013 08:33:34 -0500 Original-Received: from mail-pd0-x22e.google.com ([2607:f8b0:400e:c02::22e]:52906) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ViOxF-0002mu-10 for emacs-devel@gnu.org; Mon, 18 Nov 2013 08:33:29 -0500 Original-Received: by mail-pd0-f174.google.com with SMTP id y13so406214pdi.19 for ; Mon, 18 Nov 2013 05:33:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=+YOUomRd86IkMV2LvxGvKw1TJJ/HSSNZCO18/4zZCLA=; b=QinMHydL1b/MNFfaeZBU9X3P7ambQVRLpn2Jmw4dFxLVZyP65Qfl6e1yuxOdWqggfF qJqRUoYFYGXi8bjfDL/yC+zcMFid+Q1nPUrKkH0adFfY8RgZsXZT0rFKP4Lg58TLlKx4 Exm0+iJ8/5fNVgtpyFbxUKetmiQAsweAR++87q7l37eu3b3XYY0BiVFbjFyXu6pFP05Z 7/MYP78JAf4o+pgIwOF5SPNwGAunMWd89urj76Slcz1IERurjeFJlQROo/d6FhKc0Pdb jiDmSOc9GOnPRg3urL83aC9BYZoOFp63Vnj8wuFxTK5FeXS7u/2nb1mZrushytxZSbVA 4zlQ== X-Received: by 10.66.190.10 with SMTP id gm10mr2997927pac.126.1384781607769; Mon, 18 Nov 2013 05:33:27 -0800 (PST) Original-Received: by 10.68.29.202 with HTTP; Mon, 18 Nov 2013 05:33:11 -0800 (PST) In-Reply-To: X-Google-Sender-Auth: vR-hl6uwW7wgv_3fohZWByG-bxY X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c02::22e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:165323 Archived-At: --047d7bf1656ed29c9b04eb7397fb Content-Type: text/plain; charset=ISO-8859-1 Hi, Leo. Thanks for the suggestion. It's my understanding that the convention for hooks to receive no arguments and for more complicated functions to be used only when necessary. >From the Emacs info page 48.2.2 Most hooks are "normal hooks". This means that when Emacs runs the hook, it calls each hook function in turn, with no arguments. We have made an effort to keep most hooks normal, so that you can use them in a uniform way. Every variable whose name ends in `-hook' is a normal hook. A few hooks are "abnormal hooks". Their names end in `-functions', instead of `-hook' (some old code may also use the deprecated suffix `-hooks'). What makes these hooks abnormal is the way its functions are called--perhaps they are given arguments, or perhaps the values they return are used in some way. For example, `find-file-not-found-functions' is abnormal because as soon as one hook function returns a non-`nil' value, the rest are not called at all (*note Visiting::). The documentation of each abnormal hook variable explains how its functions are used. I'd like to keep things as simple as possible. I think two normal hooks are simpler than one abnormal hook. Brian On Sun, Nov 17, 2013 at 11:11 PM, Leo Liu wrote: > On 2013-11-18 01:50 +0800, Brian Jenkins wrote: > > People will probably find other handy uses for these hooks. > > How about name it frame-focus-hook? and pass `t' to hook functions when > gained focus and `nil' when lost focus? > > Leo > --047d7bf1656ed29c9b04eb7397fb Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi, Leo.<= /div>

Thanks for the suggestion.

It's my understanding that the convention for hooks to receive no
arguments and for more complicated functions to be used only when
necessary.

From the Emacs info page 48.2.2

=A0 =A0 Most hooks are "normal hooks". =A0= This means that when Emacs runs the
=A0 =A0 hook, it calls each h= ook function in turn, with no arguments. =A0We
=A0 =A0 have made an effort to keep most hooks normal, so that you can= use
=A0 =A0 them in a uniform way. =A0Every variable whose name = ends in `-hook' is
=A0 =A0 a normal hook.

=A0 =A0 A few hooks are "abnormal hooks". =A0Their names en= d in `-functions',
=A0 =A0 instead of `-hook' (some old code may also use the depreca= ted suffix
=A0 =A0 `-hooks'). =A0What makes these hooks abnor= mal is the way its functions
=A0 =A0 are called--perhaps they are= given arguments, or perhaps the values
=A0 =A0 they return are used in some way. =A0For example,
= =A0 =A0 `find-file-not-found-functions' is abnormal because as soon as = one
=A0 =A0 hook function returns a non-`nil' value, the rest= are not called at
=A0 =A0 all (*note Visiting::). =A0The documentation of each abnormal = hook
=A0 =A0 variable explains how its functions are used.
<= div>
I'd like to keep things as simple as possible. =A0I = think two normal hooks
are simpler than one abnormal hook.

Brian


On Sun, Nov 17, 2013 at 11:11 PM, Leo Liu <sdl.web@gmail.com> wrote:
On 2013-11-18 01:50 +0800, Brian Jenkin= s wrote:
> People will probably find other handy uses for these hooks.

How about name it frame-focus-hook? and pass `t' to hook function= s when
gained focus and `nil' when lost focus?

Leo


--047d7bf1656ed29c9b04eb7397fb--