problem with notmuch-search-authors-width in JSON emacs implementation
jrollins at finestructure.net
Wed Apr 21 21:37:25 PDT 2010
On Wed, 21 Apr 2010 19:09:35 -0400, Jameson Rollins <jrollins at finestructure.net> 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
> (setq notmuch-search-authors-width 40)
> 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
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-authors-width))
emacs/notmuch.el:626: (if (> authors-length notmuch-search-authors-width)
emacs/notmuch.el:627: (set 'authors (concat (substring authors 0 (- notmuch-search-authors-width 3)) "...")))
0 servo:~/src/notmuch/git [master] $
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 835 bytes
Desc: not available
More information about the notmuch