[PATCH] emacs: Improve `notmuch-hello' display on ttys.
Austin Clements
amdragon at MIT.EDU
Tue Jan 10 07:36:50 PST 2012
LGTM, though would it be easier to put this in the else clause of the
if after the setq count?
Is it possible for a tag in the last column to be just long enough to
make the line still wrap? Somehow my current tag set doesn't trigger
this bug, so I can't test this case (and I admit I can't follow
notmuch-hello-insert-tags well enough to reason this out).
Quoth David Edmondson on Jan 10 at 10:15 am:
> Inserting spaces to pad out columns is good, except when the padding
> makes the line wider than the window. This looks particularly bad on a
> tty where there is no fringe.
>
> Hence, avoid padding the last column on each row.
> ---
>
> Thanks to j4ni in #notmuch for spotting this.
>
> emacs/notmuch-hello.el | 20 +++++++++++---------
> 1 files changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index 333d4c1..02017ce 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -299,15 +299,17 @@ should be. Returns a cons cell `(tags-per-line width)'."
> :notify #'notmuch-hello-widget-search
> :notmuch-search-terms query
> formatted-name)
> - ;; Insert enough space to consume the rest of the
> - ;; column. Because the button for the name is `(1+
> - ;; (length name))' long (due to the trailing space) we
> - ;; can just insert `(- widest (length name))' spaces -
> - ;; the column separator is included in the button if
> - ;; `(equal widest (length name)'.
> - (widget-insert (make-string (max 1
> - (- widest (length name)))
> - ? ))))
> + (unless (eq (% count tags-per-line) (1- tags-per-line))
> + ;; If this is not the last tag on the line, insert
> + ;; enough space to consume the rest of the column.
> + ;; Because the button for the name is `(1+ (length
> + ;; name))' long (due to the trailing space) we can
> + ;; just insert `(- widest (length name))' spaces - the
> + ;; column separator is included in the button if
> + ;; `(equal widest (length name)'.
> + (widget-insert (make-string (max 1
> + (- widest (length name)))
> + ? )))))
> (setq count (1+ count))
> (if (eq (% count tags-per-line) 0)
> (widget-insert "\n")))
More information about the notmuch
mailing list