Bug 250539 - editors/emacs fails to start with error "Symbol's value as variable is void
Summary: editors/emacs fails to start with error "Symbol's value as variable is void
Status: Closed Works As Intended
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: emacs@FreeBSD.org (Nobody)
Depends on:
Reported: 2020-10-22 19:00 UTC by icjohnson
Modified: 2020-10-24 17:24 UTC (History)
2 users (show)

See Also:
linimon: maintainer-feedback? (emacs)


Note You need to log in before you can comment on or make changes to this bug.
Description icjohnson 2020-10-22 19:00:05 UTC
Emacs fails to start with error "Symbol's value as variable is void


Debugger entered--Lisp error: (void-variable ispell-dictionary-alist)
  (member '("hunspell" "[[:alpha:]]" "[^[:alpha]]" "[']" t ("-d" "en_CA") nil nil) ispell-dictionar$
  (if (member '("hunspell" "[[:alpha:]]" "[^[:alpha]]" "[']" t ("-d" "en_CA") nil nil) ispell-dicti$
  eval-buffer(#<buffer  *load*-755858> nil "/usr/home/ian/.emacs.d/spell.el" nil t)  ; Reading at b$
  load-with-code-conversion("/usr/home/ian/.emacs.d/spell.el" "/usr/home/ian/.emacs.d/spell.el" nil$
  eval-buffer(#<buffer  *load*> nil "/home/ian/.emacs" nil t)  ; Reading at buffer position 92      
  load-with-code-conversion("/home/ian/.emacs" "/home/ian/.emacs" t t)
  load("~/.emacs" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x20089743d>) #f(compiled-functio$

As per:

Comment 1 Ashish SHUKLA freebsd_committer 2020-10-23 06:10:25 UTC

Could you share the contents of ".emacs", and ".emacs.d/spell.el", so we can try to reproduce it ?

Comment 2 icjohnson 2020-10-23 12:07:10 UTC
Sure Ashish,

Thank you for looking into this!

Clean install - Emacs is always first.


(add-to-list 'load-path "/usr/home/ian/.emacs.d/")
(load "/usr/home/ian/.emacs.d/spell.el")


(setq ispell-program-name "hunspell"
      ispell-dictionary "en_CA")
(add-to-list 'ispell-dictionary-alist '("english-hunspell"
					("-d" "en_CA")
(set-default 'ispell-dictionary "english-hunspell")
Comment 3 Ashish SHUKLA freebsd_committer 2020-10-23 16:24:57 UTC
(In reply to icjohnson from comment #2)


I believe what you're seeing is the expected behaviour with `add-to-list' function:

    (add-to-list LIST-VAR ELEMENT &optional APPEND COMPARE-FN)

This is because `add-to-list' function expects LIST-VAR binding to exist (or already defined) which in your case is not, as it's defined in "ispell" which you're not load-ing (or require-ing). You can resolve it in two ways:

1. Add an entry to `after-load-list' using `eval-after-load' function which will defer the execution of `add-to-list' form until after "ispell" is loaded, which is when `ispell-dictionary-alist' will be defined: 

    (eval-after-load "ispell"
      '(add-to-list 'ispell-dictionary-alist
                    '("english-hunspell" "[[:alpha:]]" "[^[:alpha]]" "[']" t ("-d" "en_CA") nil)))

2. Use `setq' to define it like you're doing for other variables, that way you'll create a binding yourself:

     (setq ispell-dictionary-alist (list '("english-hunspell" "[[:alpha:]]" "[^[:alpha]]" "[']" t ("-d" "en_CA") nil)))

Comment 4 icjohnson 2020-10-24 17:23:35 UTC
Apologies - of course you are correct - thx.