emacs: If 'all tags' is not shown, don't use it when calculating widths.

If the 'all tags' section of the hello buffer will not be shown, don't
consider those tags when determining the number of saved searches that
can be displayed on a single line.
(cherry picked from commit 18d41192d2)
This commit is contained in:
David Edmondson 2010-04-27 11:04:36 +01:00 committed by Carl Worth
parent 7825376b3f
commit 98a05af063

View file

@ -284,8 +284,9 @@ diagonal."
if (> (string-to-number (notmuch-saved-search-count (cdr elem))) 0) if (> (string-to-number (notmuch-saved-search-count (cdr elem))) 0)
collect elem))) collect elem)))
(saved-widest (notmuch-hello-longest-label saved-alist)) (saved-widest (notmuch-hello-longest-label saved-alist))
(alltags-alist (mapcar '(lambda (tag) (cons tag (concat "tag:" tag))) (alltags-alist (if notmuch-show-all-tags-list
(process-lines notmuch-command "search-tags"))) (mapcar '(lambda (tag) (cons tag (concat "tag:" tag)))
(process-lines notmuch-command "search-tags"))))
(alltags-widest (notmuch-hello-longest-label alltags-alist)) (alltags-widest (notmuch-hello-longest-label alltags-alist))
(widest (max saved-widest alltags-widest))) (widest (max saved-widest alltags-widest)))
@ -360,26 +361,27 @@ diagonal."
(indent-rigidly start (point) notmuch-hello-indent))) (indent-rigidly start (point) notmuch-hello-indent)))
(when alltags-alist (when alltags-alist
(if notmuch-show-all-tags-list (widget-insert "\nAll tags: ")
(progn (widget-create 'push-button
(widget-insert "\nAll tags: ") :notify (lambda (widget &rest ignore)
(widget-create 'push-button (setq notmuch-show-all-tags-list nil)
:notify (lambda (widget &rest ignore) (notmuch-hello-update))
(setq notmuch-show-all-tags-list nil) "hide")
(notmuch-hello-update)) (widget-insert "\n\n")
"hide") (let ((start (point)))
(widget-insert "\n\n") (setq found-target-pos (notmuch-hello-insert-tags alltags-alist widest target))
(let ((start (point))) (if (not final-target-pos)
(setq found-target-pos (notmuch-hello-insert-tags alltags-alist widest target)) (setq final-target-pos found-target-pos))
(if (not final-target-pos) (indent-rigidly start (point) notmuch-hello-indent)))
(setq final-target-pos found-target-pos))
(indent-rigidly start (point) notmuch-hello-indent))) (widget-insert "\n")
(widget-insert "\n")
(if (not notmuch-show-all-tags-list)
(widget-create 'push-button (widget-create 'push-button
:notify (lambda (widget &rest ignore) :notify (lambda (widget &rest ignore)
(setq notmuch-show-all-tags-list t) (setq notmuch-show-all-tags-list t)
(notmuch-hello-update)) (notmuch-hello-update))
"Show all tags")))) "Show all tags")))
(let ((start (point))) (let ((start (point)))
(widget-insert "\n\n") (widget-insert "\n\n")