catch exceptions from `pygments.modeline.get_filetype_from_buffer`

This commit is contained in:
Alan Hamlett 2015-07-02 12:36:45 -07:00
parent 4b6aee218b
commit 61b9989641
1 changed files with 6 additions and 1 deletions

View File

@ -135,7 +135,12 @@ def guess_lexer_using_modeline(text):
lexer, accuracy = None, None
file_type = get_filetype_from_buffer(text)
file_type = None
try:
file_type = get_filetype_from_buffer(text)
except:
pass
if file_type is not None:
try:
lexer = get_lexer_by_name(file_type)