unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] Feature request: nicknames for senders
@ 2011-07-11 18:37 Jason Woofenden
  2011-07-11 18:37 ` [PATCH] vim: add setting to shorten/fix sender names Jason Woofenden
  2011-07-16 19:15 ` [PATCH] Feature request: nicknames for senders Felipe Contreras
  0 siblings, 2 replies; 3+ messages in thread
From: Jason Woofenden @ 2011-07-11 18:37 UTC (permalink / raw)
  To: notmuch

I implemented a feature I wanted: nicknames for the list of senders
on the search view.

At first I just added a setting with my full name and had it
replace that with "me". But then I figured it'd be better to allow
the user to specify a list of replacements, and instead made a more
general "nicknames" list.

Then I made myself a nice long dictionary to shorten the names of
folks I communicate with regularly. Mostly reducing them to first
names. Now it's much more common that I can see all the senders in
the narrow senders column.


Thoughts?


       -- Jason

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] vim: add setting to shorten/fix sender names
  2011-07-11 18:37 [PATCH] Feature request: nicknames for senders Jason Woofenden
@ 2011-07-11 18:37 ` Jason Woofenden
  2011-07-16 19:15 ` [PATCH] Feature request: nicknames for senders Felipe Contreras
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Woofenden @ 2011-07-11 18:37 UTC (permalink / raw)
  To: notmuch

Add a new setting: g:notmuch_nicknames (dictionary)

When reformatting the list of senders in the search view, replace any names
matching keys in g:notmuch_nicknames with the corresponding values.
---
 vim/plugin/notmuch.vim |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim
index 12a0f88..5debaf6 100644
--- a/vim/plugin/notmuch.vim
+++ b/vim/plugin/notmuch.vim
@@ -103,6 +103,10 @@ let s:notmuch_compose_headers_defaults = [
         \ 'Subject'
         \ ]
 
+" To shorten/change the sender names in the search views:
+" let g:notmuch_nicknames = {'John Smith': 'me', 'Jane Smith': 'Jane'}
+
+
 " --- keyboard mapping definitions {{{1
 
 " --- --- bindings for folders mode {{{2
@@ -267,7 +271,20 @@ function! s:NM_cmd_search_fmtline(line)
                 let p = split(at, '[@.]')
                 let flist[p[0]] = 1
         endfor
-        let from = join(keys(flist), ", ")
+        if exists('g:notmuch_nicknames')
+                let from_fixed = []
+                for at in keys(flist)
+                        if has_key(g:notmuch_nicknames, at)
+                                call add(from_fixed, g:notmuch_nicknames[at])
+                        else
+                                call add(from_fixed, at)
+                        endif
+                endfor
+                let from = join(from_fixed, ', ')
+        else
+                let from = join(keys(flist), ', ')
+        endif
+
         return printf("%-12s %3s %-20.20s | %s (%s)", m[2], m[3], from, m[5], m[6])
 endfunction
 
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Feature request: nicknames for senders
  2011-07-11 18:37 [PATCH] Feature request: nicknames for senders Jason Woofenden
  2011-07-11 18:37 ` [PATCH] vim: add setting to shorten/fix sender names Jason Woofenden
@ 2011-07-16 19:15 ` Felipe Contreras
  1 sibling, 0 replies; 3+ messages in thread
From: Felipe Contreras @ 2011-07-16 19:15 UTC (permalink / raw)
  To: Jason Woofenden; +Cc: notmuch

On Mon, Jul 11, 2011 at 9:37 PM, Jason Woofenden <jason@jasonwoof.com> wrote:
> I implemented a feature I wanted: nicknames for the list of senders
> on the search view.
>
> At first I just added a setting with my full name and had it
> replace that with "me". But then I figured it'd be better to allow
> the user to specify a list of replacements, and instead made a more
> general "nicknames" list.
>
> Then I made myself a nice long dictionary to shorten the names of
> folks I communicate with regularly. Mostly reducing them to first
> names. Now it's much more common that I can see all the senders in
> the narrow senders column.
>
>
> Thoughts?

Personally I would like an already known format for these. For example
git fetches them from different places, like mutt aliases list.

And I wonder why this is not part of notmuch core. You could then tell
notmuch to compose a message, and specify an alias instead of a full
address. This can be used in many ways.

But yeah, I'm eager to get something like this :)

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-07-16 19:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-11 18:37 [PATCH] Feature request: nicknames for senders Jason Woofenden
2011-07-11 18:37 ` [PATCH] vim: add setting to shorten/fix sender names Jason Woofenden
2011-07-16 19:15 ` [PATCH] Feature request: nicknames for senders Felipe Contreras

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