Adventures in Tech Land. Season 3. Episode 2

Lots of emacs lisp things rss feed

2021/10/25, 47th day

defvar !!! defconst !!! flymake !!!

I spent a lot of time on Sunday cleaning up the elisp code that I use to generate the RSS index and the daily page. Then I remembered that there was something about setq requiring to actually declare the variable before hand, and there was all this talk on the lists about scope, so I decided to ask for help on emacs-devel and I ended up with the following suggestions:

There was a discussion about beginners who use setq without first defining the variable with defvar and how that could create lots of problems. But you'd be hard pressed to find such indications from reading the Elisp Introduction, and even the Elisp Reference starts by introducing setq while pushing the information about defvar in a later chapter that discusses Defining Global Variables. Beginners or amateurs who are not sure what that all means will probably start by setq 'ing all their variables to only find later, when the harm is done, that they should have used defvar and defconst to first define the variables or constants before setq 'ing them.

So just to make sure I'm not missing anything, here is the thread (February 16, 2024 update): lexical binding?