From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id eNMLFyvqA2HZbwEAgWs5BA (envelope-from ) for ; Fri, 30 Jul 2021 14:01:47 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id AI21EivqA2F0RwAAB5/wlQ (envelope-from ) for ; Fri, 30 Jul 2021 12:01:47 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 35AD8C702 for ; Fri, 30 Jul 2021 14:01:45 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 280C0291CA; Fri, 30 Jul 2021 08:01:36 -0400 (EDT) X-Greylist: delayed 384 seconds by postgrey-1.36 at nmbug; Sun, 08 Nov 2020 04:21:08 EST Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by mail.notmuchmail.org (Postfix) with ESMTPS id 683991FFF8 for ; Sun, 8 Nov 2020 04:21:08 -0500 (EST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 44C1D5C00CE for ; Sun, 8 Nov 2020 04:14:44 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sun, 08 Nov 2020 04:14:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= christiantietze.de; h=from:to:cc:subject:date:message-id :mime-version:content-type; s=fm3; bh=2VQmnBlEaiO6nxdQCHjaZrTy5v ISh61Bj3n+KLgoY0o=; b=IwUUeZN2oEIcOzn2/tnDD6L449fjqijxvjtb/dsSiT q5m6es2LsIXfy+9Z1FMg5BxcDJ7mXDCrcn3UZUaW4j6YwSmam1uhAH3NVKrQdGOr h174bohTsg58Y3HVp5h8aaA5OMxubhimLXWUG1xGfCZxP2527ivfKEEGm1rtsID1 rRFlwL+7Wnzp6dE3YIRGQv22OpcLIwIy8dqW20eopAyPYM2/h2JP27BNIT6HMHM7 iFP7mBUkxjumTICfmGOHiIvnxDqjhygXSihYfVTT50rH7q5VUxILq0v8wW5EcNgI v0NAwB4YlLZwz44XMrDC9gZIXmxlb8lBNqyRH4xm0Bkg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=2VQmnBlEaiO6nxdQCHjaZrTy5vISh 61Bj3n+KLgoY0o=; b=pOF6fQbfNXqkhHARbIsByjfcu7SmkvrGX2tuD2Zpe8k0k vMxdB5Aoo/ifyGXuFkPlfuBTKdnNh4HFF4AVb6Q6pTcFoI9mnrUXIdv9Y7sz27mi sZdi1DHDzOakAzpFNq4+IF2AiOIGgF3HZ3eMIwUx390L4p47bGG0pxmYpCsp+kYS piUvcXQ+pBc6RdWXNd2Ce8FPTFyF1zMeAbK/ZbHL18x3UGRPoaw3lcp6/aUnr9Vr pTXA9PbjNE/siT2V1Pq/7mn56JSzTKiGU7X1wBJ5uy6/EaS6kE0AgMrUf1DIvlUe 7dC733A2wwdwdov87dSEUZukEtXA8CAUCOPPplWoA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddufecutefuodetggdotefrodftvfcurf hrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecunecujfgurhephffvufffkfggtgesthdtredttddttdenuc fhrhhomhepvehhrhhishhtihgrnhcuvfhivghtiigvuceomhgvsegthhhrihhsthhirghn thhivghtiigvrdguvgeqnecuggftrfgrthhtvghrnhepgeetjeffkeevgedtgeekhfehge eutdelffetfeeuieehtddvgfehieduhffguefhnecukfhppeefjedrvddtuddrudeggedr uddtheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmvgestghhrhhishhtihgrnhhtihgvthiivgdruggv X-ME-Proxy: Received: from mbp20.local (ip-37-201-144-105.hsi13.unitymediagroup.de [37.201.144.105]) by mail.messagingengine.com (Postfix) with ESMTPA id AA91A3280060 for ; Sun, 8 Nov 2020 04:14:40 -0500 (EST) From: Christian Tietze To: notmuch@notmuchmail.org Cc: Subject: notmuch-mode snippet: auto-select "inbox" widget when launching Date: Sun, 08 Nov 2020 10:14:37 +0100 Message-ID: MIME-Version: 1.0 X-MailFrom: me@christiantietze.de X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0 Message-ID-Hash: 2NU373NBFU52GTNAYWXHBQOWYCHZRYFD X-Message-ID-Hash: 2NU373NBFU52GTNAYWXHBQOWYCHZRYFD X-Mailman-Approved-At: Fri, 30 Jul 2021 12:01:31 -0400 X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1627646507; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=jlysF/9aA4jytXRFSJ37kugYoALTtaPMAEviSQfLhXA=; b=PJRrJP1335eovtl+8UCTW6rI+6GhxvvObI933WLoyk6+Ql/Ewc4m34/f6/0i5rXKP6/eCH 7NlX4vDfjVyMDH767LIfKNx0dDCjgwm29uCI23WUDvNjdheEOGqsQOVxZrsb1iu+CPOK+m uo3vMyr2HsT5LEJUHENvjYe7aCt8x8h82fmra9/vT4lOUyRAysKY6w0hpBjZxaUvZ6hJ42 Ll3gEUpLI/+wIIQieBPF+vuJn/Zaa+WTS5/W9PIGVyjPW0wCfpuIpYAbfdCI81+6XuwYoV fzRSjKF8xZ4BWihlt13rJWq2aXlLjgIRuRPDRx11+ToiKV22MGh59Jj5+Wqphg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1627646507; a=rsa-sha256; cv=none; b=PgnIACxGqZNDDwbZQ3HN4Pd4yZZhGmoJJJlT9PAKIAfwxfbsc1o0giC0fP97a7D+l7zTLy dAMTYkhiZOHo6NYF9WLCFCX35RVdBAZlPesU8Dn3/FzadDAp7a7upDCKBz3OmwKyOU5y+f cAUh6e+DIvWfQrwLmkLtvtTDhT8L+yRhE6w9FuqljCEXWbxwoph9rlG3q19PqiZS2YElBI D+8j4mLvwEiTU5xwIziT1brP8ViGsb4aCT93chEWaCReXgxfiE9QoFWGagpVGEIkRUsHVi p33zITbXDNNfl8VowyeLQ+jPh44IJL8brDHhxe/v7UstZfi7Tea1w8PxXWNPPw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=christiantietze.de header.s=fm3 header.b=IwUUeZN2; dkim=none ("invalid DKIM record") header.d=messagingengine.com header.s=fm1 header.b=pOF6fQbf; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: 1.26 Authentication-Results: aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=christiantietze.de header.s=fm3 header.b=IwUUeZN2; dkim=none ("invalid DKIM record") header.d=messagingengine.com header.s=fm1 header.b=pOF6fQbf; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 35AD8C702 X-Spam-Score: 1.26 X-Migadu-Scanner: scn0.migadu.com X-TUID: a/LEv8KQiP5L Hey folks! I'm enjoying notmuch-mode for the better part of 2020 and really got going with emacs thanks to this. In my day-to-day work, I noticed that when I leave the notmuch-hello buffer open, the point position remains like I left it, which is good. But sometimes I apparently hit `q` and on entering notmuch-hello the next time, I find that my point is in the upper-left corner where the logo is and I have to TAB to inbox. My idea for a remedy: when `notmuch-hello` is executed and creates the buffer, move point to the inbox tag. The existing hooks are kinda wonky for this, though. `notmuch-hello-mode-hook` is executed too early, before widgets are available to move the point to, for example. And adding an advice around notmuch-hello doesn't help because that's executed for every refresh, it seems. My hacky solution is to flick a temp variable on in the mode hook and use this to distinguish the first advice execution from all the others. Code is at the end. Maybe someone can make use of this, too. I don't really like the way I do it :) Do you have any suggestions? I don't want to propose a patch that changes when the hook is executed because I don't know why the hook runs before the widgets are available. Thanks for any pointers, and enjoy! Cheers, Christian ----- ;; When enabling the mode for the first time in a buffer, set a temp variable to `t` ... (defvar ct/notmuch-hello-mode-activated nil) (defun ct/notmuch-hello-prepare-advice-hook () (setq ct/notmuch-hello-mode-activated t)) (add-hook 'notmuch-hello-mode-hook #'ct/notmuch-hello-prepare-advice-hook) (defun ct/notmuch-hello-post-launch-advice (&rest args) ;; ... search for the "inbox" widget in the buffer recursively. (defun go-to-inbox-widget () (let ((widget (widget-at (point)))) (if (and widget (string= "inbox" (widget-value widget))) nil (widget-forward 1) (go-to-inbox-widget)))) ;; ... but only once (!) ... (unless (not ct/notmuch-hello-mode-activated) ;; ... so turn off the temp variable. (setq ct/notmuch-hello-mode-activated nil) (go-to-inbox-widget))) (advice-add #'notmuch-hello :after #'ct/notmuch-hello-post-launch-advice) -----