Get rid of `toggle-TeX-brace-count-line-override'
This commit is contained in:
parent
f69b7fd3ad
commit
f08fb76533
77
README.org
77
README.org
@ -627,12 +627,6 @@ and [[lst:3rd-window-management]] implement a selection of his recommendations.
|
|||||||
#+name: lst:toggle-specific-advice
|
#+name: lst:toggle-specific-advice
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(with-eval-after-load 'emacs
|
(with-eval-after-load 'emacs
|
||||||
(defun toggle-TeX-brace-count-line-override ()
|
|
||||||
"Toggle `TeX-brace-count-line-override' advice."
|
|
||||||
(interactive)
|
|
||||||
(advice-toggle 'TeX-brace-count-line
|
|
||||||
:override #'TeX-brace-count-line-override))
|
|
||||||
|
|
||||||
(defun toggle-engrave-faces-latex-face-apply-override ()
|
(defun toggle-engrave-faces-latex-face-apply-override ()
|
||||||
"Toggle `engrave-faces-latex-face-apply' advice."
|
"Toggle `engrave-faces-latex-face-apply' advice."
|
||||||
(interactive)
|
(interactive)
|
||||||
@ -849,7 +843,6 @@ defined in this Org file.
|
|||||||
(define-short-documentation-group init
|
(define-short-documentation-group init
|
||||||
"Advice"
|
"Advice"
|
||||||
(advice-toggle :no-manual t)
|
(advice-toggle :no-manual t)
|
||||||
(toggle-TeX-brace-count-line-override :no-manual t)
|
|
||||||
(toggle-engrave-faces-latex-face-apply-override :no-manual t)
|
(toggle-engrave-faces-latex-face-apply-override :no-manual t)
|
||||||
(toggle-engrave-faces-latex-face-mapper-override :no-manual t)
|
(toggle-engrave-faces-latex-face-mapper-override :no-manual t)
|
||||||
(toggle-eww-display-pdf-around :no-manual t)
|
(toggle-eww-display-pdf-around :no-manual t)
|
||||||
@ -1764,33 +1757,41 @@ rebuild the =epdfinfo= executable that serves the [[https://en.wikipedia.org/wik
|
|||||||
:END:
|
:END:
|
||||||
|
|
||||||
Loading =tex.el= immediately instead of lazily ensures proper initialization of
|
Loading =tex.el= immediately instead of lazily ensures proper initialization of
|
||||||
[[https://en.wikipedia.org/wiki/AUCTeX][AUCTeX]]. For instance, the ~TeX-master~ safe local variable in the =tex.el=
|
[[https://en.wikipedia.org/wiki/AUCTeX][AUCTeX]]. In particular, the ~TeX-master~ safe local variable in the =tex.el=
|
||||||
elisp library file has no autoload cookie. Without prior loading of =tex.el=,
|
elisp library file has no autoload cookie. Without prior loading of =tex.el=,
|
||||||
Emacs will complain that ~TeX-master~ is no safe local variable in case it reads
|
Emacs will complain that ~TeX-master~ is no safe local variable in case it reads
|
||||||
a LaTeX file that sets ~TeX-master~. Listing [[lst:require-auctex]] initializes
|
a LaTeX file that sets ~TeX-master~. The list below summarizes the main [[https://en.wikipedia.org/wiki/AUCTeX][AUCTeX]]
|
||||||
[[https://en.wikipedia.org/wiki/AUCTeX][AUCTeX]] properly for LuaTeX or LuaLaTeX. In case the output of =LuaLaTeX= has
|
configuration objectives:
|
||||||
missing fonts, listing [[lst:update-lualatex-opentype-font-name-database]] defines a
|
1. Listing [[lst:require-tex]] initializes [[https://en.wikipedia.org/wiki/AUCTeX][AUCTeX]] properly for =LuaTeX= or
|
||||||
function to update the =OpenType Font= name database for =LuaLaTeX=. Finally,
|
=LuaLaTeX=.
|
||||||
out of the box, [[https://en.wikipedia.org/wiki/AUCTeX][AUCTeX]] does not indent text between square brackets. The code
|
2. Listing [[lst:require-tex]] also enables [[https://git.savannah.gnu.org/cgit/auctex.git/patch/?id=f464242eab092e610dda6b654e6fd197ef649d3eAA][indenting between square brackets]]
|
||||||
in listing [[lst:configure-auctex]] corrects this by advising to override
|
which is a recent feature.
|
||||||
~TeX-brace-count-line~ with ~TeX-brace-count-line-advice~.
|
3. Listing [[lst:update-lualatex-opentype-font-name-database]] defines a function to
|
||||||
|
update the =OpenType Font= name database for =LuaLaTeX= when the output of
|
||||||
|
=LuaLaTeX= shows missing fonts.
|
||||||
|
4. Listing [[lst:configure-bibtex]] configures the Emacs =bibtex= library to use the
|
||||||
|
LaTeX =BiBTeX= dialect for backwards compatibility.
|
||||||
|
5. Listing [[lst:configure-font-latex]] disables font scaling of section titles.
|
||||||
|
6. Listing [[lst:configure-latex]] configures =latex= for a full featured
|
||||||
|
=LaTeX-section-command=.
|
||||||
|
|
||||||
#+caption[Require =AUCTeX=]:
|
#+caption[Require and configure =TeX=]:
|
||||||
#+caption: Require =AUCTeX=.
|
#+caption: Require and configure =TeX=.
|
||||||
#+name: lst:require-auctex
|
#+name: lst:require-tex
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
;; Use `require' to make `TeX-master' a safe local variable.
|
;; Use `require' to make `TeX-master' a safe local variable.
|
||||||
(when (require 'tex nil 'noerror)
|
(when (require 'tex nil 'noerror)
|
||||||
(custom-set-variables
|
(custom-set-variables
|
||||||
'(TeX-auto-save t)
|
'(TeX-auto-save t)
|
||||||
'(TeX-engine 'luatex)
|
'(TeX-engine 'luatex)
|
||||||
|
'(TeX-indent-close-delimiters "]")
|
||||||
|
'(TeX-indent-open-delimiters "[")
|
||||||
'(TeX-install-font-lock #'font-latex-setup)
|
'(TeX-install-font-lock #'font-latex-setup)
|
||||||
'(TeX-parse-self t)
|
'(TeX-parse-self t)
|
||||||
;; Disable `TeX-electric-math' to prevent collisions with `smartparens'.
|
;; Disable `TeX-electric-math' to prevent collisions with `smartparens'.
|
||||||
'(TeX-electric-math nil)))
|
'(TeX-electric-math nil)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
|
||||||
#+caption[Update the =LuaLaTeX OpenType Font= name database]:
|
#+caption[Update the =LuaLaTeX OpenType Font= name database]:
|
||||||
#+caption: Update the =LuaLaTeX= =OpenType Font= name database.
|
#+caption: Update the =LuaLaTeX= =OpenType Font= name database.
|
||||||
#+name: lst:update-lualatex-opentype-font-name-database
|
#+name: lst:update-lualatex-opentype-font-name-database
|
||||||
@ -1807,44 +1808,6 @@ in listing [[lst:configure-auctex]] corrects this by advising to override
|
|||||||
(error "%s" (string-trim output))))))
|
(error "%s" (string-trim output))))))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+caption[Configure =AUCTeX=]:
|
|
||||||
#+caption: Configure =AUCTeX=.
|
|
||||||
#+name: lst:configure-auctex
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(when (require 'tex nil 'noerror)
|
|
||||||
;; https://emacs.stackexchange.com/a/35507 answers:
|
|
||||||
;; How to indent between square brackets?
|
|
||||||
(defun TeX-brace-count-line-override ()
|
|
||||||
"Count number of open/closed braces."
|
|
||||||
(save-excursion
|
|
||||||
(let ((count 0) (limit (line-end-position)) char)
|
|
||||||
(while (progn
|
|
||||||
(skip-chars-forward "^{}[]\\\\" limit)
|
|
||||||
(when (and (< (point) limit) (not (TeX-in-comment)))
|
|
||||||
(setq char (char-after))
|
|
||||||
(forward-char)
|
|
||||||
(cond ((eq char ?\{)
|
|
||||||
(setq count (+ count TeX-brace-indent-level)))
|
|
||||||
((eq char ?\})
|
|
||||||
(setq count (- count TeX-brace-indent-level)))
|
|
||||||
((eq char ?\[)
|
|
||||||
(setq count (+ count TeX-brace-indent-level)))
|
|
||||||
((eq char ?\])
|
|
||||||
(setq count (- count TeX-brace-indent-level)))
|
|
||||||
((eq char ?\\)
|
|
||||||
(when (< (point) limit)
|
|
||||||
(forward-char) t))))))
|
|
||||||
count)))
|
|
||||||
|
|
||||||
(advice-add 'TeX-brace-count-line :override #'TeX-brace-count-line-override))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Listing [[lst:configure-bibtex]] configures the Emacs =bibtex= library to use the
|
|
||||||
LaTeX =BiBTeX= dialect for backwards compatibility. Listing
|
|
||||||
[[lst:configure-font-latex]] disables font scaling of section titles. Listing
|
|
||||||
[[lst:configure-latex]] configures =latex= for a full featured
|
|
||||||
=LaTeX-section-command=.
|
|
||||||
|
|
||||||
#+caption[Configure =bibtex=]:
|
#+caption[Configure =bibtex=]:
|
||||||
#+caption: Configure =bibtex=.
|
#+caption: Configure =bibtex=.
|
||||||
#+name: lst:configure-bibtex
|
#+name: lst:configure-bibtex
|
||||||
|
Loading…
Reference in New Issue
Block a user