Tweak AUCTeX and Org

* Document clash between `TeX-electric-math' and `smartparens'.
* Implement `org-electric-dollar'.
* Force `org-use-sub-superscripts' in the setup-include.org file.
This commit is contained in:
Gerard Vermeulen 2022-01-23 11:51:26 +01:00
parent 6bb945de16
commit 5560390519

View File

@ -896,6 +896,10 @@ in listing [[lst:configure-tex]] corrects this by advising to override
#+name: lst:configure-tex
#+begin_src emacs-lisp
(with-eval-after-load 'tex
(custom-set-variables
;; Disable `TeX-electric-math' to prevent collisions with `smartparens'.
'(TeX-electric-math nil))
;; https://emacs.stackexchange.com/questions/17396/
;; indentation-in-square-brackets
(defun my-TeX-brace-count-line ()
@ -919,6 +923,7 @@ in listing [[lst:configure-tex]] corrects this by advising to override
(when (< (point) limit)
(forward-char) t))))))
count)))
(advice-add 'TeX-brace-count-line :override #'my-TeX-brace-count-line))
#+end_src
@ -1002,7 +1007,6 @@ The code in listing [[lst:customize-org-babel]], [[lst:customize-org]], and
(org . t)
(perl . t)
(python . t)
(scheme . t)
(shell . t)))
'(org-export-backends '(ascii beamer html icalendar latex odt texinfo))
'(org-file-apps '((auto-mode . emacs)
@ -1027,7 +1031,29 @@ The code in listing [[lst:customize-org-babel]], [[lst:customize-org]], and
("q" . "quote")
("s" . "src")
("p" . "src python :session :async")
("v" . "verse"))))
("v" . "verse")))))
#+end_src
#+caption[Configure =org-mode-map=]:
#+caption: Configure =org-mode-map=.
#+name: lst:configure-org-mode-map
#+begin_src emacs-lisp
(with-eval-after-load 'org
;; From: "Nicolas Richard" <theonewiththeevillook@yahoo.fr>
;; Date: Fri, 08 Mar 2013 16:23:02 +0100 [thread overview]
;; Message-ID: <87vc913oh5.fsf@yahoo.fr> (raw)
(defun org-electric-dollar ()
"When called once, insert \\(\\) and leave point in between.
When called twice, replace the previously inserted \\(\\) by one $."
(interactive)
(if (and (looking-at "\\\\)") (looking-back "\\\\(" (- (point) 2)))
(progn (delete-char 2)
(delete-char -2)
(insert "$"))
(insert "\\(\\)")
(backward-char 2)))
(define-key org-mode-map (kbd "$") #'org-electric-dollar)
(define-key org-mode-map (kbd "M-q") #'org-fill-paragraph))
#+end_src
@ -1425,6 +1451,7 @@ the tools for the [[https://orgmode.org/][Org mode]] =kbd= macro in [[file:setup
#+begin_src org
,#+babel: :cache no
,#+macro: kbd (eval (by-backend-kbd-org-macro $1))
,#+options: ^:{}
,#+property: header-args:emacs-lisp :exports code :results silent :tangle init.el
,#+property: header-args:org :tangle setup-include.org
,#+startup: content