* vim front-end patches by Jason
@ 2011-07-11 5:40 Jason Woofenden
2011-07-11 5:40 ` [PATCH 1/5] vim: fix space key: now archives (did opposite) Jason Woofenden
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Jason Woofenden @ 2011-07-11 5:40 UTC (permalink / raw)
To: notmuch
OK, everybody, here's my first set of patches. They all cleanup the
vim front-end. I started with the little stuff, to get my feet wet.
Here's what's coming:
[PATCH 1/5] vim: fix space key: now archives (did opposite)
[PATCH 2/5] vim: fix from list reformatting in search view
[PATCH 3/5] vim: fix on-screen instructions for show-signature
[PATCH 4/5] vim: fix (hack) cig/cit parsing within multipart/*
[PATCH 5/5] vim: fix citation/signature fold lengths
The first three I've sent to the debian bug-tracking system I
think. Though I've since updated the second patch to not include
the change made by the first patch.
So... use these instead.
Or if you prefer git clone/remote, or online browsing, etc.,
you can see my work here:
https://gitorious.org/jasonwoof/notmuch
That's all for now. Feedback (as always) is welcome. Especially the
type that leads to me learning something and/or my patches getting
merged upstream.
Take care, - Jason
P.S. I've looked into the key [re]mapping and I think we can
implement the notmuch mappings without screwing up the users
mappings by using the <buffer> argument to :nmap. I'll experiment
with that later.
P.P.S. These, and all future changes I submit to this project are
of course available under the terms of the GPL, version 3 or at
your option any later version. Please let me know if you'd like me
to make this sort of statement in any particular way/place.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/5] vim: fix space key: now archives (did opposite)
2011-07-11 5:40 vim front-end patches by Jason Jason Woofenden
@ 2011-07-11 5:40 ` Jason Woofenden
2011-07-11 5:40 ` [PATCH 2/5] vim: fix from list reformatting in search view Jason Woofenden
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Jason Woofenden @ 2011-07-11 5:40 UTC (permalink / raw)
To: notmuch
In vim, in the message view, space is supposed to remove the "unread" and
"inbox" tags, but was sometimes adding them instead.
This patch assures that they are always removed by this binding.
---
vim/plugin/notmuch.vim | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim
index 768a011..d493580 100644
--- a/vim/plugin/notmuch.vim
+++ b/vim/plugin/notmuch.vim
@@ -596,7 +596,7 @@ function! s:NM_show_advance_marking_read_and_archiving()
let filter = <SID>NM_combine_tags('tag:', advance_tags, 'OR', '()')
\ + ['AND']
\ + <SID>NM_combine_tags('', ids, 'OR', '()')
- call map(advance_tags, '"+" . v:val')
+ call map(advance_tags, '"-" . v:val')
call <SID>NM_tag(filter, advance_tags)
call <SID>NM_show_next(1, 1)
return
--
1.7.5.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/5] vim: fix from list reformatting in search view
2011-07-11 5:40 vim front-end patches by Jason Jason Woofenden
2011-07-11 5:40 ` [PATCH 1/5] vim: fix space key: now archives (did opposite) Jason Woofenden
@ 2011-07-11 5:40 ` Jason Woofenden
2011-07-11 5:40 ` [PATCH 3/5] vim: fix on-screen instructions for show-signature Jason Woofenden
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Jason Woofenden @ 2011-07-11 5:40 UTC (permalink / raw)
To: notmuch
This patch rewrites the reformatting of the from list so it shows full
capitalized names when available (without truncating them as the old code did)
and removes the pipe characters that appear between some names.
The old code appears to assume from list (the list of senders in the thread)
coming from notmuch would be e-mail addresses, but in this version it is mostly
full names. Also in this version, the names are sometimes separated by pipe
instead of comma.
For consistency with old versions, names are still truncated at the first
period. Perhaps they shouldn't be though.
---
vim/plugin/notmuch.vim | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim
index d493580..e4b22d3 100644
--- a/vim/plugin/notmuch.vim
+++ b/vim/plugin/notmuch.vim
@@ -262,12 +262,12 @@ function! s:NM_cmd_search_fmtline(line)
return 'ERROR PARSING: ' . a:line
endif
let max = g:notmuch_search_from_column_width
- let flist = []
- for at in split(m[4], ", ")
- let p = min([stridx(at, "."), stridx(at, "@")])
- call insert(flist, tolower(at[0:p - 1]))
+ let flist = {}
+ for at in split(m[4], '[|,] ')
+ let p = split(at, '[@.]')
+ let flist[p[0]] = 1
endfor
- let from = join(flist, ", ")
+ let from = join(keys(flist), ", ")
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] 7+ messages in thread
* [PATCH 3/5] vim: fix on-screen instructions for show-signature
2011-07-11 5:40 vim front-end patches by Jason Jason Woofenden
2011-07-11 5:40 ` [PATCH 1/5] vim: fix space key: now archives (did opposite) Jason Woofenden
2011-07-11 5:40 ` [PATCH 2/5] vim: fix from list reformatting in search view Jason Woofenden
@ 2011-07-11 5:40 ` Jason Woofenden
2011-07-11 5:40 ` [PATCH 4/5] vim: fix (hack) cig/cit parsing within multipart/* Jason Woofenden
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Jason Woofenden @ 2011-07-11 5:40 UTC (permalink / raw)
To: notmuch
Also change a passed parameter to be consistent with the current binding. This
parameter appears to be unused.
---
vim/plugin/notmuch.vim | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim
index e4b22d3..3982008 100644
--- a/vim/plugin/notmuch.vim
+++ b/vim/plugin/notmuch.vim
@@ -149,7 +149,7 @@ let g:notmuch_show_maps = {
\ 'b': ':call <SID>NM_show_fold_toggle(''b'', ''bdy'', !g:notmuch_show_fold_bodies)<CR>',
\ 'c': ':call <SID>NM_show_fold_toggle(''c'', ''cit'', !g:notmuch_show_fold_citations)<CR>',
\ 'h': ':call <SID>NM_show_fold_toggle(''h'', ''hdr'', !g:notmuch_show_fold_headers)<CR>',
- \ 'i': ':call <SID>NM_show_fold_toggle(''s'', ''sig'', !g:notmuch_show_fold_signatures)<CR>',
+ \ 'i': ':call <SID>NM_show_fold_toggle(''i'', ''sig'', !g:notmuch_show_fold_signatures)<CR>',
\
\ 'I': ':call <SID>NM_show_mark_read_thread()<CR>',
\ 'a': ':call <SID>NM_show_archive_thread()<CR>',
@@ -757,7 +757,7 @@ function! s:NM_cmd_show_parse(inlines)
let mode_type = ''
elseif part_end
let foldinfo = [ mode_type, mode_start, outlnum-1, len(info['msgs']),
- \ printf('[ %d-line signature. Press "s" to show. ]', outlnum - mode_start) ]
+ \ printf('[ %d-line signature. Press "i" to show. ]', outlnum - mode_start) ]
let mode_type = ''
endif
endif
--
1.7.5.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/5] vim: fix (hack) cig/cit parsing within multipart/*
2011-07-11 5:40 vim front-end patches by Jason Jason Woofenden
` (2 preceding siblings ...)
2011-07-11 5:40 ` [PATCH 3/5] vim: fix on-screen instructions for show-signature Jason Woofenden
@ 2011-07-11 5:40 ` Jason Woofenden
2011-07-11 5:40 ` [PATCH 5/5] vim: fix citation/signature fold lengths Jason Woofenden
2011-07-16 19:07 ` vim front-end patches by Jason Felipe Contreras
5 siblings, 0 replies; 7+ messages in thread
From: Jason Woofenden @ 2011-07-11 5:40 UTC (permalink / raw)
To: notmuch
The vim front-end isn't written to handle nested parts.
This patch doesn't change that, it just changes the code to pretend that
multipart/* sections end immediately. This makes the parsing code think that
all sections are top-level, and are thus parsed well enough.
The lovely result of this is that citation folds and signature folds now work
in text/plain parts that are within multipart/* sections. Also, all mime
section starts are now shown correctly (before some were not parsed and showed
the ugly ^L and an ID and so on from notmuch.)
---
vim/plugin/notmuch.vim | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim
index 3982008..2095547 100644
--- a/vim/plugin/notmuch.vim
+++ b/vim/plugin/notmuch.vim
@@ -796,7 +796,14 @@ function! s:NM_cmd_show_parse(inlines)
endif
call add(info['disp'],
\ printf('--- %s ---', in_part))
- let part_start = len(info['disp']) + 1
+ " We don't yet handle nested parts, so pop
+ " multipart/* immediately so text/plain
+ " sub-parts are parsed properly
+ if match(in_part, '^multipart/') != -1
+ let in_part = ''
+ else
+ let part_start = len(info['disp']) + 1
+ endif
endif
elseif in_header
--
1.7.5.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/5] vim: fix citation/signature fold lengths
2011-07-11 5:40 vim front-end patches by Jason Jason Woofenden
` (3 preceding siblings ...)
2011-07-11 5:40 ` [PATCH 4/5] vim: fix (hack) cig/cit parsing within multipart/* Jason Woofenden
@ 2011-07-11 5:40 ` Jason Woofenden
2011-07-16 19:07 ` vim front-end patches by Jason Felipe Contreras
5 siblings, 0 replies; 7+ messages in thread
From: Jason Woofenden @ 2011-07-11 5:40 UTC (permalink / raw)
To: notmuch
Before they'd often miss the last line
---
vim/plugin/notmuch.vim | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim
index 2095547..12a0f88 100644
--- a/vim/plugin/notmuch.vim
+++ b/vim/plugin/notmuch.vim
@@ -747,8 +747,11 @@ function! s:NM_cmd_show_parse(inlines)
elseif mode_type == 'cit'
if part_end || match(line, g:notmuch_show_citation_regexp) == -1
let outlnum = len(info['disp'])
- let foldinfo = [ mode_type, mode_start, outlnum-1, len(info['msgs']),
- \ printf('[ %d-line citation. Press "c" to show. ]', outlnum - mode_start) ]
+ if !part_end
+ let outlnum = outlnum - 1
+ endif
+ let foldinfo = [ mode_type, mode_start, outlnum, len(info['msgs']),
+ \ printf('[ %d-line citation. Press "c" to show. ]', 1 + outlnum - mode_start) ]
let mode_type = ''
endif
elseif mode_type == 'sig'
@@ -756,8 +759,8 @@ function! s:NM_cmd_show_parse(inlines)
if (outlnum - mode_start) > g:notmuch_show_signature_lines_max
let mode_type = ''
elseif part_end
- let foldinfo = [ mode_type, mode_start, outlnum-1, len(info['msgs']),
- \ printf('[ %d-line signature. Press "i" to show. ]', outlnum - mode_start) ]
+ let foldinfo = [ mode_type, mode_start, outlnum, len(info['msgs']),
+ \ printf('[ %d-line signature. Press "i" to show. ]', 1 + outlnum - mode_start) ]
let mode_type = ''
endif
endif
--
1.7.5.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: vim front-end patches by Jason
2011-07-11 5:40 vim front-end patches by Jason Jason Woofenden
` (4 preceding siblings ...)
2011-07-11 5:40 ` [PATCH 5/5] vim: fix citation/signature fold lengths Jason Woofenden
@ 2011-07-16 19:07 ` Felipe Contreras
5 siblings, 0 replies; 7+ messages in thread
From: Felipe Contreras @ 2011-07-16 19:07 UTC (permalink / raw)
To: Jason Woofenden; +Cc: notmuch
On Mon, Jul 11, 2011 at 8:40 AM, Jason Woofenden <jason@jasonwoof.com> wrote:
> OK, everybody, here's my first set of patches. They all cleanup the
> vim front-end. I started with the little stuff, to get my feet wet.
>
> Here's what's coming:
>
> [PATCH 1/5] vim: fix space key: now archives (did opposite)
> [PATCH 2/5] vim: fix from list reformatting in search view
> [PATCH 3/5] vim: fix on-screen instructions for show-signature
> [PATCH 4/5] vim: fix (hack) cig/cit parsing within multipart/*
> [PATCH 5/5] vim: fix citation/signature fold lengths
>
> The first three I've sent to the debian bug-tracking system I
> think. Though I've since updated the second patch to not include
> the change made by the first patch.
>
> So... use these instead.
Thanks. I was fetching the patches from there, but I threw them away,
as these are in a much better format :)
> That's all for now. Feedback (as always) is welcome. Especially the
> type that leads to me learning something and/or my patches getting
> merged upstream.
They all look fine to me, but I'm not a vim expert =/
Since nobody complained, and they seem to work for me. I've applied
them. Thanks!
Cheers.
--
Felipe Contreras
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-07-16 19:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-11 5:40 vim front-end patches by Jason Jason Woofenden
2011-07-11 5:40 ` [PATCH 1/5] vim: fix space key: now archives (did opposite) Jason Woofenden
2011-07-11 5:40 ` [PATCH 2/5] vim: fix from list reformatting in search view Jason Woofenden
2011-07-11 5:40 ` [PATCH 3/5] vim: fix on-screen instructions for show-signature Jason Woofenden
2011-07-11 5:40 ` [PATCH 4/5] vim: fix (hack) cig/cit parsing within multipart/* Jason Woofenden
2011-07-11 5:40 ` [PATCH 5/5] vim: fix citation/signature fold lengths Jason Woofenden
2011-07-16 19:07 ` vim front-end patches by Jason 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).