Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 19E3C431FAF for ; Fri, 7 Sep 2012 00:56:15 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lBEL9KjX78qf for ; Fri, 7 Sep 2012 00:56:13 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id 7BFA0431FAE for ; Fri, 7 Sep 2012 00:56:13 -0700 (PDT) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id 4C4E61000E5; Fri, 7 Sep 2012 10:56:21 +0300 (EEST) From: Tomi Ollila To: Jani Nikula , notmuch@notmuchmail.org Subject: Re: [PATCH v2 2/5] emacs: add no-display arg to notmuch-hello-refresh-hook In-Reply-To: <51214be764d0f54d0db3658e43f1377d67e34fdf.1346596156.git.jani@nikula.org> References: <51214be764d0f54d0db3658e43f1377d67e34fdf.1346596156.git.jani@nikula.org> User-Agent: Notmuch/0.14+11~gd9bf007 (http://notmuchmail.org) Emacs/24.2.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Sep 2012 07:56:15 -0000 On Sun, Sep 02 2012, Jani Nikula wrote: > Add no-display arg to notmuch-hello-refresh-hook to allow each hook to > decide what is appropriate when no-display is t, i.e. when not > switching to the notmuch-hello buffer. > > This breaks existing hooks people might have, which will now need to > accept the argument. > > Signed-off-by: Jani Nikula > --- > emacs/notmuch-hello.el | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el > index 4dfe5d2..fa14443 100644 > --- a/emacs/notmuch-hello.el > +++ b/emacs/notmuch-hello.el > @@ -816,7 +816,7 @@ it (i.e. use `set-buffer' rather than `switch-to-buffer')." > (unless (widget-at) > (when notmuch-hello-search-pos > (goto-char notmuch-hello-search-pos))))) > - (run-hooks 'notmuch-hello-refresh-hook) > + (run-hook-with-args 'notmuch-hello-refresh-hook no-display) > (setq notmuch-hello-first-run nil)) I had already written a bit of reply for this (for +1:ng the change), but luckily fall into some emacs documentation: http://sunsite.ualberta.ca/Documentation/Gnu/emacs-lisp-ref-20.5/html_node/elisp_357.html --8<----8<----8<----8<----8<----8<----8<----8<----8<-- 23.6 Hooks ========== ... Most of the hooks in Emacs are normal hooks. These variables contain lists of functions to be called with no arguments. When the hook name ends in `-hook', that tells you it is normal. We try to make all hooks normal, as much as possible, so that you can use them in a uniform way. ... If the hook variable's name does not end with `-hook', that indicates it is probably an abnormal hook; you should look at its documentation to see how to use the hook properly. --8<----8<----8<----8<----8<----8<----8<----8<----8<-- And, indeed, grepping through emacs 24.2 sources when run-hooks-with-args is used then the variable symbol doesn't end with -hook, for example: (run-hook-with-args 'widget-edit-functions widget)) So, Jani -- probably you can use the no-display from the dynamic scope of the caller in your hook in .emacs -- not nice but... ... or propose a change to the hook name -- or add another hook... > (defun notmuch-folder () > -- > 1.7.9.5 Tomi