diff --git a/mode/latex.py b/mode/latex.py index 9bdfe77..e2f5ea9 100644 --- a/mode/latex.py +++ b/mode/latex.py @@ -1,6 +1,7 @@ import commands, os import color, method, mode from lex import Grammar, PatternRule, RegionRule +from mode.text import TextInsertSpace class LatexGrammar(Grammar): rules = [ @@ -33,9 +34,10 @@ class Latex(mode.Fundamental): self.add_action_and_bindings(LatexInsertSquotes(), ("M-'",)) self.add_action_and_bindings(LatexInsertDquotes(), ('M-"',)) self.add_action_and_bindings(LatexInsertBraces(), ('M-{',)) - self.add_action_and_bindings(LatexBuild(), ("C-c C-c",)) - self.add_action(LatexBuildPdf()) - self.add_action(LatexViewPdf()) + self.add_action_and_bindings(LatexBuild(), ("C-c C-c", 'C-c B')) + self.add_action_and_bindings(LatexInsertSpace(), ('SPACE',)) + self.add_action_and_bindings(LatexBuildPdf(), ("C-c C-p",)) + self.add_action_and_bindings(LatexViewPdf(), ('C-c C-v',)) class LatexBuild(method.Method): '''Insert a pair of LaTeX-style single-quotes into the buffer''' @@ -54,7 +56,7 @@ class LatexBuild(method.Method): def _modpath(self, w, ext): return os.path.splitext(w.buffer.path)[0] + ext def _readlog(self, w): - logpath = self._modpath('.log') + logpath = self._modpath(w, '.log') f = open(logpath, 'r') output = f.read() f.close() @@ -104,4 +106,7 @@ class LatexInsertBraces(method.Method): w.insert_string_at_cursor("{}") w.backward() +class LatexInsertSpace(TextInsertSpace): + pass + install = Latex.install