Function: ispell-valid-dictionary-list

ispell-valid-dictionary-list is a byte-compiled function defined in ispell.el.gz.

Signature

(ispell-valid-dictionary-list)

Documentation

Return a list of valid dictionaries.

The variable ispell-library-directory defines their location.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/ispell.el.gz
(defun ispell-valid-dictionary-list ()
  "Return a list of valid dictionaries.
The variable `ispell-library-directory' defines their location."
  ;; Initialize variables and dictionaries alists for desired spellchecker.
  ;; Make sure ispell.el is loaded to avoid some autoload loops.
  (if (featurep 'ispell)
      (ispell-set-spellchecker-params))

  (let ((dicts (append ispell-local-dictionary-alist ispell-dictionary-alist))
	(dict-list (cons "default" nil))
	(dict-locate
	 (lambda (dict &optional dir)
	   (locate-file (file-name-nondirectory dict)
			`(,(or dir (file-name-directory dict)))
			(unless (file-name-extension dict) '(".hash" ".has")))))
	name dict-explt dict-bname)
    (dolist (dict dicts)
      (setq name (car dict)
	    ;; Explicitly (via ispell-args) specified dictionary.
	    dict-explt (car (cdr (member "-d" (nth 5 dict))))
	    dict-bname (or dict-explt name))
      (if (and name
	       (or
		;; Include all for Aspell (we already know existing dicts)
		(and ispell-really-aspell
                     (assoc name ispell--aspell-found-dictionaries))
		;; Include all if `ispell-library-directory' is nil (Hunspell)
		(and (not ispell-really-aspell)
                     (not ispell-library-directory))
		;; If explicit (-d with an absolute path) and existing dict.
		(and dict-explt
		     (file-name-absolute-p dict-explt)
		     (funcall dict-locate dict-explt))
		;; If dict located in `ispell-library-directory'.
		(funcall dict-locate dict-bname ispell-library-directory)))
	  (push name dict-list)))
    dict-list))