--- a/eric6/QScintilla/Lexers/LexerTeX.py Thu Apr 15 16:52:05 2021 +0200 +++ b/eric6/QScintilla/Lexers/LexerTeX.py Thu Apr 15 18:11:24 2021 +0200 @@ -7,6 +7,8 @@ Module implementing a Tex lexer with some additional methods. """ +import contextlib + from PyQt5.Qsci import QsciLexerTeX from .Lexer import Lexer @@ -43,14 +45,12 @@ """ Public slot to initialize the properties. """ - try: + with contextlib.suppress(AttributeError): self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) self.setFoldComments(Preferences.getEditor("TexFoldComment")) self.setProcessComments( Preferences.getEditor("TexProcessComments")) self.setProcessIf(Preferences.getEditor("TexProcessIf")) - except AttributeError: - pass def isCommentStyle(self, style): """