Function: ispell-buffer-local-words
ispell-buffer-local-words is a byte-compiled function defined in
ispell.el.gz.
Signature
(ispell-buffer-local-words)
Documentation
Load the buffer-local dictionary in the current buffer.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/ispell.el.gz
(defun ispell-buffer-local-words ()
"Load the buffer-local dictionary in the current buffer."
;; If there's an existing ispell process that's wrong for this use,
;; kill it.
(if (and ispell-buffer-local-name
(not (equal ispell-buffer-local-name (buffer-name))))
(ispell-kill-ispell t))
;; Actually start a new ispell process, because we need
;; to send commands now to specify the local words to it.
(ispell-init-process)
(dolist (session-localword ispell-buffer-session-localwords)
(ispell-send-string (concat "@" session-localword "\n")))
(or ispell-buffer-local-name
(if ispell-buffer-session-localwords
(setq ispell-buffer-local-name (buffer-name))))
(save-excursion
(goto-char (point-min))
(while (search-forward ispell-words-keyword nil t)
(or ispell-buffer-local-name
(setq ispell-buffer-local-name (buffer-name)))
(let ((end (line-end-position))
(ispell-casechars (ispell-get-casechars))
string)
;; buffer-local words separated by a space, and can contain
;; any character other than a space. Not rigorous enough.
(while (re-search-forward " *\\([^ ]+\\)" end t)
(setq string (match-string-no-properties 1))
;; This can fail when string contains a word with invalid chars.
;; Error handling needs to be added between ispell and Emacs.
(if (and (< 1 (length string))
(equal 0 (string-match ispell-casechars string)))
(ispell-send-string (concat "@" string "\n"))))))))