Am 10.06.22 um 11:57 schrieb Lars Ingebrigtsen:
Andreas Röhler <andreas.roehler@easy-emacs.de> writes:

The code below evaluates to nil, but should send an error:

(defvar foo-bar-baz
  (cond 
      (t ()
      (when foo-bar-baz nil))))

Emacs 28.1 tells as expected:

Debugger entered--Lisp error: (void-variable foo-bar-baz)
I'm unable to reproduce the problem.  Both Emacs 29 or 28.1 give an
error if I eval that expression.

Perhaps you have that variable defined somewhere else so that it doesn't
bug out for you?


Seems my example doesn't work. Herewith the original code considered faulty from my init:


(defvar ar-emacs-dir
  (cond ((boundp 'lisp-directory)
         (replace-regexp-in-string "/[^/]+/$" "" lisp-directory))
        ((< (string-to-number (substring emacs-version 0 2)) 27)
         (alt-emacsdir))
        (t (progn (elisp-find-definition "featurep")
              (replace-regexp-in-string "/[^/]+/$" "" (file-name-directory (buffer-file-name))))
           (when ar-emacs-dir (kill-buffer "fns.c")))))

From Emacs 29.0.50 it will evaluate

==> "MY_DIR/emacs-20220604"