Function: ispell-change-dictionary
ispell-change-dictionary is an autoloaded, interactive and
byte-compiled function defined in ispell.el.gz.
Signature
(ispell-change-dictionary DICT &optional ARG)
Documentation
Change to dictionary DICT for Ispell.
If ARG is non-nil (interactively, the prefix arg), set it "globally", for all buffers. Otherwise, set it "locally", just for this buffer.
By just answering RET you can find out the name of the current dictionary.
Probably introduced at or before Emacs version 27.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/ispell.el.gz
;; ispell-change-dictionary is set in some people's hooks. Maybe this should
;; call ispell-init-process rather than wait for a spell checking command?
;;;###autoload
(defun ispell-change-dictionary (dict &optional arg)
"Change to dictionary DICT for Ispell.
If ARG is non-nil (interactively, the prefix arg), set it \"globally\",
for all buffers. Otherwise, set it \"locally\", just for this buffer.
By just answering RET you can find out the name of the current dictionary."
(interactive
(list (completing-read
"Use new dictionary (RET for current, SPC to complete): "
(mapcar #'list (ispell-valid-dictionary-list))
nil t)
current-prefix-arg))
(ispell-set-spellchecker-params) ; Initialize variables and dicts alists
(unless arg (ispell-buffer-local-dict 'no-reload))
(if (equal dict "default") (setq dict nil))
;; This relies on completing-read's bug of returning "" for no match
(cond ((equal dict "")
(ispell-internal-change-dictionary)
(message "Using %s dictionary"
(or (and (not arg) ispell-local-dictionary)
ispell-dictionary "default"))
(run-hooks 'ispell-change-dictionary-hook))
((equal dict (or (and (not arg) ispell-local-dictionary)
ispell-dictionary "default"))
;; Specified dictionary is the default already. Could reload
;; the dictionaries if needed.
(ispell-internal-change-dictionary)
(when (called-interactively-p 'interactive)
(message "No change, using %s dictionary" dict)))
(t ; reset dictionary!
(if (or (assoc dict ispell-local-dictionary-alist)
(assoc dict ispell-dictionary-alist))
(if arg
;; set default dictionary
(setq ispell-dictionary dict)
;; set local dictionary
(setq ispell-local-dictionary dict)
(setq ispell-local-dictionary-overridden t))
(error "Undefined dictionary: %s" dict))
(ispell-internal-change-dictionary)
(setq ispell-buffer-session-localwords nil)
(message "%s Ispell dictionary set to %s"
(if arg "Global" "Local")
dict)
(run-hooks 'ispell-change-dictionary-hook))))