Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 6B14A4196F2 for ; Wed, 21 Apr 2010 21:37:37 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.89 X-Spam-Level: X-Spam-Status: No, score=-1.89 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, T_MIME_NO_TEXT=0.01] autolearn=ham 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 c5WglwQcitXU for ; Wed, 21 Apr 2010 21:37:36 -0700 (PDT) Received: from tarap.cc.columbia.edu (tarap.cc.columbia.edu [128.59.29.7]) by olra.theworths.org (Postfix) with ESMTP id 3C3C7431FC1 for ; Wed, 21 Apr 2010 21:37:36 -0700 (PDT) Received: from servo.finestructure.net (cpe-72-227-128-66.nyc.res.rr.com [72.227.128.66]) (user=jgr2110 author=jrollins@finestructure.net mech=PLAIN bits=0) by tarap.cc.columbia.edu (8.14.3/8.14.3) with ESMTP id o3M4bTIM026373 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 22 Apr 2010 00:37:30 -0400 (EDT) Received: from jrollins by servo.finestructure.net with local (Exim 4.71) (envelope-from ) id 1O4oAK-0001lD-TZ for notmuch@notmuchmail.org; Thu, 22 Apr 2010 00:37:29 -0400 From: Jameson Rollins To: Notmuch Mail Subject: Re: problem with notmuch-search-authors-width in JSON emacs implementation In-Reply-To: <87633ko11s.fsf@servo.finestructure.net> References: <87633ko11s.fsf@servo.finestructure.net> Date: Thu, 22 Apr 2010 00:37:25 -0400 Message-ID: <878w8gxfui.fsf@servo.finestructure.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-No-Spam-Score: Local X-Scanned-By: MIMEDefang 2.68 on 128.59.29.7 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2010 04:37:37 -0000 --=-=-= Content-Transfer-Encoding: quoted-printable On Wed, 21 Apr 2010 19:09:35 -0400, Jameson Rollins wrote: > Hey, folks. I just build from Carl's HEAD which includes the new emacs > JSON interface and I'm noticing a problem with the > notmuch-search-authors-width variable. If I set the variable as > follows: >=20 > (setq notmuch-search-authors-width 40) >=20 > author lists that overrun the specified width start spitting out into > the subject field. I think bremner just confirmed this on irc. I'll > try to look into this when I get a chance, but I don't have time right > now. Maybe someone with more intimate knowledge of this piece of code > could figure it out more quickly. So I think I see what might be happening here, but I don't know elisp well enough to fix it. Maybe one of the elisp experts out there can help me figure it out. notmuch-search-authors-width is actually called three times in notmuch.el: 0 servo:~/src/notmuch/git [master] $ grep -nH notmuch-search-authors-width = emacs/* emacs/notmuch.el:57:(defcustom notmuch-search-authors-width 20 emacs/notmuch.el:65: ("authors" . ,(format "%%-%ds " notmuch-search-auth= ors-width)) emacs/notmuch.el:626: (if (> authors-length notmuch-search-authors-w= idth) emacs/notmuch.el:627: (set 'authors (concat (substring authors 0 (- not= much-search-authors-width 3)) "..."))) 0 servo:~/src/notmuch/git [master] $=20 The first call is inside the defcustom definition for notmuch-search-result-format. The second two are in the notmuch-search-process-filter function. It's pretty clear from the behavior that setting notmuch-search-authors-width, either with setq or with "Customize Options", affects what is returned in notmuch-search-process-filter, but *not* in the defcustom for notmuch-search-result-format. I guess what's happening is that the value used in the defcustom definition of notmuch-search-result-format is set when the defcustom is defined, and isn't changed later with the new user-set value. Do any elisp experts out there know any way out of this? Is there a way to escape the expansion of the variable used in notmuch-search-result-format until it is actually called? I guess we're using notmuch-search-authors-width to "nicely" truncate the author list and add the "..." at the end. We could just straight truncate the authors field with something like '%-.40s', I think, which would make the code a little simpler, but might not be as nice. jamie. --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAEBCAAGBQJLz9KFAAoJEO00zqvie6q8RA8QAIglvTm67b8P5PpSWT15w3zv DkXNkE1IaW1M27DHZ2ooDsIPV8+iVYsyFDir85b+kXjQw6yURtwjOyqv6b0C13xp XJ0a8h3iE8A1mYptM7SVUT/yJ2Lx5MZ6e+7vp/Dw2nwk8o3F+BZP/6CY8nAdrBar tMiTWAU0wvNGeLrd9kp7IntOfaO/Tq0ksVUq6djhO44YwH4KdMdRWZ+crdavt0sj f5BKM042+BoSHW804Aob8dDWCDEQ7cEhGbOwvEVmdNHcq/eUtjX7QXp47QsJznJV cyj2pb6ZssN4Ve1btuZNi/CLRvr8nqgK8dkvvZJ/ZOirNPWtkxJV7j/RZAumr2xZ Xu7yZsXClwdyBmNVXtWnE/raXhPlmdwM0w6/kxq0sZKj2zTcU4dngryQPQpnxn2s VH5+DC4pD8YXi85fQupDD+QDmL2l5NblAVRPeacPv4VaEkrFU3cQRV1h8m49mvKZ zoSwFmmNDsh1Em8G4pzM0Qo9ezikgmZOvSWjl3FuQmei7xbtnlRofkGiS5K4wUdk eLM4U0SfdKpfbiU0Sj8qErI/eoSI3zGwyAIYXPfxu6NZyVUAwHFffW5TEohk6doi azD3VBRbwuLKdHfDk2BYGqC9Tm7vZrM/7o7wNd7MQHgwI+wx0Tck5e6oBahpgKvL Ffn9cpotBbdDKfbMwzTf =5Y5J -----END PGP SIGNATURE----- --=-=-=--