Skip to content
This repository
Browse code

Bug fix: Support for disabled languages in Exuberant Ctags (issue #62)

See issue #62 on GitHub:
  #62
  • Loading branch information...
commit 9713f0a284921dc9782ae1c24dae03ce0c3f9901 1 parent 330ec57
Peter Odding authored September 01, 2013

Showing 1 changed file with 13 additions and 11 deletions. Show diff stats Hide diff stats

  1. 24  autoload/xolox/easytags.vim
24  autoload/xolox/easytags.vim
... ...
@@ -1,9 +1,9 @@
1 1
 " Vim script
2 2
 " Author: Peter Odding <peter@peterodding.com>
3  
-" Last Change: August 31, 2013
  3
+" Last Change: September 1, 2013
4 4
 " URL: http://peterodding.com/code/vim/easytags/
5 5
 
6  
-let g:xolox#easytags#version = '3.4.2'
  6
+let g:xolox#easytags#version = '3.4.3'
7 7
 
8 8
 " Plug-in initialization. {{{1
9 9
 
@@ -566,21 +566,23 @@ function! xolox#easytags#supported_filetypes() " {{{2
566 566
       let command = g:easytags_cmd . ' --list-languages'
567 567
       let listing = xolox#misc#os#exec({'command': command})['stdout']
568 568
     endif
569  
-    let s:supported_filetypes = map(copy(listing) + keys(xolox#misc#option#get('easytags_languages', {})), 's:check_filetype(listing, v:val)')
  569
+    let s:supported_filetypes = keys(xolox#misc#option#get('easytags_languages', {}))
  570
+    for line in listing
  571
+      if line =~ '\[disabled\]$'
  572
+        " Ignore languages that have been explicitly disabled using `--languages=-Vim'.
  573
+        continue
  574
+      elseif line =~ '^\w\S*$'
  575
+        call add(s:supported_filetypes, xolox#easytags#to_vim_ft(line))
  576
+      elseif line =~ '\S'
  577
+        call xolox#misc#msg#warn("easytags.vim %s: Failed to parse line of output from ctags --list-languages: %s", g:xolox#easytags#version, string(line))
  578
+      endif
  579
+    endfor
570 580
     let msg = "easytags.vim %s: Retrieved %i supported languages in %s."
571 581
     call xolox#misc#timer#stop(msg, g:xolox#easytags#version, len(s:supported_filetypes), starttime)
572 582
   endif
573 583
   return s:supported_filetypes
574 584
 endfunction
575 585
 
576  
-function! s:check_filetype(listing, cline)
577  
-  if a:cline !~ '^\w\S*$'
578  
-    let msg = "Failed to get supported languages! (output: %s)"
579  
-    throw printf(msg, strtrans(join(a:listing, "\n")))
580  
-  endif
581  
-  return xolox#easytags#to_vim_ft(a:cline)
582  
-endfunction
583  
-
584 586
 function! xolox#easytags#select_supported_filetypes(vim_ft) " {{{2
585 587
   let supported_filetypes = xolox#easytags#supported_filetypes()
586 588
   let applicable_filetypes = []

0 notes on commit 9713f0a

Please sign in to comment.
Something went wrong with that request. Please try again.