Function: ispell-buffer-local-parsing
ispell-buffer-local-parsing is a byte-compiled function defined in
ispell.el.gz.
Signature
(ispell-buffer-local-parsing)
Documentation
Place Ispell into parsing mode for this buffer.
Overrides the default parsing mode. Includes LaTeX/Nroff modes and extended character mode.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/ispell.el.gz
(defun ispell-buffer-local-parsing ()
"Place Ispell into parsing mode for this buffer.
Overrides the default parsing mode.
Includes LaTeX/Nroff modes and extended character mode."
;; (ispell-init-process) must already be called.
(ispell-send-string "!\n") ; Put process in terse mode.
;; We assume all major modes with "tex-mode" in them should use latex parsing
;; When exclusively checking comments, set to raw text mode (nroff).
(if (and (not (eq 'exclusive ispell-check-comments))
(or (and (eq ispell-parser 'use-mode-name)
(string-match "[Tt][Ee][Xx]-mode"
(symbol-name major-mode)))
(eq ispell-parser 'tex)))
(progn
(ispell-send-string "+\n") ; set ispell mode to tex
(if (not (eq ispell-parser 'tex))
(setq-local ispell-parser 'tex)))
(ispell-send-string "-\n")) ; set mode to normal (nroff)
;; If needed, test for SGML & HTML modes and set a buffer local nil/t value.
(if (and ispell-skip-html (not (eq ispell-skip-html t)))
(setq ispell-skip-html
(not (null (string-match "sgml\\|html\\|xml"
(downcase (symbol-name major-mode)))))))
;; Set default extended character mode for given buffer, if any.
(let ((extended-char-mode (ispell-get-extended-character-mode)))
(if extended-char-mode
(ispell-send-string (concat extended-char-mode "\n"))))
;; Set buffer-local parsing mode and extended character mode, if specified.
(save-excursion
(goto-char (point-max))
;; Uses last occurrence of ispell-parsing-keyword
(if (search-backward ispell-parsing-keyword nil t)
(let ((end (line-end-position))
string)
(search-forward ispell-parsing-keyword)
(while (re-search-forward " *\\([^ \"]+\\)" end t)
;; space separated definitions.
(setq string (downcase (match-string-no-properties 1)))
(cond ((and (string-match "latex-mode" string)
(not (eq 'exclusive ispell-check-comments)))
(ispell-send-string "+\n~tex\n"))
((string-match "nroff-mode" string)
(ispell-send-string "-\n~nroff\n"))
((string-search "~" string) ; Set extended character mode.
(ispell-send-string (concat string "\n")))
(t (message "Invalid Ispell Parsing argument!")
(sit-for 2))))))))