aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim
diff options
context:
space:
mode:
authorGravatar Bart Trojanowski <bart@jukie.net>2009-11-25 14:19:02 -0500
committerGravatar Bart Trojanowski <bart@jukie.net>2009-11-25 14:19:02 -0500
commit329f95eb77b3661247a461db2cfe190140864b65 (patch)
tree54965bff4903e9fdf0a93f1b117e1aa9e644c2ed /vim
parent898b173a182ee37d6e54f5f09284f99a8aef8892 (diff)
vim: refactor get_message_for_line out of show_message_id
Diffstat (limited to 'vim')
-rw-r--r--vim/plugin/notmuch.vim25
1 files changed, 14 insertions, 11 deletions
diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim
index 7927dd62..b6bc6120 100644
--- a/vim/plugin/notmuch.vim
+++ b/vim/plugin/notmuch.vim
@@ -517,22 +517,25 @@ endfunction
" --- --- show screen helper functions {{{2
+function! s:NM_show_get_message_for_line(line)
+ for msg in b:nm_raw_info['msgs']
+ if a:line > msg['end']
+ continue
+ endif
+ return msg
+ endfor
+ return {}
+endfunction
+
function! s:NM_show_message_id()
if !exists('b:nm_raw_info')
echoe 'no b:nm_raw_info'
return ''
endif
- let info = b:nm_raw_info
- let lnum = line('.')
- for msg in info['msgs']
- if lnum > msg['end']
- continue
- endif
- if has_key(msg,'id')
- return msg['id']
- endif
- return ''
- endfor
+ let msg = <SID>NM_show_get_message_for_line(line('.'))
+ if has_key(msg,'id')
+ return msg['id']
+ endif
return ''
endfunction