El sáb, 26 jun 2021 a las 14:39, Maxim Nikulin (<maniku...@gmail.com>) escribió:
>
> Package: dictionaries-common
> Version: 1.28.4
> Severity: normal

Hi, Maxim, thanks for the info

> Debian stuff dealing with list of dictionaries available for Emacs
> sometimes causes problems.
>
> 3. Try to customize ispell-dictionary when ispell package is not loaded
>     yet, e.g. (add HOME=... if necessary)
>
>         emacs --eval "(customize-option 'ispell-dictionary)"
>
> 4. Set some string value, e.g "en_US" and try to save for future
>     sessions.
>
> *Actual result*:
>
>      custom-push-theme: Symbol’s value as variable is void:
> default-dictionary

Confirmed

> Expected result: customization is saved to ~/.emacs
> (or ~/.emacs.d/init.el, etc.)
>
> Workaround for this case:
>
>      M-: (require 'ispell) RET
>
> and save for future sessions again.

ispell.el is loaded only after a spellchecking command is issued or
after request. This means that there is no problen once ispell.el is
loaded.  However, in Debian we would expect ispell-dictionary to be
customizable before  that, and use standard defaults if not, so this
is strange.

> I think, the issue is caused by line 442 in
> /usr/share/dictionaries-common/site-elisp/debian-ispell.el
>
>      (or (boundp 'ispell-dictionary)
>          (defcustom ispell-dictionary default-dictionary
...
> where default-dictionary is local to let*. Unsure if defvar will
> be better for this purpose.

The funny thing is that if I change default-dictionary to nil in that
line problem seems to still be present. Unless I am missing some side
effect assignation, seems that the problem is related to have that
defcustom inside a function, but I do not really know why that
happens.

The good thing is that moving that defcustom out of the function and
leaving inside just the code to assign a value if not previously set
seems to work. At least it seems so with attached patch. I will test
this a bit more, but even if everything works, do not expect an upload
until new Debian bullseye is released.

Thanks for your contribution to Debian.

Regards,

-- 
Agust
--- debian-ispell.el.orig	2021-06-26 21:35:17.993190868 +0200
+++ debian-ispell.el	2021-06-26 21:50:06.715333471 +0200
@@ -438,12 +438,8 @@
 
     ;; Set `ispell-dictionary' if still unbound. This will be done after
     ;; init files load, with real `ispell-program-name'
-    (or (boundp 'ispell-dictionary)
-	(defcustom ispell-dictionary default-dictionary
-	  "Default dictionary to use if `ispell-local-dictionary' is nil."
-	  :type '(choice string
-			 (const :tag "default" nil))
-	  :group 'ispell))
+    (or ispell-dictionary
+	(setq ispell-dictionary default-dictionary))
 
     ;; The debugging output if required
     (if debian-dict-common-debug
@@ -493,4 +489,11 @@
              (ispell-set-spellchecker-params)))
   :group 'ispell)
 
+
+(defcustom ispell-dictionary nil
+  "Default dictionary to use if `ispell-local-dictionary' is nil."
+  :type '(choice string
+		 (const :tag "default" nil))
+  :group 'ispell)
+
 ;;; -----------------------------------------------------------------------

Reply via email to