Function: ispell-add-per-file-word-list

ispell-add-per-file-word-list is a byte-compiled function defined in ispell.el.gz.

Signature

(ispell-add-per-file-word-list WORD)

Documentation

Add WORD to the per-file word list.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/ispell.el.gz
(defun ispell-add-per-file-word-list (word)
  "Add WORD to the per-file word list."
  (or ispell-buffer-local-name
      (setq ispell-buffer-local-name (buffer-name)))
  (save-excursion
    (goto-char (point-min))
    (let (line-okay search done found)
      (while (not done)
        (let ((case-fold-search nil))
          (setq search (search-forward ispell-words-keyword nil t)
                found (or found search)
                line-okay (< (+ (length word) 1 ; 1 for space after word..
                                (progn (end-of-line) (current-column)))
                             fill-column)))
        (if (or (and search line-okay)
                (null search))
            (progn
              (setq done t)
              (if (null search)
                  (progn
                    (let ((empty-comment-end (or (not comment-end) (= (length comment-end) 0))))
                      (progn
                        (if found (progn ;; after an existing LocalWords
                                    (insert "\n")
                                    (when (and empty-comment-end comment-start)
                                      (insert (ispell--comment-prefix) " ")))
                          (goto-char (point-max)) ;; no LocalWords, go to end of file
                          (open-line 1)
                          (newline)
                          ;; Insert an end marker if needed, preceded by a newline.
                          (if (not empty-comment-end)
                              (save-excursion
                                (newline)
                                (insert comment-end)))
                          (when comment-start
                            (insert (ispell--comment-prefix) (if (not empty-comment-end) "\n" " "))))
                        (insert ispell-words-keyword)))))
              (insert (concat " " word))))))))