[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-devel] Spell checking of macros

From: Arash Esbati
Subject: [AUCTeX-devel] Spell checking of macros
Date: Fri, 24 Jun 2016 12:48:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.95

Hi all,

there is an item on AUCTeX's wish list:

o Spell checking of macros
  A special ispell dictionary for macros could be nice to have.

I'm not sure if there were activities in this regard in the past, but
AFAICT, it is about adding items to car and/or cdr of
`ispell-tex-skip-alists'.  Please consider an example attached below
(which does not compile): Run ispell (I tried hunspell, BTW) with
standard settings and then eval the code inside "lstlisting" and run it

I think it should suffice if AUCTeX provides one or two functions (much
more sophisticated than mine, of course ;-) to add items to
`ispell-tex-skip-alists'.  I would also suggest to collect all items in
a file like `tex-ispell.el' -- my feeling is it is easier to maintain
than on a per-style basis.  Only document macros should be considered,
preamble only macros are ignored anyway.  Styles could use this function
for parsed elements.


Best, Arash

--8<---------------cut here---------------start------------->8---




  output-open-uncertainty = [,
  output-close-uncertainty = ],
  uncertainty-separator = {\,}
\si{\highlight{mypurple}\kilogram\metre\per\second}, \si{kg.m/s^2};
\SI{2}{kg.m/s^2}; \num{-e10} or \num{3.45d-4}


  \caption{Caption to table}
    Text & Text & Text

\labelcref{tab:tessst} % why ignored?



(load-library "cl")

(defun TeX-ispell-skip-setcar (skips)
  "Add SKIPS to car of `ispell-tex-skip-alists'."
  (let ((raws (car ispell-tex-skip-alists))
        (envs (cadr ispell-tex-skip-alists)))
    (dolist (x skips)
      (pushnew x raws :test #'equal))
    (setq ispell-tex-skip-alists (list raws envs))))

(TeX-ispell-skip-setcar '(("\\\\si\\(setup\\)?" ispell-tex-arg-end)
                          ("\\\\SI"             ispell-tex-arg-end 2)
                          ("\\\\num"            ispell-tex-arg-end)
                          ("\\\\lstset"         ispell-tex-arg-end)
                          ("\\\\cmidrule" . "\\(([^)]*)\\)?{[-0-9]*}")
                          ("\\\\sindex"         ispell-tex-arg-end)

(defun TeX-ispell-skip-setcdr (skips)
  "Add SKIPS to cdr of `ispell-tex-skip-alists'."
  (let ((raws (car ispell-tex-skip-alists))
        (envs (cadr ispell-tex-skip-alists)))
    (dolist (x skips)
      (pushnew x envs :test #'equal))
    (setq ispell-tex-skip-alists (list raws envs))))

(TeX-ispell-skip-setcdr '(("lstlisting" . "\\\\end{lstlisting}")))

--8<---------------cut here---------------end--------------->8---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]