From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <amdragon@mit.edu>
Received: from localhost (localhost [127.0.0.1])
	by olra.theworths.org (Postfix) with ESMTP id BCEDB431FD0
	for <notmuch@notmuchmail.org>; Tue, 10 Jan 2012 07:37:04 -0800 (PST)
X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
X-Spam-Flag: NO
X-Spam-Score: -0.7
X-Spam-Level: 
X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
	tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
Received: from olra.theworths.org ([127.0.0.1])
	by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id PNtEa0aeUG0L for <notmuch@notmuchmail.org>;
	Tue, 10 Jan 2012 07:37:04 -0800 (PST)
Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU
	[18.9.25.14])
	by olra.theworths.org (Postfix) with ESMTP id 30814431FB6
	for <notmuch@notmuchmail.org>; Tue, 10 Jan 2012 07:37:04 -0800 (PST)
X-AuditID: 1209190e-b7f7c6d0000008c3-4b-4f0c5b1c8800
Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])
	by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP
	id DD.33.02243.C1B5C0F4; Tue, 10 Jan 2012 10:37:00 -0500 (EST)
Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
	by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q0AFakNn000848; 
	Tue, 10 Jan 2012 10:36:46 -0500
Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
	(authenticated bits=0)
	(User authenticated as amdragon@ATHENA.MIT.EDU)
	by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q0AFaggH025292
	(version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
	Tue, 10 Jan 2012 10:36:45 -0500 (EST)
Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)
	(envelope-from <amdragon@mit.edu>)
	id 1Rkdko-0000jH-Td; Tue, 10 Jan 2012 10:36:50 -0500
Date: Tue, 10 Jan 2012 10:36:50 -0500
From: Austin Clements <amdragon@MIT.EDU>
To: David Edmondson <dme@dme.org>
Subject: Re: [PATCH] emacs: Improve `notmuch-hello' display on ttys.
Message-ID: <20120110153650.GM20796@mit.edu>
References: <1326190528-3548-1-git-send-email-dme@dme.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1326190528-3548-1-git-send-email-dme@dme.org>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpileLIzCtJLcpLzFFi42IRYrdT0ZWJ5vE3mDnV1GLfnS1MFtdvzmR2
	YPLY9fwvk8ezVbeYA5iiuGxSUnMyy1KL9O0SuDLW/9nJVPBLsOL8bpcGxqO8XYycHBICJhKT
	l85mhbDFJC7cW8/WxcjFISSwj1Gi79VVJghnA6NEa+9CKOckk8Tu99OgypYwSqxrWMIG0s8i
	oCpxrOk+M4jNJqAhsW3/ckYQW0RAUeL/txXsIDazgLTEt9/NTCC2sICLxKMDJ4B2c3DwCuhI
	TFgYBBIWErCSOL3rF9hIXgFBiZMzn7BAtGpJ3Pj3kgmkHGTM8n8cIGFOAWuJm0uWg5WLCqhI
	TDm5jW0Co9AsJN2zkHTPQuhewMi8ilE2JbdKNzcxM6c4NVm3ODkxLy+1SNdYLzezRC81pXQT
	IyioOSX5djB+Pah0iFGAg1GJh/ekBre/EGtiWXFl7iFGSQ4mJVFe5ygefyG+pPyUyozE4oz4
	otKc1OJDjBIczEoivKzWQDnelMTKqtSifJiUNAeLkjivmtY7PyGB9MSS1OzU1ILUIpisDAeH
	kgRvKMhQwaLU9NSKtMycEoQ0EwcnyHAeoOF/I0GGFxck5hZnpkPkTzEqSonzhoM0C4AkMkrz
	4HphSecVozjQK8K8x0OBqniACQuu+xXQYCagwaKi3CCDSxIRUlINjEkvd7C3N804waPE8+nF
	otM/M/Mvvl5Q+TV+8//fT26+tTor+/QK545f4kuYkq5dX210puCEp+98pojbLBsXrTli9LHx
	m8MsWWaT2rspv7VNl3+LOrFC7dzW5SrRZ6SFzyofcVogfve/R17BXCEtgY35Ry7kTNKc/XLq
	LGsxC/eHK05kNDqeT/dUYinOSDTUYi4qTgQASFR16xUDAAA=
Cc: notmuch@notmuchmail.org
X-BeenThere: notmuch@notmuchmail.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: "Use and development of the notmuch mail system."
	<notmuch.notmuchmail.org>
List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
	<mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
List-Archive: <http://notmuchmail.org/pipermail/notmuch>
List-Post: <mailto:notmuch@notmuchmail.org>
List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
	<mailto:notmuch-request@notmuchmail.org?subject=subscribe>
X-List-Received-Date: Tue, 10 Jan 2012 15:37:04 -0000

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")))