]> git.notmuchmail.org Git - notmuch/blobdiff - vim/plugin/notmuch.vim
nmbug: move from contrib to devel
[notmuch] / vim / plugin / notmuch.vim
index 44108273762b2e62c1eb07dfd167664ee13a4718..8f27fb9273d2efb124c6de8f27cd8ceeaee23deb 100644 (file)
@@ -48,7 +48,7 @@ let s:notmuch_defaults = {
         \ 'g:notmuch_show_part_end_regexp':          '\fpart}'                   ,
         \ 'g:notmuch_show_marker_regexp':            '\f\\(message\\|header\\|body\\|attachment\\|part\\)[{}].*$',
         \
-        \ 'g:notmuch_show_message_parse_regexp':     '\(id:[^ ]*\) depth:\([0-9]*\) match:\([0-9]*\) filename:\(.*\)$',
+        \ 'g:notmuch_show_message_parse_regexp':     '\(id:[^ ]*\) depth:\([0-9]*\) match:\([0-9]*\) excluded:\([0-9]*\) filename:\(.*\)$',
         \ 'g:notmuch_show_tags_regexp':              '(\([^)]*\))$'               ,
         \
         \ 'g:notmuch_show_signature_regexp':         '^\(-- \?\|_\+\)$'           ,
@@ -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>',
@@ -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
 
@@ -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
@@ -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 "s" 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
@@ -796,7 +799,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
@@ -860,7 +870,8 @@ function! s:NM_cmd_show_parse(inlines)
                                         let msg['id'] = m[1]
                                         let msg['depth'] = m[2]
                                         let msg['match'] = m[3]
-                                        let msg['filename'] = m[4]
+                                        let msg['excluded'] = m[4]
+                                        let msg['filename'] = m[5]
                                 endif
 
                                 let in_message = 1