From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id cTeJKw9BqF9iPAAA0tVLHw (envelope-from ) for ; Sun, 08 Nov 2020 19:03:43 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id aOzKJg9BqF/ZMQAAbx9fmQ (envelope-from ) for ; Sun, 08 Nov 2020 19:03:43 +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 4E23A9402DD for ; Sun, 8 Nov 2020 19:03:43 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 53F0D28BEC; Sun, 8 Nov 2020 14:03:23 -0500 (EST) Received: from mail.hostpark.net (mail.hostpark.net [212.243.197.30]) by mail.notmuchmail.org (Postfix) with ESMTPS id 8E6A8270DE for ; Sun, 8 Nov 2020 14:03:13 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 9918B165EB for ; Sun, 8 Nov 2020 20:03:12 +0100 (CET) X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10124) with ESMTP id 6kVsn2CorJ7w for ; Sun, 8 Nov 2020 20:03:12 +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 2BFFE165EC for ; Sun, 8 Nov 2020 20:03:12 +0100 (CET) From: Jonas Bernoulli To: notmuch@notmuchmail.org Subject: [PATCH 09/27] emacs: sanitize function that displays version Date: Sun, 8 Nov 2020 20:02:53 +0100 Message-Id: <20201108190311.1397-10-jonas@bernoul.li> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201108190311.1397-1-jonas@bernoul.li> References: <20201108190311.1397-1-jonas@bernoul.li> MIME-Version: 1.0 Message-ID-Hash: VTIAI76ZJF35E3GOZFX56CGTLLT557ND X-Message-ID-Hash: VTIAI76ZJF35E3GOZFX56CGTLLT557ND 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: BkaJEJbO7bo7 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