Function: ispell-aspell-add-aliases

ispell-aspell-add-aliases is a byte-compiled function defined in ispell.el.gz.

Signature

(ispell-aspell-add-aliases ALIST)

Documentation

Find Aspell's dictionary aliases and add them to dictionary ALIST.

Return the new dictionary alist.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/ispell.el.gz
(defun ispell-aspell-add-aliases (alist)
  "Find Aspell's dictionary aliases and add them to dictionary ALIST.
Return the new dictionary alist."
  (let ((aliases
         (file-expand-wildcards
		  (concat (or ispell-aspell-dict-dir
			      (setq ispell-aspell-dict-dir
				    (ispell-get-aspell-config-value "dict-dir")))
			  "/*.alias"))))
    (dolist (alias-file aliases)
      (with-temp-buffer
	(insert-file-contents alias-file)
	;; Look for a line "add FOO.multi", extract FOO
	(when (search-forward-regexp "^add \\([^.]+\\)\\.multi" nil t)
	  (let* ((aliasname (file-name-base alias-file))
		 (already-exists-p (assoc aliasname alist))
		 (realname (match-string 1))
		 (realdict (assoc realname alist)))
	    (when (and realdict (not already-exists-p))
	      (push (cons aliasname (cdr realdict)) alist))))))
    ;; Add entries for standard dict-names with found locale-matching entry
    (dolist (dict-map-entry ispell-dicts-name2locale-equivs-alist)
      (let ((name (car dict-map-entry))
	    (locale (cadr dict-map-entry)))
	(unless (assoc name alist) ;; skip if already present
	  (if (assoc locale alist)
	      (push (cons name (cdr (assoc locale alist))) alist)))))
    alist))