Re: [PATCH v2 2/5] emacs: add no-display arg to notmuch-hello-refresh-hook
authorTomi Ollila <tomi.ollila@iki.fi>
Fri, 7 Sep 2012 07:56:21 +0000 (10:56 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:49:26 +0000 (09:49 -0800)
03/3789f02c17d4d00893b874cb107dcec7ed24ed [new file with mode: 0644]

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