unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 0/9] vim improvements
@ 2010-06-05 11:12 Felipe Contreras
  2010-06-05 11:12 ` [PATCH 1/9] thread: really clean authors Felipe Contreras
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: Felipe Contreras @ 2010-06-05 11:12 UTC (permalink / raw
  To: notmuch; +Cc: Bart Trojanowski

These are a bunch of fixes and improvements that make the vim plugin usable to
me, I guess other people will agree :)

The only controversial one is the really aggressive author cleanup. I guess the
really ideal thing would be to pass the full author "Foo Bar
 <foo.bar@mail.com>", and let UI's deal with the format (possibly configurable
by the user). But for now, I decided to push whatever I found more usable.

Cheers.

Felipe Contreras (9):
  thread: really clean authors
  vim: add archive support from 'show'
  vim: cleanup search buffer
  vim: cleanup search syntax
  vim: remove add_remove_tags_on_screen()
  vim: add option to mark as read + archive
  vim: use mailx for sending
  vim: run(): optimize non-debug path
  vim: include own improved git-diff syntax

 lib/thread.cc                   |   38 ++-----------
 vim/README                      |    9 +--
 vim/plugin/notmuch.vim          |  119 ++++++++++-----------------------------
 vim/syntax/notmuch-git-diff.vim |   26 +++++++++
 vim/syntax/notmuch-search.vim   |   36 ++++--------
 vim/syntax/notmuch-show.vim     |    3 +-
 6 files changed, 75 insertions(+), 156 deletions(-)
 create mode 100644 vim/syntax/notmuch-git-diff.vim

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

* [PATCH 1/9] thread: really clean authors
  2010-06-05 11:12 [PATCH 0/9] vim improvements Felipe Contreras
@ 2010-06-05 11:12 ` Felipe Contreras
  2010-06-05 11:12 ` [PATCH 2/9] vim: add archive support from 'show' Felipe Contreras
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Felipe Contreras @ 2010-06-05 11:12 UTC (permalink / raw
  To: notmuch; +Cc: Bart Trojanowski

To show the thread, usually 'foo' is enough from "Foo Bar
 <foo.bar@mail.com>", specially since the authors field is too small
anyway.

Gmail does something similar: "Foo (2), John (3)".

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 lib/thread.cc |   38 +++++---------------------------------
 1 files changed, 5 insertions(+), 33 deletions(-)

diff --git a/lib/thread.cc b/lib/thread.cc
index 13872d4..6a445b5 100644
--- a/lib/thread.cc
+++ b/lib/thread.cc
@@ -151,44 +151,16 @@ char *
 _thread_cleanup_author (notmuch_thread_t *thread,
 			const char *author, const char *from)
 {
-    char *clean_author,*test_author;
-    const char *comma;
-    char *blank;
-    int fname,lname;
+    char *clean_author;
+    const char *begin,*end;
 
     if (author == NULL)
 	return NULL;
-    clean_author = talloc_strdup(thread, author);
+    begin = strchr (from, '<') + 1;
+    end = strchr (begin, '>');
+    clean_author = talloc_strndup (thread, begin, end - begin);
     if (clean_author == NULL)
 	return NULL;
-    /* check if there's a comma in the name and that there's a
-     * component of the name behind it (so the name doesn't end with
-     * the comma - in which case the string that strchr finds is just
-     * one character long ",\0").
-     * Otherwise just return the copy of the original author name that
-     * we just made*/
-    comma = strchr(author,',');
-    if (comma && strlen(comma) > 1) {
-	/* let's assemble what we think is the correct name */
-	lname = comma - author;
-	fname = strlen(author) - lname - 2;
-	strncpy(clean_author, comma + 2, fname);
-	*(clean_author+fname) = ' ';
-	strncpy(clean_author + fname + 1, author, lname);
-	*(clean_author+fname+1+lname) = '\0';
-	/* make a temporary copy and see if it matches the email */
-	test_author = talloc_strdup(thread,clean_author);
-
-	blank=strchr(test_author,' ');
-	while (blank != NULL) {
-	    *blank = '.';
-	    blank=strchr(test_author,' ');
-	}
-	if (strcasestr(from, test_author) == NULL)
-	    /* we didn't identify this as part of the email address
-	    * so let's punt and return the original author */
-	    strcpy (clean_author, author);
-    }
     return clean_author;
 }
 
-- 
1.7.1

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

* [PATCH 2/9] vim: add archive support from 'show'
  2010-06-05 11:12 [PATCH 0/9] vim improvements Felipe Contreras
  2010-06-05 11:12 ` [PATCH 1/9] thread: really clean authors Felipe Contreras
@ 2010-06-05 11:12 ` Felipe Contreras
  2010-06-05 11:12 ` [PATCH 3/9] vim: cleanup search buffer Felipe Contreras
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Felipe Contreras @ 2010-06-05 11:12 UTC (permalink / raw
  To: notmuch; +Cc: Bart Trojanowski

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/plugin/notmuch.vim |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim
index a9754f2..3a19616 100644
--- a/vim/plugin/notmuch.vim
+++ b/vim/plugin/notmuch.vim
@@ -496,7 +496,8 @@ function! s:NM_show_archive_thread()
 endfunction
 
 function! s:NM_show_mark_read_then_archive_thread()
-        echo 'not implemented'
+        call <SID>NM_add_remove_tags(b:nm_search_words, '-', ['unread', 'inbox'])
+        call <SID>NM_show_next_thread()
 endfunction
 
 function! s:NM_show_mark_read_then_next_open_message()
-- 
1.7.1

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

* [PATCH 3/9] vim: cleanup search buffer
  2010-06-05 11:12 [PATCH 0/9] vim improvements Felipe Contreras
  2010-06-05 11:12 ` [PATCH 1/9] thread: really clean authors Felipe Contreras
  2010-06-05 11:12 ` [PATCH 2/9] vim: add archive support from 'show' Felipe Contreras
@ 2010-06-05 11:12 ` Felipe Contreras
  2010-06-05 11:12 ` [PATCH 4/9] vim: cleanup search syntax Felipe Contreras
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Felipe Contreras @ 2010-06-05 11:12 UTC (permalink / raw
  To: notmuch; +Cc: Bart Trojanowski

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/plugin/notmuch.vim |   19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim
index 3a19616..b8c9858 100644
--- a/vim/plugin/notmuch.vim
+++ b/vim/plugin/notmuch.vim
@@ -243,26 +243,23 @@ function! s:NM_cmd_search(words)
         let b:nm_raw_lines = lines
         let b:nm_search_words = a:words
 
-        call <SID>NM_cmd_search_mksyntax()
         call <SID>NM_set_map('n', g:notmuch_search_maps)
         setlocal cursorline
         setlocal nowrap
 endfunction
 function! s:NM_cmd_search_fmtline(line)
-        let m = matchlist(a:line, '^\(thread:\S\+\)\s\([^]]\+\]\) \([^;]\+\); \(.*\) (\([^(]*\))$')
+        let m = matchlist(a:line, '^\(thread:\S\+\)\s\(.\{12\}\) \[\(\d\+\)/\d\+\] \([^;]\+\); \%(\[[^\[]\+\] \)*\(.*\) (\([^(]*\))$')
         if !len(m)
                 return 'ERROR PARSING: ' . a:line
         endif
         let max = g:notmuch_search_from_column_width
-        let from = m[3]
-        if strlen(from) >= max
-                let from = substitute(m[3][0:max-4], '[^A-Za-z1-9_]*$', '', '') . '...'
-        endif
-        return printf('%-20s %-20s | %s (%s)', m[2], from, m[4], m[5])
-endfunction
-function! s:NM_cmd_search_mksyntax()
-        syntax clear nmSearchFrom
-        exec printf('syntax match nmSearchFrom /\(\] \)\@<=.\{%d\}/ oneline contained', 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]))
+        endfor
+        let from = join(flist, ", ")
+        return printf("%-12s %3s %-20.20s | %s (%s)", m[2], m[3], from, m[5], m[6])
 endfunction
 
 " --- --- search screen action functions {{{2
-- 
1.7.1

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

* [PATCH 4/9] vim: cleanup search syntax
  2010-06-05 11:12 [PATCH 0/9] vim improvements Felipe Contreras
                   ` (2 preceding siblings ...)
  2010-06-05 11:12 ` [PATCH 3/9] vim: cleanup search buffer Felipe Contreras
@ 2010-06-05 11:12 ` Felipe Contreras
  2010-06-05 11:12 ` [PATCH 5/9] vim: remove add_remove_tags_on_screen() Felipe Contreras
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Felipe Contreras @ 2010-06-05 11:12 UTC (permalink / raw
  To: notmuch; +Cc: Bart Trojanowski

It was *sloooooow*.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/syntax/notmuch-search.vim |   36 ++++++++++++------------------------
 1 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/vim/syntax/notmuch-search.vim b/vim/syntax/notmuch-search.vim
index 71839fd..f458d77 100644
--- a/vim/syntax/notmuch-search.vim
+++ b/vim/syntax/notmuch-search.vim
@@ -1,24 +1,12 @@
-" notmuch search mode syntax file
-
-" TODO: I cannot figure out why nmSearchTags is not matching anything :(
-
-syntax region nmSearchDate      start='^' end='\%13v'      oneline
-syntax region nmSearchCountAndFrom start='\%14v\[' end='|' oneline contains=nmSearchCount,nmSearchFrom
-syntax region nmSearchCount     start='\[' end='\]'        oneline contained contains=nmSearchCountZero,nmSearchCountSome,nmSearchCountAll
-syntax region nmSearchFrom      start='\]\@<=' end='|'     oneline contained
-syntax match  nmSearchCountZero '0/\(\d\+\)'               contained
-syntax match  nmSearchCountSome '\([1-9]\d*\)/\(\d\+\)'    contained
-syntax match  nmSearchCountAll  '\(\d\+\)/\1'              contained
-syntax match  nmSearchSquareBracketText '\(\[\w\+\]\)'
-syntax match  nmSearchTags      /([^)]\+)$/
-
-highlight link nmSearchDate      Statement
-"highlight link nmSearchCount     Comment
-highlight link nmSearchCountZero Function
-highlight link nmSearchCountSome Special
-highlight link nmSearchCountAll  Type
-highlight link nmSearchFrom      Include
-highlight link nmSearchSquareBracketText Special
-highlight link nmSearchTags      String
-
-highlight CursorLine term=reverse cterm=reverse gui=reverse
+syntax region nmSearch		start=/^/ end=/$/		oneline contains=nmSearchDate
+syntax match nmSearchDate	/^.\{-13}/			contained nextgroup=nmSearchNum
+syntax match nmSearchNum	/.\{-4}/			contained nextgroup=nmSearchFrom
+syntax match nmSearchFrom	/.\{-21}/			contained nextgroup=nmSearchSubject
+syntax match nmSearchSubject	/.\{0,}\(([^()]\+)$\)\@=/	contained nextgroup=nmSearchTags
+syntax match nmSearchTags	/.\+$/				contained
+
+highlight link nmSearchDate	Statement
+highlight link nmSearchNum	Type
+highlight link nmSearchFrom	Include
+highlight link nmSearchSubject	Normal
+highlight link nmSearchTags	String
-- 
1.7.1

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

* [PATCH 5/9] vim: remove add_remove_tags_on_screen()
  2010-06-05 11:12 [PATCH 0/9] vim improvements Felipe Contreras
                   ` (3 preceding siblings ...)
  2010-06-05 11:12 ` [PATCH 4/9] vim: cleanup search syntax Felipe Contreras
@ 2010-06-05 11:12 ` Felipe Contreras
  2010-06-05 11:12 ` [PATCH 6/9] vim: add option to mark as read + archive Felipe Contreras
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Felipe Contreras @ 2010-06-05 11:12 UTC (permalink / raw
  To: notmuch; +Cc: Bart Trojanowski

It's not working properly; the current message is jumping around and the
tags not really added/removed properly.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/plugin/notmuch.vim |   17 -----------------
 1 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim
index b8c9858..01ee10f 100644
--- a/vim/plugin/notmuch.vim
+++ b/vim/plugin/notmuch.vim
@@ -306,7 +306,6 @@ function! s:NM_search_edit()
 endfunction
 
 function! s:NM_search_archive_thread()
-        call <SID>NM_add_remove_tags_on_screen('', '-', ['inbox'])
         call <SID>NM_add_remove_tags([], '-', ['inbox'])
         norm j
 endfunction
@@ -399,7 +398,6 @@ function! s:NM_search_add_remove_tags(prompt, prefix, intags)
                 let tags = a:intags
         endif
         call <SID>NM_add_remove_tags([], a:prefix, tags)
-        call <SID>NM_add_remove_tags_on_screen('', a:prefix, tags)
 endfunction
 
 " --- implement show screen {{{1
@@ -569,7 +567,6 @@ function! s:NM_show_advance_marking_read_and_archiving()
 
         " if entire message fits on the screen, read/archive it, move to the next one
         if msg_top['id'] != msg_bot['id'] || msg_top['end'] <= vis_bot
-                call <SID>NM_add_remove_tags_on_screen(msg_top['start'], '-', advance_tags)
                 exec printf('norm %dG', vis_top)
                 call <SID>NM_show_next(0, 1)
                 if has_key(msg_top,'match') && msg_top['match'] != '0'
@@ -1325,20 +1322,6 @@ function! s:NM_add_remove_tags(filter, prefix, tags)
         call <SID>NM_run(args)
 endfunction
 
-function! s:NM_add_remove_tags_on_screen(online, prefix, tags)
-        setlocal modifiable
-        if a:prefix == '-'
-                for tagname in a:tags
-                        exec printf('silent! %ss/(\([^)]*\)\<%s\>\([^)]*\))$/(\1\2)/', string(a:online), tagname)
-                endfor
-        else
-                for tagname in a:tags
-                        exec printf('silent! %ss/(\([^)]*\))$/(\1 %s)/', string(a:online), tagname)
-                endfor
-        endif
-        setlocal nomodifiable
-endfunction
-
 " --- process and set the defaults {{{1
 
 function! NM_set_defaults(force)
-- 
1.7.1

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

* [PATCH 6/9] vim: add option to mark as read + archive
  2010-06-05 11:12 [PATCH 0/9] vim improvements Felipe Contreras
                   ` (4 preceding siblings ...)
  2010-06-05 11:12 ` [PATCH 5/9] vim: remove add_remove_tags_on_screen() Felipe Contreras
@ 2010-06-05 11:12 ` Felipe Contreras
  2010-06-05 11:12 ` [PATCH 7/9] vim: use mailx for sending Felipe Contreras
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Felipe Contreras @ 2010-06-05 11:12 UTC (permalink / raw
  To: notmuch; +Cc: Bart Trojanowski

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/plugin/notmuch.vim |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim
index 01ee10f..968c4c1 100644
--- a/vim/plugin/notmuch.vim
+++ b/vim/plugin/notmuch.vim
@@ -118,6 +118,7 @@ let g:notmuch_search_maps = {
         \ '<Enter>':    ':call <SID>NM_search_show_thread(1)<CR>',
         \ '<C-]>':      ':call <SID>NM_search_expand(''<cword>'')<CR>',
         \ 'a':          ':call <SID>NM_search_archive_thread()<CR>',
+        \ 'A':          ':call <SID>NM_search_mark_read_then_archive_thread()<CR>',
         \ 'f':          ':call <SID>NM_search_filter()<CR>',
         \ 'm':          ':call <SID>NM_new_mail()<CR>',
         \ 'o':          ':call <SID>NM_search_toggle_order()<CR>',
@@ -310,6 +311,11 @@ function! s:NM_search_archive_thread()
         norm j
 endfunction
 
+function! s:NM_search_mark_read_then_archive_thread()
+        call <SID>NM_add_remove_tags([], '-', ['unread', 'inbox'])
+        norm j
+endfunction
+
 function! s:NM_search_filter()
         call <SID>NM_search_filter_helper('Filter: ', '', '')
 endfunction
-- 
1.7.1

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

* [PATCH 7/9] vim: use mailx for sending
  2010-06-05 11:12 [PATCH 0/9] vim improvements Felipe Contreras
                   ` (5 preceding siblings ...)
  2010-06-05 11:12 ` [PATCH 6/9] vim: add option to mark as read + archive Felipe Contreras
@ 2010-06-05 11:12 ` Felipe Contreras
  2010-06-16 18:28   ` Felipe Contreras
  2010-06-05 11:12 ` [PATCH 8/9] vim: run(): optimize non-debug path Felipe Contreras
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 13+ messages in thread
From: Felipe Contreras @ 2010-06-05 11:12 UTC (permalink / raw
  To: notmuch; +Cc: Bart Trojanowski

Possilby used by more systems, and besides the code wasn't really
working properly anyway.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/README             |    4 +-
 vim/plugin/notmuch.vim |   61 ++++--------------------------------------------
 2 files changed, 7 insertions(+), 58 deletions(-)

diff --git a/vim/README b/vim/README
index 8cd3b1a..0807166 100644
--- a/vim/README
+++ b/vim/README
@@ -7,8 +7,8 @@ Dependencies:
     notmuch:
         Naturally, it expects you have notmuch installed and configured.
 
-    mail:
-        To send mail, notmuch.vim uses the UNIX mail command.
+    mailx:
+        To send mail, notmuch.vim uses the UNIX mailx command.
 
     git-diff:
         The vim interface makes use of the git-diff.vim syntax file
diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim
index 968c4c1..7b49015 100644
--- a/vim/plugin/notmuch.vim
+++ b/vim/plugin/notmuch.vim
@@ -941,71 +941,20 @@ function! s:NM_compose_send()
         let fname = expand('%')
         let lnum = 1
         let line = getline(lnum)
-        let hdrs = {}
         let lst_hdr = ''
         while match(line, '^$') == -1
-                if match(line, '^Notmuch-Help:') != -1
-                        " skip it
-                elseif strlen(lst_hdr) && match(line, '^\s') != -1
-                        let hdrs[lst_hdr][-1] = hdrs[lst_hdr][-1] . substitute(line, '^\s*', ' ', '')
-                else
-                        let m = matchlist(line, '^\(\w[^:]*\):\s*\(.*\)\s*$')
-                        if !len(m)
-                                cursor(lnum, 0)
-                                throw printf('Eeek! invalid header on line %d', lnum)
-                        endif
-                        let key = substitute(m[1], '\<\w', '\U&', 'g')
-                        if strlen(m[2])
-                                if !has_key(hdrs, key)
-                                        let hdrs[key] = []
-                                endif
-                                call add(hdrs[key], m[2])
-                        endif
-                        let lst_hdr = key
+                if match(line, '^Notmuch-Help:') == -1
+                        let hdr_starts = lnum - 1
+                        break
                 endif
                 let lnum = lnum + 1
                 let line = getline(lnum)
         endwhile
-        let body_starts = lnum
-
-        "[-a header] [-b bcc-addr] [-c cc-addr] [-s subject] to-addr
-        let cmd = ['mail']
-        let tos = []
-        for [key, vals] in items(hdrs)
-                if key == 'To'
-                        call extend(tos, vals)
-                elseif key == 'Bcc'
-                        for adr in vals
-                                call add(cmd, '-b')
-                                call add(cmd, adr)
-                        endfor
-                elseif key == 'Cc'
-                        for adr in vals
-                                call add(cmd, '-c')
-                                call add(cmd, adr)
-                        endfor
-                elseif key == 'Subject'
-                        for txt in vals
-                                call add(cmd, '-s')
-                                call add(cmd, txt)
-                        endfor
-                else
-                        for val in vals
-                                call add(cmd, '-a')
-                                call add(cmd, key . ': ' . val)
-                        endfor
-                endif
-        endfor
-        call extend(cmd, tos)
-
-        " TODO: make sure we have at least one target
-        " TODO: ask about empty jubject, etc
 
-        exec printf('0,%dd', body_starts)
+        exec printf(':0,%dd', hdr_starts)
         write
 
-        call map(cmd, 's:NM_shell_escape(v:val)')
-        let cmdtxt = join(cmd) . '< ' . fname
+        let cmdtxt = 'mailx -t < ' . fname
         let out = system(cmdtxt)
         let err = v:shell_error
         if err
-- 
1.7.1

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

* [PATCH 8/9] vim: run(): optimize non-debug path
  2010-06-05 11:12 [PATCH 0/9] vim improvements Felipe Contreras
                   ` (6 preceding siblings ...)
  2010-06-05 11:12 ` [PATCH 7/9] vim: use mailx for sending Felipe Contreras
@ 2010-06-05 11:12 ` Felipe Contreras
  2010-06-05 11:12 ` [PATCH 9/9] vim: include own improved git-diff syntax Felipe Contreras
  2010-11-08 17:57 ` [PATCH 0/9] vim improvements Carl Worth
  9 siblings, 0 replies; 13+ messages in thread
From: Felipe Contreras @ 2010-06-05 11:12 UTC (permalink / raw
  To: notmuch; +Cc: Bart Trojanowski

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/plugin/notmuch.vim |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim
index 7b49015..8d5d1c3 100644
--- a/vim/plugin/notmuch.vim
+++ b/vim/plugin/notmuch.vim
@@ -1186,13 +1186,16 @@ function! s:NM_run(args)
         call map(words, 's:NM_shell_escape(v:val)')
         let cmd = g:notmuch_cmd . ' ' . join(words) . '< /dev/null'
 
-        let start = reltime()
-        let out = system(cmd)
-        let err = v:shell_error
-        let delta = reltime(start)
-
         if exists('g:notmuch_debug') && g:notmuch_debug
+                let start = reltime()
+                let out = system(cmd)
+                let err = v:shell_error
+                let delta = reltime(start)
+
                 echo printf('[%s] {%s} %s', reltimestr(delta), string(err), string(cmd))
+        else
+                let out = system(cmd)
+                let err = v:shell_error
         endif
 
         if err
-- 
1.7.1

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

* [PATCH 9/9] vim: include own improved git-diff syntax
  2010-06-05 11:12 [PATCH 0/9] vim improvements Felipe Contreras
                   ` (7 preceding siblings ...)
  2010-06-05 11:12 ` [PATCH 8/9] vim: run(): optimize non-debug path Felipe Contreras
@ 2010-06-05 11:12 ` Felipe Contreras
  2010-11-08 17:57 ` [PATCH 0/9] vim improvements Carl Worth
  9 siblings, 0 replies; 13+ messages in thread
From: Felipe Contreras @ 2010-06-05 11:12 UTC (permalink / raw
  To: notmuch; +Cc: Bart Trojanowski

The old one wasn't working at all on newer vims.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 vim/README                      |    5 -----
 vim/syntax/notmuch-git-diff.vim |   26 ++++++++++++++++++++++++++
 vim/syntax/notmuch-show.vim     |    3 +--
 3 files changed, 27 insertions(+), 7 deletions(-)
 create mode 100644 vim/syntax/notmuch-git-diff.vim

diff --git a/vim/README b/vim/README
index 0807166..12ad2bb 100644
--- a/vim/README
+++ b/vim/README
@@ -10,11 +10,6 @@ Dependencies:
     mailx:
         To send mail, notmuch.vim uses the UNIX mailx command.
 
-    git-diff:
-        The vim interface makes use of the git-diff.vim syntax file
-        which is available from
-            http://github.com/motemen/git-vim/blob/master/syntax/git-diff.vim
-
 
 To install:
         make install
diff --git a/vim/syntax/notmuch-git-diff.vim b/vim/syntax/notmuch-git-diff.vim
new file mode 100644
index 0000000..6f15fdc
--- /dev/null
+++ b/vim/syntax/notmuch-git-diff.vim
@@ -0,0 +1,26 @@
+syn match diffRemoved	"^-.*"
+syn match diffAdded	"^+.*"
+
+syn match diffSeparator	"^---$"
+syn match diffSubname	" @@..*"ms=s+3 contained
+syn match diffLine	"^@.*" contains=diffSubname
+
+syn match diffFile	"^diff .*"
+syn match diffNewFile	"^+++ .*"
+syn match diffOldFile	"^--- .*"
+
+hi def link diffOldFile		diffFile
+hi def link diffNewFile		diffFile
+
+hi def link diffFile		Type
+hi def link diffRemoved		Special
+hi def link diffAdded		Identifier
+hi def link diffLine		Statement
+hi def link diffSubname		PreProc
+
+syntax match gitDiffStatLine /^ .\{-}\zs[+-]\+$/ contains=gitDiffStatAdd,gitDiffStatDelete
+syntax match gitDiffStatAdd    /+/ contained
+syntax match gitDiffStatDelete /-/ contained
+
+hi def link gitDiffStatAdd diffAdded
+hi def link gitDiffStatDelete diffRemoved
diff --git a/vim/syntax/notmuch-show.vim b/vim/syntax/notmuch-show.vim
index 20bcc39..c3a98b7 100644
--- a/vim/syntax/notmuch-show.vim
+++ b/vim/syntax/notmuch-show.vim
@@ -12,8 +12,7 @@ syntax match   nmShowMsgHeadVal /^\([^:]\+: \)\@<=.*/ contained
 syntax cluster nmShowMsgBody contains=@nmShowMsgBodyMail,@nmShowMsgBodyGit
 syntax include @nmShowMsgBodyMail syntax/mail.vim
 
-" git-diff.vim marks up diffs in emails, see README for details
-silent! syntax include @nmShowMsgBodyGit syntax/git-diff.vim
+silent! syntax include @nmShowMsgBodyGit syntax/notmuch-git-diff.vim
 
 highlight nmShowMsgDescWho term=reverse cterm=reverse gui=reverse
 highlight link nmShowMsgDescDate Type
-- 
1.7.1

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

* Re: [PATCH 7/9] vim: use mailx for sending
  2010-06-05 11:12 ` [PATCH 7/9] vim: use mailx for sending Felipe Contreras
@ 2010-06-16 18:28   ` Felipe Contreras
  0 siblings, 0 replies; 13+ messages in thread
From: Felipe Contreras @ 2010-06-16 18:28 UTC (permalink / raw
  To: notmuch; +Cc: Bart Trojanowski

On Sat, Jun 5, 2010 at 2:12 PM, Felipe Contreras
<felipe.contreras@gmail.com> wrote:
> Possilby used by more systems, and besides the code wasn't really
> working properly anyway.

Hmm, I just noticed that mailx in Fedora 13 (apparently heirloom
mailx) is dropping the 'in-reply-to' and 'references' headers, so it
would make more sense to generate output directly for the MTA. FTR.
There's no 'mail' command on F13.

-- 
Felipe Contreras

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

* Re: [PATCH 0/9] vim improvements
  2010-06-05 11:12 [PATCH 0/9] vim improvements Felipe Contreras
                   ` (8 preceding siblings ...)
  2010-06-05 11:12 ` [PATCH 9/9] vim: include own improved git-diff syntax Felipe Contreras
@ 2010-11-08 17:57 ` Carl Worth
  2010-11-08 18:04   ` Carl Worth
  9 siblings, 1 reply; 13+ messages in thread
From: Carl Worth @ 2010-11-08 17:57 UTC (permalink / raw
  To: Felipe Contreras, notmuch; +Cc: Bart Trojanowski

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

On Sat,  5 Jun 2010 14:12:33 +0300, Felipe Contreras <felipe.contreras@gmail.com> wrote:
> The only controversial one is the really aggressive author cleanup. I
> guess the really ideal thing would be to pass the full author "Foo Bar
> <foo.bar@mail.com>", and let UI's deal with the format (possibly
> configurable by the user).

Yes. Personally, I'd prefer first names rather than portions of the
email address. So I don't want to commit a change that takes us in the
wrong direction, (giving less information to the frontends to work
with).

The rest of your vim patches seem totally unobjectionable to me, (but
mostly only because I don't use that frontend). But I am happy to see
someone hacking on it.

So I'll merge these now. And since Bart didn't reply at all in all this
time, Felipe, would you like access to push changes directly to the vim
code? Since we're hosting that code in the notmuch repository I think we
need to have an interested maintainer with the ability to maintain it,
(so that future improvements don't sit idle for months).

I'll send instructions for setting you up with access like that if you'd
like to do that kind of maintenance.

-Carl

-- 
carl.d.worth@intel.com

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

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

* Re: [PATCH 0/9] vim improvements
  2010-11-08 17:57 ` [PATCH 0/9] vim improvements Carl Worth
@ 2010-11-08 18:04   ` Carl Worth
  0 siblings, 0 replies; 13+ messages in thread
From: Carl Worth @ 2010-11-08 18:04 UTC (permalink / raw
  To: Felipe Contreras, notmuch; +Cc: Bart Trojanowski

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

On Mon, 08 Nov 2010 09:57:16 -0800, Carl Worth <cworth@cworth.org> wrote:
> So I'll merge these now.

These are all merged and pushed out now. (I pushed only the vim-specific
changes and not the lower-level change to the author cleanup.)

-Carl

-- 
carl.d.worth@intel.com

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

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

end of thread, other threads:[~2010-11-08 18:05 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-05 11:12 [PATCH 0/9] vim improvements Felipe Contreras
2010-06-05 11:12 ` [PATCH 1/9] thread: really clean authors Felipe Contreras
2010-06-05 11:12 ` [PATCH 2/9] vim: add archive support from 'show' Felipe Contreras
2010-06-05 11:12 ` [PATCH 3/9] vim: cleanup search buffer Felipe Contreras
2010-06-05 11:12 ` [PATCH 4/9] vim: cleanup search syntax Felipe Contreras
2010-06-05 11:12 ` [PATCH 5/9] vim: remove add_remove_tags_on_screen() Felipe Contreras
2010-06-05 11:12 ` [PATCH 6/9] vim: add option to mark as read + archive Felipe Contreras
2010-06-05 11:12 ` [PATCH 7/9] vim: use mailx for sending Felipe Contreras
2010-06-16 18:28   ` Felipe Contreras
2010-06-05 11:12 ` [PATCH 8/9] vim: run(): optimize non-debug path Felipe Contreras
2010-06-05 11:12 ` [PATCH 9/9] vim: include own improved git-diff syntax Felipe Contreras
2010-11-08 17:57 ` [PATCH 0/9] vim improvements Carl Worth
2010-11-08 18:04   ` Carl Worth

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