> I thought that was all that was
needed, and I definitely didn't suggest to rename anything.
> What did I miss?
With respect to naming: my possibly wrong understanding of
Emacs Lisp coding conventions is that special variables should be
prefixed by the package's name, and that's why I (re)named
the variable ido-fallback in both patches.
Also, here is a summary of the original problem, as I see it.
Consider an IDO function which accepts a parameter named FALLBACK, and
which calls PROMPT. Inside PROMPT, we set FALLBACK to another
value. For example:
;; -*- lexical-binding: nil -*-
(defun prompt ()
(setf fallback 10))
(defun ido (fallback)
(prompt)
fallback)
When the above is evaluated with lexical binding being nil, the
fallback variable is set from within "prompt" and the result from
calling ido is always 10, no matter its input argument.
This is not the case if the code is evaluated with lexical-binding set
to T, in which case "ido" returns the value bound to the lexical
fallback variable: (ido 5) returns 5.
The intent of the patches was to allow fallback to be changed again.
As I learnt with the second patch, globally declaring "fallback" as a
special variable with defvar, with lexical-binding set to T, does not
give the same behaviour as with dynamic scoping rules: the "fallback"
parameter is still bound lexically, shadowing the dynamic binding.
The first patch introduces a globally scoped ido-fallback variable,
different from the "fallback" argument.
and keep only a global "ido-fallback", like "ido-exit", but that requires to change
all call sites.