Subject: bug#67045: No way to control location of .aspell.en.prepl from within Emacs

From: Björn Lindqvist <[email-masked]>
Date: Sat, 11 Nov 2023 17:39:00 +0100

I care little about what speller backend Emacs uses. I just want it to
follow the XDG (which I think it should do by default because dumping
dotfiles in ~/ is for neanderthals, but that's a different
story). Getting it to work was very difficult especially as I'm
often switching between languages. Here is part of my setup:

    (defun set-language (code name)
      (let* ((dir (expand-file-name "~/.config/aspell/"))
             (pd (concat dir code ".pws"))
             (rd (concat dir code ".prepl")))
        (make-directory dir t)
        (setq ispell-personal-dictionary pd)
        (setq ispell-extra-args (list "--repl" rd)))
      (ispell-change-dictionary code)
      (flyspell-buffer)
      (message (format "Switched to %s" name)))

    (setq flyspell-issue-message-flag nil)
    (add-hook 'text-mode-hook 'flyspell-mode)
    (add-hook 'flyspell-mode-hook
              (lambda ()
                (set-language "en" "English")))

I also have keybindings setup to quickly restart aspell because having
one buffer spell-checked in one language and another buffer in a
different language is not supported. I would be happier if I could
write:

    (setq ispell-personal-directory "~/.config/aspell")

and have ispell understand that it should dump all user configuration
files to that directory.

Den lör 11 nov. 2023 kl 07:58 skrev Eli Zaretskii <[email-masked]>:
>
> > From: Björn Lindqvist <[email-masked]>
> > Date: Fri, 10 Nov 2023 22:33:17 +0100
> > Cc: [email-masked]
> >
> > > Can't you customize ispell-extra-args?  In addition,
> > > ispell-dictionary-alist supports language-specific options, AFAIK.
> >
> > I didn't know about that variable and it's not in the manual afaics. I
> > managed to piece some elisp together using it to set the --repl
> > option. It works, though I don't think it is a very user-friendly
> > solution.
>
> Why do you consider it not a user-friendly solution?  There's no limit
> to command-line options a speller can have, so it is not reasonable
> IMO to expect Emacs to have a separate variable for each one of them.
> Thus, our solution to have a single variable that can hold any
> additional options is a reasonable compromise.
>
> As for its discoverability: in general, when you are faced with a
> problem in some Emacs Lisp package, my advice is first to see whether
> a solution already exists by browsing all the defcustom's of that
> package (and its parent packages, if that is appropriate).  One way of
> doing that is by using "M-x customize-group" bu giving it the group of
> the package.
>
> Stefan, WDYT?

-- 
mvh/best regards Björn Lindqvist