changeset 83:e7e392be4141

Only show message about an existing update job for user-initiated actions.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 26 Aug 2015 21:20:37 -0700
parents a837021a2388
children 96bfe5c37f37
files autoload/gutentags.vim
diffstat 1 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/autoload/gutentags.vim	Tue Aug 25 23:08:19 2015 -0700
+++ b/autoload/gutentags.vim	Wed Aug 26 21:20:37 2015 -0700
@@ -148,10 +148,10 @@
             " Generate this new file depending on settings and stuff.
             if g:gutentags_generate_on_missing && !filereadable(l:tagfile)
                 call gutentags#trace("Generating missing tags file: " . l:tagfile)
-                call s:update_tags(module, 1, 0)
+                call s:update_tags(module, 1, 1)
             elseif g:gutentags_generate_on_new
                 call gutentags#trace("Generating tags file: " . l:tagfile)
-                call s:update_tags(module, 1, 0)
+                call s:update_tags(module, 1, 1)
             endif
         endif
     endfor
@@ -207,7 +207,7 @@
 function! s:write_triggered_update_tags() abort
     if g:gutentags_enabled && g:gutentags_generate_on_write
         for module in g:gutentags_modules
-            call s:update_tags(module, 0, 1)
+            call s:update_tags(module, 0, 2)
         endfor
     endif
 endfunction
@@ -219,7 +219,8 @@
 "
 " queue_mode:
 "   0: if an update is already in progress, report it and abort.
-"   1: if an update is already in progress, queue another one.
+"   1: if an update is already in progress, abort silently.
+"   2: if an update is already in progress, queue another one.
 function! s:update_tags(module, write_mode, queue_mode) abort
     " Figure out where to save.
     let l:tags_file = b:gutentags_files[a:module]
@@ -228,18 +229,21 @@
     " Check that there's not already an update in progress.
     let l:lock_file = l:tags_file . '.lock'
     if filereadable(l:lock_file)
-        if a:queue_mode == 1
+        if a:queue_mode == 2
             let l:idx = index(s:update_queue[a:module], l:tags_file)
             if l:idx < 0
                 call add(s:update_queue[a:module], l:tags_file)
             endif
             call gutentags#trace("Tag file '" . l:tags_file . 
                         \"' is already being updated. Queuing it up...")
-            call gutentags#trace("")
-        else
+        elseif a:queue_mode == 1
+            call gutentags#trace("Tag file '" . l:tags_file .
+                        \"' is already being updated. Skipping...")
+        elseif a:queue_mode == 0
             echom "gutentags: The tags file is already being updated, " .
                         \"please try again later."
-            echom ""
+        else
+            call gutentags#throw("Unknown queue mode: " . a:queue_mode)
         endif
         return
     endif