summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tex-conf.el25
1 files changed, 19 insertions, 6 deletions
diff --git a/tex-conf.el b/tex-conf.el
index fa11a90..58940b2 100644
--- a/tex-conf.el
+++ b/tex-conf.el
@@ -175,18 +175,31 @@
(cond ((memq ch ch-list) (forward-char))
((looking-at-p "\\(\\\\)\\|\\\\]\\|\\\\}\\)")
(forward-char 2))
+ ((looking-at-p "\\\\right")
+ (forward-char 6)
+ (end-exit-paren))
(t (self-insert-command 1)))))
;;;###autoload
(defun open-back-paren ()
"Use \"à\" to go back to the parenthesis."
(interactive)
- (let ((ch (char-before nil))
- (ch-list '(?\) ?\} ?\] ?\$)))
- (cond ((looking-back "\\(\\\\)\\|\\\\]\\|\\\\}\\)" (- (point) 2))
- (forward-char -2))
- ((memq ch ch-list) (backward-char))
- (t (self-insert-command 1)))))
+ (save-match-data
+ (let ((ch (char-before nil))
+ (ch-list '(?\) ?\} ?\] ?\$))
+ continue)
+ (cond ((looking-back "\\(\\\\)\\|\\\\]\\|\\\\}\\)"
+ (max (- (point) 2) (point-min)))
+ (forward-char -2)
+ (setq continue t))
+ ((memq ch ch-list) (backward-char) (setq continue t))
+ (t (self-insert-command 1)))
+ (cond
+ ((and continue
+ (looking-back
+ "\\\\right"
+ (max (- (point) 6) (point-min))))
+ (forward-char -6))))))
(make-variable-buffer-local 'parens-require-spaces)