From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id uMEhLS/vsl9ETgAA0tVLHw (envelope-from ) for ; Mon, 16 Nov 2020 21:29:19 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id UKzzKC/vsl9wFwAA1q6Kng (envelope-from ) for ; Mon, 16 Nov 2020 21:29:19 +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) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5A90B9404C6 for ; Mon, 16 Nov 2020 21:29:19 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 2D5B128C64; Mon, 16 Nov 2020 16:28:58 -0500 (EST) Received: from mail.hostpark.net (mail.hostpark.net [212.243.197.30]) by mail.notmuchmail.org (Postfix) with ESMTPS id 966D628C32 for ; Mon, 16 Nov 2020 16:28:44 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 9FAFF1616A for ; Mon, 16 Nov 2020 22:28:43 +0100 (CET) X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10124) with ESMTP id sZhmIiBkDQ8Y for ; Mon, 16 Nov 2020 22:28:43 +0100 (CET) Received: from customer (localhost [127.0.0.1]) (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 mail.hostpark.net (Postfix) with ESMTPSA id 66624160AE for ; Mon, 16 Nov 2020 22:28:43 +0100 (CET) From: Jonas Bernoulli To: notmuch@notmuchmail.org Subject: [PATCH v2 05/23] emacs: sanitize function that displays version Date: Mon, 16 Nov 2020 22:28:25 +0100 Message-Id: <20201116212843.6420-6-jonas@bernoul.li> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201116212843.6420-1-jonas@bernoul.li> References: <20201108190311.1397-1-jonas@bernoul.li> <20201116212843.6420-1-jonas@bernoul.li> MIME-Version: 1.0 Message-ID-Hash: 2CIR52KTTSLFGDXZN53QI2JHZ3XUOUWZ X-Message-ID-Hash: 2CIR52KTTSLFGDXZN53QI2JHZ3XUOUWZ X-MailFrom: jonas@bernoul.li X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header 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-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=none; 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-Spam-Score: -0.01 X-TUID: 8GXPJ8Ev6ZNn Previously it was defined in "notmuch-hello.el" and its name contained "hello" solely because it replaced an anonymous function that was mistakenly only bound in `notmuch-hello-mode-map'. But it makes more sense to bind it in all notmuch modes and even if we did not change that aspect it still would make no sense to have "hello" in its name. --- emacs/notmuch-hello.el | 14 -------------- emacs/notmuch-lib.el | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index af170dd4..69d0ad64 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -652,26 +652,12 @@ (defun notmuch-hello-window-configuration-change () (remove-hook 'window-configuration-change-hook #'notmuch-hello-window-configuration-change)))) -;; the following variable is defined as being defconst in notmuch-version.el -(defvar notmuch-emacs-version) - -(defun notmuch-hello-versions () - "Display the notmuch version(s)." - (interactive) - (let ((notmuch-cli-version (notmuch-cli-version))) - (message "notmuch version %s" - (if (string= notmuch-emacs-version notmuch-cli-version) - notmuch-cli-version - (concat notmuch-cli-version - " (emacs mua version " notmuch-emacs-version ")"))))) - (defvar notmuch-hello-mode-map ;; Inherit both widget-keymap and notmuch-common-keymap. We have ;; to use make-sparse-keymap to force this to be a new keymap (so ;; that when we modify map it does not modify widget-keymap). (let ((map (make-composed-keymap (list (make-sparse-keymap) widget-keymap)))) (set-keymap-parent map notmuch-common-keymap) - (define-key map "v" 'notmuch-hello-versions) (define-key map (kbd "") 'widget-backward) map) "Keymap for \"notmuch hello\" buffers.") diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index edb40533..8ee3f17f 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -147,6 +147,7 @@ (defcustom notmuch-archive-tags '("-inbox") (defvar notmuch-common-keymap (let ((map (make-sparse-keymap))) (define-key map "?" 'notmuch-help) + (define-key map "v" 'notmuch-version) (define-key map "q" 'notmuch-bury-or-kill-this-buffer) (define-key map "s" 'notmuch-search) (define-key map "t" 'notmuch-search-by-tag) @@ -218,6 +219,21 @@ (defun notmuch-cli-version () (match-string 2 long-string) "unknown"))) +(defvar notmuch-emacs-version) + +(defun notmuch-version () + "Display the notmuch version. +The versions of the Emacs package and the `notmuch' executable +should match, but if and only if they don't, then this command +displays both values separately." + (interactive) + (let ((cli-version (notmuch-cli-version))) + (message "notmuch version %s" + (if (string= notmuch-emacs-version cli-version) + cli-version + (concat cli-version + " (emacs mua version " notmuch-emacs-version ")"))))) + (defun notmuch-config-get (item) "Return a value from the notmuch configuration." (let* ((val (notmuch-command-to-string "config" "get" item)) -- 2.29.1