From Newsgroup: gnu.emacs.help
John Haman <
mail@johnhaman.org> writes:
I wrote a package that adds local air quality statistics to the
mode-line. Here it is:
https://github.com/jthaman/air-quality/blob/main/air-quality.el
If you are so inclined, I'd like some thoughts on the code. It's
short, but I'm trying to get better at Emacs Lisp (at least this week,
while I'm on vacation...)
--
Some good practices to follow:
1. Byte-compile the source to locate and resolve many types of problems.
Byte compilation is available as a command (rCyemacs-lisp-byte-compilerCO)
or via the Emacs-Lisp menu when editing a .el file. With your rCyair-quality.elrCO (version 0.1 from the git repository), it yields the following message:
In air-quality--get-update:
air-quality.el:125:17: Warning: reference to free variable rCyurl-http-end-of-headersrCO
2. Emacs Lisp also has a rCylintrCO available via the Emacs-Lisp menu. This can be helpful, but it can also find spurious (non-existent) problems
that are due to its limitations. For rCyair-quality.elrCO, it yields:
In function air-quality--get-update:
air-quality.el:118:Warning: Reference to unbound symbol: url-http-end-of-headers
Linting finished.
3. rCyCheckdocrCO can help identify good practices, such as doc-string standards, so that you (and others) will have usable descriptions of
procedures and data structures. It looks as though you have run it on air-quality.el because it gives no warnings or errors.
4. Consider adding the code as an ELPA package that can be installed via
the Emacs menu Options/Manage Emacs Packages (or the command rCylist-packagesrCO) once it has reached a level of maturity that you
consider acceptable.
--
--- Synchronet 3.21d-Linux NewsLink 1.2