]> git.notmuchmail.org Git - notmuch/commitdiff
vim: fix (hack) cig/cit parsing within multipart/*
authorJason Woofenden <jason@jasonwoof.com>
Mon, 11 Jul 2011 05:40:09 +0000 (01:40 -0400)
committerFelipe Contreras <felipe.contreras@gmail.com>
Sat, 16 Jul 2011 18:57:38 +0000 (21:57 +0300)
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.)

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
vim/plugin/notmuch.vim

index 4ad992beab607a559b0548ae2f73610ec82147db..f29dff1c1b995e11f43e9c3f819c73ddd3a311f0 100644 (file)
@@ -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