* bug#50241: flyspell doesn't work with multiple dictionaries @ 2021-08-28 18:33 Konstantin Kharlamov 2021-08-28 18:56 ` Eli Zaretskii [not found] ` <handler.50241.B.163017564419363.ack@debbugs.gnu.org> 0 siblings, 2 replies; 18+ messages in thread From: Konstantin Kharlamov @ 2021-08-28 18:33 UTC (permalink / raw) To: 50241 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)) ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#50241: flyspell doesn't work with multiple dictionaries 2021-08-28 18:33 bug#50241: flyspell doesn't work with multiple dictionaries Konstantin Kharlamov @ 2021-08-28 18:56 ` Eli Zaretskii 2021-08-28 19:05 ` Konstantin Kharlamov [not found] ` <handler.50241.B.163017564419363.ack@debbugs.gnu.org> 1 sibling, 1 reply; 18+ messages in thread From: Eli Zaretskii @ 2021-08-28 18:56 UTC (permalink / raw) To: Konstantin Kharlamov; +Cc: 50241 > From: Konstantin Kharlamov <hi-angel@yandex.ru> > Date: Sat, 28 Aug 2021 21:33:50 +0300 > > # 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) > ) You miss this step at the end: (ispell-change-dictionary "ru_RU,en_US") It tells Emacs to restart Hunspell with these two dictionaries. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#50241: flyspell doesn't work with multiple dictionaries 2021-08-28 18:56 ` Eli Zaretskii @ 2021-08-28 19:05 ` Konstantin Kharlamov 2021-08-28 19:35 ` Konstantin Kharlamov 2021-08-28 19:36 ` Eli Zaretskii 0 siblings, 2 replies; 18+ messages in thread From: Konstantin Kharlamov @ 2021-08-28 19:05 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 50241 On Sat, 2021-08-28 at 21:56 +0300, Eli Zaretskii wrote: > > You miss this step at the end: > > (ispell-change-dictionary "ru_RU,en_US") > > It tells Emacs to restart Hunspell with these two dictionaries. Thank you! Running this command results in error: (error "Undefined dictionary: ru_RU,en_US") ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#50241: flyspell doesn't work with multiple dictionaries 2021-08-28 19:05 ` Konstantin Kharlamov @ 2021-08-28 19:35 ` Konstantin Kharlamov 2021-08-28 19:36 ` Eli Zaretskii 1 sibling, 0 replies; 18+ messages in thread From: Konstantin Kharlamov @ 2021-08-28 19:35 UTC (permalink / raw) Cc: 50241 I found a wrokaround: executing the following code *twice* makes it work: (progn (require 'ispell) (setq ispell-program-name "hunspell") (ispell-hunspell-add-multi-dic "ru_RU,en_US") (setq ispell-local-dictionary '(("ru_RU,en_US" "[[:alpha:]]" "[^[:alpha:]]" "['0-9]" t ("-d" "ru_RU,en_US") nil utf-8))) (ispell-change-dictionary "ru_RU,en_US") (flyspell-mode 1) ) So, manually creating an entry in ispell-local-dictionary makes it work. However note I emphasized "twice" word — for some readon (I don't know why) even this workaround works if you execute this code twice. On the first evaluation it always generates an error. I tried changing the order of various expressions, but so far wasn't able to make it behave always same way (not sure it really matters though as it's just a a workaround). ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#50241: flyspell doesn't work with multiple dictionaries 2021-08-28 19:05 ` Konstantin Kharlamov 2021-08-28 19:35 ` Konstantin Kharlamov @ 2021-08-28 19:36 ` Eli Zaretskii 2021-08-28 19:45 ` Konstantin Kharlamov 1 sibling, 1 reply; 18+ messages in thread From: Eli Zaretskii @ 2021-08-28 19:36 UTC (permalink / raw) To: Konstantin Kharlamov; +Cc: 50241 > From: Konstantin Kharlamov <hi-angel@yandex.ru> > Cc: 50241@debbugs.gnu.org > Date: Sat, 28 Aug 2021 22:05:55 +0300 > > On Sat, 2021-08-28 at 21:56 +0300, Eli Zaretskii wrote: > > > > You miss this step at the end: > > > > (ispell-change-dictionary "ru_RU,en_US") > > > > It tells Emacs to restart Hunspell with these two dictionaries. > > Thank you! Running this command results in error: > > (error "Undefined dictionary: ru_RU,en_US") Strange. Here, it doesn't error out. I did this: M-x flyspell-mode RET M-x ispell-hunspell-add-multi-dic RET ru_RU,en_US RET M-x ispell-change-dictionary RET ru_RU,en_US RET And I don't get any errors, and flyspell-mode works for both Russian and English. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#50241: flyspell doesn't work with multiple dictionaries 2021-08-28 19:36 ` Eli Zaretskii @ 2021-08-28 19:45 ` Konstantin Kharlamov 2021-08-28 20:02 ` Konstantin Kharlamov 0 siblings, 1 reply; 18+ messages in thread From: Konstantin Kharlamov @ 2021-08-28 19:45 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 50241 On Sat, 2021-08-28 at 22:36 +0300, Eli Zaretskii wrote: > > From: Konstantin Kharlamov <hi-angel@yandex.ru> > > Cc: 50241@debbugs.gnu.org > > Date: Sat, 28 Aug 2021 22:05:55 +0300 > > > > On Sat, 2021-08-28 at 21:56 +0300, Eli Zaretskii wrote: > > > > > > You miss this step at the end: > > > > > > (ispell-change-dictionary "ru_RU,en_US") > > > > > > It tells Emacs to restart Hunspell with these two dictionaries. > > > > Thank you! Running this command results in error: > > > > (error "Undefined dictionary: ru_RU,en_US") > > Strange. Here, it doesn't error out. I did this: > > M-x flyspell-mode RET > M-x ispell-hunspell-add-multi-dic RET ru_RU,en_US RET > M-x ispell-change-dictionary RET ru_RU,en_US RET > > And I don't get any errors, and flyspell-mode works for both Russian > and English. Thank you! With a little modification for steps to be: M-x flyspell-mode RET M-: (setq ispell-program-name "hunspell") M-x ispell-hunspell-add-multi-dic RET ru_RU,en_US RET M-x ispell-change-dictionary RET ru_RU,en_US RET this worked for me! Hmm, let me try to experiment with that a bit to see why it didn't work for me non-interactively… ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#50241: flyspell doesn't work with multiple dictionaries 2021-08-28 19:45 ` Konstantin Kharlamov @ 2021-08-28 20:02 ` Konstantin Kharlamov 2021-08-28 20:19 ` Konstantin Kharlamov 0 siblings, 1 reply; 18+ messages in thread From: Konstantin Kharlamov @ 2021-08-28 20:02 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 50241 On Sat, 2021-08-28 at 22:45 +0300, Konstantin Kharlamov wrote: > On Sat, 2021-08-28 at 22:36 +0300, Eli Zaretskii wrote: > > > From: Konstantin Kharlamov <hi-angel@yandex.ru> > > > Cc: 50241@debbugs.gnu.org > > > Date: Sat, 28 Aug 2021 22:05:55 +0300 > > > > > > On Sat, 2021-08-28 at 21:56 +0300, Eli Zaretskii wrote: > > > > > > > > You miss this step at the end: > > > > > > > > (ispell-change-dictionary "ru_RU,en_US") > > > > > > > > It tells Emacs to restart Hunspell with these two dictionaries. > > > > > > Thank you! Running this command results in error: > > > > > > (error "Undefined dictionary: ru_RU,en_US") > > > > Strange. Here, it doesn't error out. I did this: > > > > M-x flyspell-mode RET > > M-x ispell-hunspell-add-multi-dic RET ru_RU,en_US RET > > M-x ispell-change-dictionary RET ru_RU,en_US RET > > > > And I don't get any errors, and flyspell-mode works for both Russian > > and English. > > Thank you! With a little modification for steps to be: > > M-x flyspell-mode RET > M-: (setq ispell-program-name "hunspell") > M-x ispell-hunspell-add-multi-dic RET ru_RU,en_US RET > M-x ispell-change-dictionary RET ru_RU,en_US RET > > this worked for me! Hmm, let me try to experiment with that a bit to see why > it > didn't work for me non-interactively… Okay, so the bug seems to be in ispell-hunspell-add-multi-dic function. When called interactively, then the following interactive call to (ispell-change-dictionary) has the ru_RU,en_US dictionary as a completion. However, if ispell-hunspell-add-multi-dic was called non-interactively, the completion from the subsequent (ispell-change-dictionary) call seems to be missing. Not sure though why the difference in behaviour, the "interactive" part of that function look innocent, simply (interactive "sPrompt"). Not sure what starting "s" means though. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#50241: flyspell doesn't work with multiple dictionaries 2021-08-28 20:02 ` Konstantin Kharlamov @ 2021-08-28 20:19 ` Konstantin Kharlamov 2021-08-28 20:26 ` Konstantin Kharlamov 0 siblings, 1 reply; 18+ messages in thread From: Konstantin Kharlamov @ 2021-08-28 20:19 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 50241 On Sat, 2021-08-28 at 23:02 +0300, Konstantin Kharlamov wrote: > On Sat, 2021-08-28 at 22:45 +0300, Konstantin Kharlamov wrote: > > On Sat, 2021-08-28 at 22:36 +0300, Eli Zaretskii wrote: > > > > From: Konstantin Kharlamov <hi-angel@yandex.ru> > > > > Cc: 50241@debbugs.gnu.org > > > > Date: Sat, 28 Aug 2021 22:05:55 +0300 > > > > > > > > On Sat, 2021-08-28 at 21:56 +0300, Eli Zaretskii wrote: > > > > > > > > > > You miss this step at the end: > > > > > > > > > > (ispell-change-dictionary "ru_RU,en_US") > > > > > > > > > > It tells Emacs to restart Hunspell with these two dictionaries. > > > > > > > > Thank you! Running this command results in error: > > > > > > > > (error "Undefined dictionary: ru_RU,en_US") > > > > > > Strange. Here, it doesn't error out. I did this: > > > > > > M-x flyspell-mode RET > > > M-x ispell-hunspell-add-multi-dic RET ru_RU,en_US RET > > > M-x ispell-change-dictionary RET ru_RU,en_US RET > > > > > > And I don't get any errors, and flyspell-mode works for both Russian > > > and English. > > > > Thank you! With a little modification for steps to be: > > > > M-x flyspell-mode RET > > M-: (setq ispell-program-name "hunspell") > > M-x ispell-hunspell-add-multi-dic RET ru_RU,en_US RET > > M-x ispell-change-dictionary RET ru_RU,en_US RET > > > > this worked for me! Hmm, let me try to experiment with that a bit to see why > > it > > didn't work for me non-interactively… > > Okay, so the bug seems to be in ispell-hunspell-add-multi-dic function. When > called interactively, then the following interactive call to (ispell-change- > dictionary) has the ru_RU,en_US dictionary as a completion. However, if > ispell-hunspell-add-multi-dic was called non-interactively, the completion > from the subsequent (ispell-change-dictionary) call seems to be missing. > > Not sure though why the difference in behaviour, the "interactive" part of > that function look innocent, simply (interactive "sPrompt"). Not sure what > starting "s" means though. Okay, so, I figured there's some sort of odd cooperation between (ispell-hunspell-add-multi-dic) and (ispell-change-dictionary) going on. When the first is called non-interactively, interactive call to the second results in no completion for the new dict, right? So, the fun thing is that if you abort prompt afterwards, then you call (ispell-hunspell-add-multi-dic) again, and then you call (ispell-change-dictionary) interactively again, the prompt will have the completion. It looks as if call to (ispell-change-dictionary) initializes some important variable required by (ispell-hunspell-add-multi-dic) to function properly. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#50241: flyspell doesn't work with multiple dictionaries 2021-08-28 20:19 ` Konstantin Kharlamov @ 2021-08-28 20:26 ` Konstantin Kharlamov 2021-08-28 20:42 ` Konstantin Kharlamov 0 siblings, 1 reply; 18+ messages in thread From: Konstantin Kharlamov @ 2021-08-28 20:26 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 50241 On Sat, 2021-08-28 at 23:19 +0300, Konstantin Kharlamov wrote: > On Sat, 2021-08-28 at 23:02 +0300, Konstantin Kharlamov wrote: > > On Sat, 2021-08-28 at 22:45 +0300, Konstantin Kharlamov wrote: > > > On Sat, 2021-08-28 at 22:36 +0300, Eli Zaretskii wrote: > > > > > From: Konstantin Kharlamov <hi-angel@yandex.ru> > > > > > Cc: 50241@debbugs.gnu.org > > > > > Date: Sat, 28 Aug 2021 22:05:55 +0300 > > > > > > > > > > On Sat, 2021-08-28 at 21:56 +0300, Eli Zaretskii wrote: > > > > > > > > > > > > You miss this step at the end: > > > > > > > > > > > > (ispell-change-dictionary "ru_RU,en_US") > > > > > > > > > > > > It tells Emacs to restart Hunspell with these two dictionaries. > > > > > > > > > > Thank you! Running this command results in error: > > > > > > > > > > (error "Undefined dictionary: ru_RU,en_US") > > > > > > > > Strange. Here, it doesn't error out. I did this: > > > > > > > > M-x flyspell-mode RET > > > > M-x ispell-hunspell-add-multi-dic RET ru_RU,en_US RET > > > > M-x ispell-change-dictionary RET ru_RU,en_US RET > > > > > > > > And I don't get any errors, and flyspell-mode works for both Russian > > > > and English. > > > > > > Thank you! With a little modification for steps to be: > > > > > > M-x flyspell-mode RET > > > M-: (setq ispell-program-name "hunspell") > > > M-x ispell-hunspell-add-multi-dic RET ru_RU,en_US RET > > > M-x ispell-change-dictionary RET ru_RU,en_US RET > > > > > > this worked for me! Hmm, let me try to experiment with that a bit to see > > > why > > > it > > > didn't work for me non-interactively… > > > > Okay, so the bug seems to be in ispell-hunspell-add-multi-dic function. When > > called interactively, then the following interactive call to (ispell-change- > > dictionary) has the ru_RU,en_US dictionary as a completion. However, if > > ispell-hunspell-add-multi-dic was called non-interactively, the completion > > from the subsequent (ispell-change-dictionary) call seems to be missing. > > > > Not sure though why the difference in behaviour, the "interactive" part of > > that function look innocent, simply (interactive "sPrompt"). Not sure what > > starting "s" means though. > > Okay, so, I figured there's some sort of odd cooperation between (ispell- > hunspell-add-multi-dic) and (ispell-change-dictionary) going on. > > When the first is called non-interactively, interactive call to the second > results in no completion for the new dict, right? So, the fun thing is that if > you abort prompt afterwards, then you call (ispell-hunspell-add-multi-dic) > again, and then you call (ispell-change-dictionary) interactively again, the > prompt will have the completion. > > It looks as if call to (ispell-change-dictionary) initializes some important > variable required by (ispell-hunspell-add-multi-dic) to function properly. …and, the function that needs to be called before (ispell-hunspell-add-multi-dic "ru_RU,en_US") is (ispell-valid-dictionary-list) ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#50241: flyspell doesn't work with multiple dictionaries 2021-08-28 20:26 ` Konstantin Kharlamov @ 2021-08-28 20:42 ` Konstantin Kharlamov 2021-08-29 6:12 ` Eli Zaretskii 0 siblings, 1 reply; 18+ messages in thread From: Konstantin Kharlamov @ 2021-08-28 20:42 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 50241 Okay, I finally found the working combination, it is: (progn (require 'ispell) (setq ispell-program-name "hunspell") (ispell-set-spellchecker-params) (ispell-hunspell-add-multi-dic "ru_RU,en_US") (ispell-change-dictionary "ru_RU,en_US") (flyspell-mode 1) ) So, the magical function is `(ispell-set-spellchecker-params)`. Judging by its description, it has to be called before any ispell usage. I can probably call it manually, but I presume the behaviour needs fixing. I think perhaps, should ispell have a global variable like `ispell-initialized`, which then would be set in (ispell-set-spellchecker-params). And then the variable would be checked in `ispell-hunspell-add-multi-dic`, and if it wasn't set, throw an exception "Ispell wasn't initialized. Please call `(ispell-set-spellchecker-params)'"? ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#50241: flyspell doesn't work with multiple dictionaries 2021-08-28 20:42 ` Konstantin Kharlamov @ 2021-08-29 6:12 ` Eli Zaretskii 2021-08-29 12:43 ` Konstantin Kharlamov 0 siblings, 1 reply; 18+ messages in thread From: Eli Zaretskii @ 2021-08-29 6:12 UTC (permalink / raw) To: Konstantin Kharlamov; +Cc: 50241 > From: Konstantin Kharlamov <hi-angel@yandex.ru> > Cc: 50241@debbugs.gnu.org > Date: Sat, 28 Aug 2021 23:42:08 +0300 > > Okay, I finally found the working combination, it is: > > (progn > (require 'ispell) > (setq ispell-program-name "hunspell") > (ispell-set-spellchecker-params) > (ispell-hunspell-add-multi-dic "ru_RU,en_US") > (ispell-change-dictionary "ru_RU,en_US") > (flyspell-mode 1) > ) > > So, the magical function is `(ispell-set-spellchecker-params)`. Judging by its description, it has to be called before any ispell usage. > > I can probably call it manually, but I presume the behaviour needs fixing. I'm not sure I agree. These are commands that are supposed to be invoked interactively, in the order I've shown, which works. If you want to make this part of your initialization, you need to figure out the required sequence of calls, which you did. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#50241: flyspell doesn't work with multiple dictionaries 2021-08-29 6:12 ` Eli Zaretskii @ 2021-08-29 12:43 ` Konstantin Kharlamov 2021-08-29 13:07 ` Eli Zaretskii 0 siblings, 1 reply; 18+ messages in thread From: Konstantin Kharlamov @ 2021-08-29 12:43 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 50241 On Sun, 2021-08-29 at 09:12 +0300, Eli Zaretskii wrote: > > From: Konstantin Kharlamov <hi-angel@yandex.ru> > > Cc: 50241@debbugs.gnu.org > > Date: Sat, 28 Aug 2021 23:42:08 +0300 > > > > Okay, I finally found the working combination, it is: > > > > (progn > > (require 'ispell) > > (setq ispell-program-name "hunspell") > > (ispell-set-spellchecker-params) > > (ispell-hunspell-add-multi-dic "ru_RU,en_US") > > (ispell-change-dictionary "ru_RU,en_US") > > (flyspell-mode 1) > > ) > > > > So, the magical function is `(ispell-set-spellchecker-params)`. Judging by > > its description, it has to be called before any ispell usage. > > > > I can probably call it manually, but I presume the behaviour needs fixing. > > I'm not sure I agree. These are commands that are supposed to be > invoked interactively, in the order I've shown, which works. If you > want to make this part of your initialization, you need to figure out > the required sequence of calls, which you did. Would you agree if I say that a good user interface means that a function invoked interactively should behave same way when it's invoked non-interactively (barring the fact that it won't show the prompt)? I would say that the answer is yes, otherwise it is very confusing. So I would say, at least the (ispell-set-spellchecker-params) needs to be added into one of them, so the same order as if they were called interactively would work when they are invoked from a Emacs Lisp file. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#50241: flyspell doesn't work with multiple dictionaries 2021-08-29 12:43 ` Konstantin Kharlamov @ 2021-08-29 13:07 ` Eli Zaretskii 2021-08-29 19:50 ` Lars Ingebrigtsen 0 siblings, 1 reply; 18+ messages in thread From: Eli Zaretskii @ 2021-08-29 13:07 UTC (permalink / raw) To: Konstantin Kharlamov; +Cc: 50241 > From: Konstantin Kharlamov <hi-angel@yandex.ru> > Cc: 50241@debbugs.gnu.org > Date: Sun, 29 Aug 2021 15:43:30 +0300 > > > I'm not sure I agree. These are commands that are supposed to be > > invoked interactively, in the order I've shown, which works. If you > > want to make this part of your initialization, you need to figure out > > the required sequence of calls, which you did. > > Would you agree if I say that a good user interface means that a function invoked interactively should behave same way when it's invoked non-interactively (barring the fact that it won't show the prompt)? No, I don't agree. And neither does Emacs: the 'interactive' form is not necessarily a no-op. As a trivial example, consider: describe-char is an autoloaded interactive compiled Lisp function in ‘descr-text.el’. (describe-char POS &optional BUFFER) Probably introduced at or before Emacs version 22.1. Describe position POS (interactively, point) and the char after POS. ^^^^^^^^^^^^^^^^^^^^^^ As you see, there's some magic happening in interactive invocations that doesn't happen when you call this function from Lisp. A less trivial example: previous-line is an interactive compiled Lisp function in ‘simple.el’. It is bound to C-p, <up>. (previous-line &optional ARG TRY-VSCROLL) This function is for interactive use only; in Lisp code use `forward-line' with negative argument instead. Move cursor vertically up ARG lines. Interactively, vscroll tall lines if ‘auto-window-vscroll’ is enabled. Non-interactively, use TRY-VSCROLL to control whether to vscroll tall lines: if either ‘auto-window-vscroll’ or TRY-VSCROLL is nil, this function will not vscroll. Again, the behavior in interactive and non-interactive calls is different. > So I would say, at least the (ispell-set-spellchecker-params) needs to be added into one of them, so the same order as if they were called interactively would work when they are invoked from a Emacs Lisp file. Maybe, I need to think about it. But the general principle still stands: it is okay for interactive and non-interactive invocations to behave differently. We do it all the time in Emacs. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#50241: flyspell doesn't work with multiple dictionaries 2021-08-29 13:07 ` Eli Zaretskii @ 2021-08-29 19:50 ` Lars Ingebrigtsen 2021-08-30 2:24 ` Eli Zaretskii 0 siblings, 1 reply; 18+ messages in thread From: Lars Ingebrigtsen @ 2021-08-29 19:50 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 50241, Konstantin Kharlamov Eli Zaretskii <eliz@gnu.org> writes: >> Would you agree if I say that a good user interface means that a >> function invoked interactively should behave same way when it's >> invoked non-interactively (barring the fact that it won't show the >> prompt)? > > No, I don't agree. Well, it should be possible to set up multiple dictionaries without using `M-x'. So something here should be fixed, in my opinion. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#50241: flyspell doesn't work with multiple dictionaries 2021-08-29 19:50 ` Lars Ingebrigtsen @ 2021-08-30 2:24 ` Eli Zaretskii 2021-08-30 2:27 ` Lars Ingebrigtsen 0 siblings, 1 reply; 18+ messages in thread From: Eli Zaretskii @ 2021-08-30 2:24 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: 50241, hi-angel > From: Lars Ingebrigtsen <larsi@gnus.org> > Cc: Konstantin Kharlamov <hi-angel@yandex.ru>, 50241@debbugs.gnu.org > Date: Sun, 29 Aug 2021 21:50:10 +0200 > > Eli Zaretskii <eliz@gnu.org> writes: > > >> Would you agree if I say that a good user interface means that a > >> function invoked interactively should behave same way when it's > >> invoked non-interactively (barring the fact that it won't show the > >> prompt)? > > > > No, I don't agree. > > Well, it should be possible to set up multiple dictionaries without > using `M-x'. It is already possible, see the recipe up-thread. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#50241: flyspell doesn't work with multiple dictionaries 2021-08-30 2:24 ` Eli Zaretskii @ 2021-08-30 2:27 ` Lars Ingebrigtsen 2021-08-30 12:49 ` Eli Zaretskii 0 siblings, 1 reply; 18+ messages in thread From: Lars Ingebrigtsen @ 2021-08-30 2:27 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 50241, hi-angel Eli Zaretskii <eliz@gnu.org> writes: >> Well, it should be possible to set up multiple dictionaries without >> using `M-x'. > > It is already possible, see the recipe up-thread. Right. But it should be documented -- I think mentioning `ispell-set-spellchecker-params' is what's missing. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#50241: flyspell doesn't work with multiple dictionaries 2021-08-30 2:27 ` Lars Ingebrigtsen @ 2021-08-30 12:49 ` Eli Zaretskii 0 siblings, 0 replies; 18+ messages in thread From: Eli Zaretskii @ 2021-08-30 12:49 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: hi-angel, 50241-done > From: Lars Ingebrigtsen <larsi@gnus.org> > Cc: hi-angel@yandex.ru, 50241@debbugs.gnu.org > Date: Mon, 30 Aug 2021 04:27:28 +0200 > > Eli Zaretskii <eliz@gnu.org> writes: > > >> Well, it should be possible to set up multiple dictionaries without > >> using `M-x'. > > > > It is already possible, see the recipe up-thread. > > Right. But it should be documented -- I think > mentioning `ispell-set-spellchecker-params' is what's missing. OK, I made such a change in the doc string of ispell-hunspell-add-multi-dic, and I'm therefore closing this bug report. ^ permalink raw reply [flat|nested] 18+ messages in thread
[parent not found: <handler.50241.B.163017564419363.ack@debbugs.gnu.org>]
* bug#50241: Acknowledgement (flyspell doesn't work with multiple dictionaries) [not found] ` <handler.50241.B.163017564419363.ack@debbugs.gnu.org> @ 2021-08-28 18:59 ` Konstantin Kharlamov 0 siblings, 0 replies; 18+ messages in thread From: Konstantin Kharlamov @ 2021-08-28 18:59 UTC (permalink / raw) To: 50241 Alright, partially I made it to work: adding a line `(setq ispell-dictionary "ru_RU,en_US")` as in: (progn (require 'ispell) (setq ispell-program-name "hunspell") (ispell-hunspell-add-multi-dic "ru_RU,en_US") (setq ispell-dictionary "ru_RU,en_US") (flyspell-mode 1) ) Launches the process with correct args. However, in this case running `(flyspell-mode 1)` ends up with an error Error in post-command-hook (flyspell-post-command-hook): (error "No data for dictionary \"ru_RU,en_US\" in ‘ispell-local-dictionary-alist’ or ‘ispell-dictionary-alist’") On Sat, 2021-08-28 at 18:35 +0000, GNU bug Tracking System wrote: > Thank you for filing a new bug report with debbugs.gnu.org. > > This is an automatically generated reply to let you know your message > has been received. > > Your message is being forwarded to the package maintainers and other > interested parties for their attention; they will reply in due course. > > Your message has been sent to the package maintainer(s): > bug-gnu-emacs@gnu.org > > If you wish to submit further information on this problem, please > send it to 50241@debbugs.gnu.org. > > Please do not send mail to help-debbugs@gnu.org unless you wish > to report a problem with the Bug-tracking system. > ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2021-08-30 12:49 UTC | newest] Thread overview: 18+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-08-28 18:33 bug#50241: flyspell doesn't work with multiple dictionaries Konstantin Kharlamov 2021-08-28 18:56 ` Eli Zaretskii 2021-08-28 19:05 ` Konstantin Kharlamov 2021-08-28 19:35 ` Konstantin Kharlamov 2021-08-28 19:36 ` Eli Zaretskii 2021-08-28 19:45 ` Konstantin Kharlamov 2021-08-28 20:02 ` Konstantin Kharlamov 2021-08-28 20:19 ` Konstantin Kharlamov 2021-08-28 20:26 ` Konstantin Kharlamov 2021-08-28 20:42 ` Konstantin Kharlamov 2021-08-29 6:12 ` Eli Zaretskii 2021-08-29 12:43 ` Konstantin Kharlamov 2021-08-29 13:07 ` Eli Zaretskii 2021-08-29 19:50 ` Lars Ingebrigtsen 2021-08-30 2:24 ` Eli Zaretskii 2021-08-30 2:27 ` Lars Ingebrigtsen 2021-08-30 12:49 ` Eli Zaretskii [not found] ` <handler.50241.B.163017564419363.ack@debbugs.gnu.org> 2021-08-28 18:59 ` bug#50241: Acknowledgement (flyspell doesn't work with multiple dictionaries) Konstantin Kharlamov
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.