unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jameson Rollins <jrollins@finestructure.net>
To: Notmuch Mail <notmuch@notmuchmail.org>
Subject: Re: problem with notmuch-search-authors-width in JSON emacs implementation
Date: Thu, 22 Apr 2010 00:37:25 -0400	[thread overview]
Message-ID: <878w8gxfui.fsf@servo.finestructure.net> (raw)
In-Reply-To: <87633ko11s.fsf@servo.finestructure.net>

[-- Attachment #1: Type: text/plain, Size: 2484 bytes --]

On Wed, 21 Apr 2010 19:09:35 -0400, Jameson Rollins <jrollins@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
> follows:
> 
> (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
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-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.

jamie.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

  parent reply	other threads:[~2010-04-22  4:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-21 23:09 problem with notmuch-search-authors-width in JSON emacs implementation Jameson Rollins
2010-04-21 23:23 ` Dirk Hohndel
2010-04-22  4:37 ` Jameson Rollins [this message]
2010-04-22  7:52   ` David Edmondson
2010-04-22 13:22     ` Jameson Rollins
2010-04-22 14:04       ` David Edmondson
2010-04-22 14:12         ` Jameson Rollins
2010-04-22 14:38           ` David Edmondson
2010-04-22 15:20             ` Jameson Rollins
2010-04-22 16:44               ` David Edmondson
2010-04-23 10:24                 ` [PATCH] emacs: Remove `notmuch-search-authors-width' and fix the use of `notmuch-search-result-format' accordingly David Edmondson
2010-04-23 17:22                   ` Jameson Rollins
2010-04-23 19:17                     ` Carl Worth
2010-04-26 12:16                   ` [PATCH] emacs: Fix `notmuch-search-insert-field' David Edmondson
2010-04-26 15:25                     ` Carl Worth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878w8gxfui.fsf@servo.finestructure.net \
    --to=jrollins@finestructure.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).