[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tex.el compiler warnings

From: Tassilo Horn
Subject: Re: tex.el compiler warnings
Date: Sat, 22 Aug 2020 08:27:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Arash Esbati <> writes:

>>   (devar TeX-file nil)
>>   (defun TeX-foobar ()
>>     (let ((TeX-file something))
>>       (TeX-quux)
>>       (TeX-baz)))
>> and make TeX-quux and TeX-baz (and everything called below) use
>> `TeX-file' instead of `file'.  The byte-compiler warnings hint us
>> towards the usages and that's why they are valuable.  (Additionally, if
>> user's have their own commands accessing `file', they need to switch to
>> TeX-file, too.)
>> I'll try to fix that but don't hold your breath.
> I'm not an expert on this, but the lexical binding version of it would
> be:
>     (defun TeX-foobar ()
>       (let (_)
>         (defvar file)
>         (let ((file something))
>           (TeX-quuz)
>           (TeX-baz))))
> Right?

No, it's not.  A defvar without value is no declaration, so `file' is
not declared as special (dynamically bound) variable above.  And
obviously, a package should not declare variables without prefix, so the
right version is the one I gave above.

   (devar TeX-file nil)

   (defun TeX-foobar ()
     (let ((TeX-file something))

So we won't come around renaming/prefixing the variables in both the
functions binding them and all functions called from there and accessing


reply via email to

[Prev in Thread] Current Thread [Next in Thread]