unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: tpeplt <tpeplt@gmail.com>
To: John Haman <mail@johnhaman.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Package critique: modeline for air quality information
Date: Fri, 01 Sep 2023 11:12:16 -0400	[thread overview]
Message-ID: <87y1hq7wrz.fsf@gmail.com> (raw)
In-Reply-To: <m1jztaejth.fsf@johnhaman.org> (John Haman's message of "Thu, 31 Aug 2023 21:58:02 -0400")

The following message is a courtesy copy of an article
that has been posted to gnu.emacs.help as well.

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 (‘emacs-lisp-byte-compile’)
or via the Emacs-Lisp menu when editing a .el file.  With your
‘air-quality.el’ (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
> ‘url-http-end-of-headers’

2. Emacs Lisp also has a ‘lint’ 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 ‘air-quality.el’, 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. ‘Checkdoc’ 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
‘list-packages’) once it has reached a level of maturity that you
consider acceptable.

--




  parent reply	other threads:[~2023-09-01 15:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-01  1:58 Package critique: modeline for air quality information John Haman
2023-09-01  9:38 ` Eshel Yaron
2023-09-01 10:49   ` John Haman
2023-09-01 11:57     ` Eshel Yaron
2023-09-01 13:46       ` John Haman
2023-09-01 15:12 ` tpeplt [this message]
2023-09-02 21:24 ` Emanuel Berg
2023-09-03 16:42   ` John Haman
2023-09-04  1:15     ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y1hq7wrz.fsf@gmail.com \
    --to=tpeplt@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=mail@johnhaman.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).