diff options
author | JSDurand <mmemmew@gmail.com> | 2023-12-13 14:32:33 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2023-12-13 14:32:33 +0800 |
commit | 01b2557cbfba56971d2c71cc3ee4d96638f966e2 (patch) | |
tree | 20a7e5302ecf69413eaf206bd3f7259207921050 | |
parent | bb1cda6fc1a36304dd96095a931abda8c4e9c9d8 (diff) |
TeX: Refined handling of braces
* tex-conf.el (end-exit-paren, open-back-paren): Refined handling of
right angled brackets.
(durand-o-things-list, durand-insert-o-things): Take right angled
brackets into consideration.
-rw-r--r-- | tex-conf.el | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/tex-conf.el b/tex-conf.el index 5245c21..f1b9029 100644 --- a/tex-conf.el +++ b/tex-conf.el @@ -184,6 +184,8 @@ ((looking-at-p "\\\\right") (forward-char 6) (end-exit-paren)) + ((looking-at-p "\\\\rangle") + (forward-char 7)) (t (self-insert-command 1))))) ;;;###autoload @@ -198,6 +200,13 @@ (max (- (point) 2) (point-min))) (forward-char -2) (setq continue t)) + ((looking-back (regexp-quote "\\rangle") + (max (- (point) 7) (point-min))) + (forward-char -7) + (setq continue t)) + ((looking-back (regexp-quote "\\right") + (max (- (point) 6) (point-min))) + (forward-char -6)) ((memq ch ch-list) (backward-char) (setq continue t)) (t (self-insert-command 1))) (cond @@ -288,6 +297,7 @@ where the macro part is without the backslash.") (cons "o" "circ") (list "{" "{" "}") (list "(" "(" ")") + (list "<" "langle" "rangle") (list "b" "lvert" "rvert"))) ;;;###autoload @@ -295,15 +305,23 @@ where the macro part is without the backslash.") "Insert a symbol associated with \"o\" key. The list is in the variable `durand-o-things-list'" (interactive) - (let ((thing (minibuffer-with-setup-hook 'durand-headlong-minibuffer-setup-hook + (let ((thing (minibuffer-with-setup-hook + 'durand-headlong-minibuffer-setup-hook (completing-read - "Chois une chose associée à \"o\":" (mapcar 'car durand-o-things-list) + "Chois une chose associée à \"o\":" + (mapcar 'car durand-o-things-list) nil t "^")))) - (let ((associated (alist-get thing durand-o-things-list nil nil #'string=))) + (let ((associated + (alist-get + thing durand-o-things-list + nil nil #'string=))) (cond ((not (consp associated)) ;; length = 1 - (insert (format "\\%s" (assoc-default thing durand-o-things-list #'string=)))) + (insert + (format + "\\%s" + (assoc-default thing durand-o-things-list #'string=)))) ((and (null (cddr associated)) (string= (car associated) "(")) ;; special treatment for the parenthesis |