Subject: flyspell doesn't work with multiple dictionaries
From: Konstantin Kharlamov <[email-masked]>
To: [email-masked]
Date: Sat, 28 Aug 2021 21:33:50 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

I spent a few hours today trying to make it work, and as far I can see multiple dictionaries support is just broken.

# Steps to reproduce

Note: for 2nd step here not to throw exception you need to make sure you have both hunspell dictionaries used in (ispell-hunspell-add-multi-dic …) call installed in the system.

1. Start `emacs -Q`
2. Evaluate:
    (progn
      (require 'ispell)
      (setq ispell-program-name "hunspell")
      (ispell-hunspell-add-multi-dic "ru_RU,en_US")
      (flyspell-mode 1)
      )
3. Execute in a shell `ps aux | grep hunspell`

## Expected

The `hunspell` process has argument `-d ru_RU,en_US`

## Actual

The `hunspell` process has argument `-d en_US`

## Additional information

M-x report-emacs-bug output goes below:

In GNU Emacs 28.0.50 (build 6, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4)
 of 2021-08-05 built on constantine-N61Ja
Repository revision: 3dbbcc9a255ce2703d42792e6967797b78e8720b
Repository branch: makepkg
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --with-sound=alsa --with-modules --without-gconf --without-gsettings
 --enable-link-time-optimization --with-x-toolkit=gtk3 --without-xaw3d
 --without-compress-install
 '--program-transform-name=s/\([ec]tags\)/\1.emacs/' 'CFLAGS=-flto=2
 -march=native -O3 -pipe -fno-stack-protector -fweb
 -fmerge-all-constants -fno-plt -fcommon -flto -fuse-linker-plugin -flto
 -fuse-linker-plugin' 'LDFLAGS=-flto=2 -O3 -march=native -fweb
 -fmerge-all-constants -floop-nest-optimize -Wl,--sort-common,-z,relro
 -fno-plt -fcommon''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM HARFBUZZ JPEG JSON LCMS2
LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM
GTK3 ZLIB

Important settings:
  value of $LC_TIME: ru_RU.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
  yas-global-mode: t
  yas-minor-mode: t
  global-color-identifiers-mode: t
  color-identifiers-mode: t
  delete-selection-mode: t
  winum-mode: t
  symbol-overlay-mode: t
  global-symbol-overlay-mode: t
  global-highlight-parentheses-mode: t
  highlight-parentheses-mode: t
  show-smartparens-global-mode: t
  show-smartparens-mode: t
  smartparens-global-mode: t
  smartparens-mode: t
  highlight-numbers-mode: t
  evil-goggles-mode: t
  global-evil-surround-mode: t
  evil-surround-mode: t
  shell-dirtrack-mode: t
  evil-mode: t
  evil-local-mode: t
  windmove-mode: t
  global-auto-revert-mode: t
  global-company-mode: t
  company-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/constantine/.emacs.d/lisp/idomenu hides /home/constantine/.emacs.d/elpa/idomenu-20141123.2120/idomenu
/home/constantine/.emacs.d/lisp/popup hides /home/constantine/.emacs.d/elpa/popup-20210625.400/popup
/home/constantine/.emacs.d/elpa/cmake-mode-20210104.1831/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode
/home/constantine/.emacs.d/elpa/transient-20210723.1601/transient hides /usr/share/emacs/28.0.50/lisp/transient

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils dabbrev server undo-fu imenu pp eieio-opt
speedbar ezimage dframe shortdoc text-property-search flycheck debug
backtrace quail smartparens-markdown markdown-mode noutline outline smex
find-func cl-print help-fns radix-tree tabify yasnippet-snippets
yasnippet face-remap color-identifiers-mode smartparens-python python
tramp-sh tramp tramp-loaddefs trampver tramp-integration tramp-compat
parse-time iso8601 time-date ls-lisp format-spec misearch multi-isearch
vc-git diff-mode vc-dispatcher delsel winum symbol-overlay
highlight-parentheses sp-sublimetext-like smartparens-config
smartparens-text smartparens dash highlight-numbers parent-mode ido
evil-goggles pulse color evil-surround emvil evil evil-keybindings
evil-integration evil-maps evil-commands reveal flyspell ispell
evil-jumps evil-command-window evil-types evil-search evil-ex shell
pcomplete comint ansi-color evil-macros evil-repeat evil-states
evil-core advice evil-common windmove calc calc-loaddefs calc-macs
thingatpt rect evil-digraphs evil-vars avy autorevert filenotify
company-oddmuse company-keywords company-etags etags fileloop generator
xref project ring company-gtags files-x company-dabbrev-code
company-dabbrev company-files company-clang company-capf company-cmake
company-semantic company-template company-bbdb company pcase cl-extra
help-mode use-package-bind-key use-package-core edmacro kmacro bind-key
easy-mmode rx cc-styles cc-align cc-engine cc-vars cc-defs info package
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json subr-x map url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting font-render-setting cairo move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 353438 136088)
 (symbols 48 24458 1)
 (strings 32 87321 23690)
 (string-bytes 1 2859020)
 (vectors 16 53736)
 (vector-slots 8 1417151 443852)
 (floats 8 276 1005)
 (intervals 56 13087 471)
 (buffers 992 21))