mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 04:18:08 +01:00
emacs: sanitize function that displays version
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.
This commit is contained in:
parent
ff80122972
commit
dfd99c7fba
2 changed files with 16 additions and 14 deletions
|
@ -652,26 +652,12 @@ with `notmuch-hello-query-counts'."
|
||||||
(remove-hook 'window-configuration-change-hook
|
(remove-hook 'window-configuration-change-hook
|
||||||
#'notmuch-hello-window-configuration-change))))
|
#'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
|
(defvar notmuch-hello-mode-map
|
||||||
;; Inherit both widget-keymap and notmuch-common-keymap. We have
|
;; Inherit both widget-keymap and notmuch-common-keymap. We have
|
||||||
;; to use make-sparse-keymap to force this to be a new keymap (so
|
;; 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).
|
;; that when we modify map it does not modify widget-keymap).
|
||||||
(let ((map (make-composed-keymap (list (make-sparse-keymap) widget-keymap))))
|
(let ((map (make-composed-keymap (list (make-sparse-keymap) widget-keymap))))
|
||||||
(set-keymap-parent map notmuch-common-keymap)
|
(set-keymap-parent map notmuch-common-keymap)
|
||||||
(define-key map "v" 'notmuch-hello-versions)
|
|
||||||
(define-key map (kbd "<C-tab>") 'widget-backward)
|
(define-key map (kbd "<C-tab>") 'widget-backward)
|
||||||
map)
|
map)
|
||||||
"Keymap for \"notmuch hello\" buffers.")
|
"Keymap for \"notmuch hello\" buffers.")
|
||||||
|
|
|
@ -147,6 +147,7 @@ For example, if you wanted to remove an \"inbox\" tag and add an
|
||||||
(defvar notmuch-common-keymap
|
(defvar notmuch-common-keymap
|
||||||
(let ((map (make-sparse-keymap)))
|
(let ((map (make-sparse-keymap)))
|
||||||
(define-key map "?" 'notmuch-help)
|
(define-key map "?" 'notmuch-help)
|
||||||
|
(define-key map "v" 'notmuch-version)
|
||||||
(define-key map "q" 'notmuch-bury-or-kill-this-buffer)
|
(define-key map "q" 'notmuch-bury-or-kill-this-buffer)
|
||||||
(define-key map "s" 'notmuch-search)
|
(define-key map "s" 'notmuch-search)
|
||||||
(define-key map "t" 'notmuch-search-by-tag)
|
(define-key map "t" 'notmuch-search-by-tag)
|
||||||
|
@ -218,6 +219,21 @@ on the command line, and then retry your notmuch command")))
|
||||||
(match-string 2 long-string)
|
(match-string 2 long-string)
|
||||||
"unknown")))
|
"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)
|
(defun notmuch-config-get (item)
|
||||||
"Return a value from the notmuch configuration."
|
"Return a value from the notmuch configuration."
|
||||||
(let* ((val (notmuch-command-to-string "config" "get" item))
|
(let* ((val (notmuch-command-to-string "config" "get" item))
|
||||||
|
|
Loading…
Reference in a new issue