(format "%s%03d" notmuch-hello-thousands-separator elem))
(cdr result)))))
-(defun notmuch-hello-trim (search)
- "Trim whitespace."
- (if (string-match "^[[:space:]]*\\(.*[^[:space:]]\\)[[:space:]]*$" search)
- (match-string 1 search)
- search))
-
(defun notmuch-hello-search (&optional search)
(unless (null search)
- (setq search (notmuch-hello-trim search))
+ (setq search (string-trim search))
(let ((history-delete-duplicates t))
(add-to-history 'notmuch-search-history search)))
(notmuch-search search notmuch-search-oldest-first))
name)
(setq column-indent
(1+ (max 0 (- column-width (length name)))))))
- (setq count (1+ count))
+ (cl-incf count)
(when (eq (% count tags-per-line) 0)
(setq column-indent 0)
(widget-insert "\n")))
;; Refresh hello as soon as we get back to redisplay. On Emacs
;; 24, we can't do it right here because something in this
;; hook's call stack overrides hello's point placement.
+ ;; FIXME And on Emacs releases that we still support?
(run-at-time nil nil #'notmuch-hello t))
(unless hello-buf
;; Clean up hook
(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
- (let ((map (if (fboundp 'make-composed-keymap)
- ;; 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).
- (make-composed-keymap (list (make-sparse-keymap) widget-keymap))
- ;; Before Emacs 24, keymaps didn't support multiple
- ;; inheritance,, so just copy the widget keymap since
- ;; it's unlikely to change.
- (copy-keymap widget-keymap))))
+ ;; 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 "<C-tab>") 'widget-backward)
map)
"Keymap for \"notmuch hello\" buffers.")
(let ((notmuch-hello-auto-refresh nil))
(if no-display
(set-buffer "*notmuch-hello*")
- (switch-to-buffer "*notmuch-hello*")))
+ (pop-to-buffer-same-window "*notmuch-hello*")))
;; Install auto-refresh hook
(when notmuch-hello-auto-refresh
(add-hook 'window-configuration-change-hook