From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: tpeplt Newsgroups: gmane.emacs.help Subject: Re: Package critique: modeline for air quality information Date: Fri, 01 Sep 2023 11:12:16 -0400 Message-ID: <87y1hq7wrz.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40366"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Cc: help-gnu-emacs@gnu.org To: John Haman Cancel-Lock: sha1:bwjQKYyyf0QYGas23qtSAlfMn9Q= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 01 17:13:10 2023 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qc5pZ-000A4O-48 for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 01 Sep 2023 17:13:05 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qc5ox-0007Xy-Vi; Fri, 01 Sep 2023 11:12:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qc5ov-0007RQ-Mp for help-gnu-emacs@gnu.org; Fri, 01 Sep 2023 11:12:25 -0400 Original-Received: from mail-qk1-x732.google.com ([2607:f8b0:4864:20::732]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qc5os-0005we-5C for help-gnu-emacs@gnu.org; Fri, 01 Sep 2023 11:12:24 -0400 Original-Received: by mail-qk1-x732.google.com with SMTP id af79cd13be357-76ef03f76c7so113997085a.3 for ; Fri, 01 Sep 2023 08:12:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693581141; x=1694185941; darn=gnu.org; h=posted-to:content-transfer-encoding:mime-version:in-reply-to :cancel-lock:user-agent:message-id:date:references:subject:cc:to :newsgroups:from:from:to:cc:subject:date:message-id:reply-to; bh=Y5E53On2O5YurcH/8kcoaYk7ZZmc4RQcbBw5Q8mRiqM=; b=D7qlblg9R026zg5h93wG0utKctQZjSFNXKqSzVXDv1dQ7/MpqH4SwgrZ5JwI4es0Su czXdEwbjzN4Aa53+2apDsOARQUSQLgVQd4nuf6aj+r/eiWnBh5pJ+HPbqfgnQdiTjbIQ KTFrsXY+tM9Ljm/EPDS5Ok8LrL++071WDtgr3Okjd/OKPQdF1qyENiGY5mF/Ahpdh87N t004n0r6lVyutImfwVpeBhOyEZpnIgfb61vxoEZeHfsXNPrY4XvAY3VBfPh+L3aKI51Z Pp7Z/XpJMAsJtDRmP5P3OWxJPIdfDDqYBPaBjbEv33UNACpXuPuQCNAEcjKLNxNNHfla CTrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693581141; x=1694185941; h=posted-to:content-transfer-encoding:mime-version:in-reply-to :cancel-lock:user-agent:message-id:date:references:subject:cc:to :newsgroups:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Y5E53On2O5YurcH/8kcoaYk7ZZmc4RQcbBw5Q8mRiqM=; b=V+E4gVd2LscMvZ7NYIKQMKYB0VFehZtxYOhwBKs2E2JkkZEWyhkoMD1E1DBctmzKI5 N5V27WDJwiuoEGfwU9xzE+RJJd0zFUHaGrSdBOwPr7JACFFEVOjyTIBXZ8JLnvpKvJe8 dRTnf049OIVUlXzlGZ30jMyuvfF8+tbKtvBuRiBU4zLTzwHAvNVgQVQ+KYw2sp/LajTo QVLkkmuajzKkgplWsCefEJlTBSbL6UbAzWNNWewHEpd9SPTjP+QKf+Opt7QjBhA3TxwF o7ZEbc5snYNZVMQJ6HWv8Eaimcld93qWDsYlmHRejhy/bDdKhyEniauj5ODdtvClbV61 epHQ== X-Gm-Message-State: AOJu0YxdVP7FNCmXDyyNvtoJlPDQ+WRd0GT4ChJRDUPjW8lt0nrGz80X BBButqpJlbXCCxaH8wnSWa4= X-Google-Smtp-Source: AGHT+IHB0RN8ccBnOB7m4yV9r/nx+l8+iwwWYdeDsvWTlHf+ZAs566Po1ry1IACh5GaBnAy9QHxM9Q== X-Received: by 2002:a05:620a:4245:b0:76c:e346:ca65 with SMTP id w5-20020a05620a424500b0076ce346ca65mr2821575qko.41.1693581140903; Fri, 01 Sep 2023 08:12:20 -0700 (PDT) Original-Received: from t530.local ([2600:8806:a821:2b00::51c9]) by smtp.gmail.com with ESMTPSA id c2-20020a05620a134200b0076dbaf97b75sm1439623qkl.108.2023.09.01.08.12.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Sep 2023 08:12:20 -0700 (PDT) Original-Newsgroups: gnu.emacs.help In-Reply-To: (John Haman's message of "Thu, 31 Aug 2023 21:58:02 -0400") Posted-To: gnu.emacs.help Received-SPF: pass client-ip=2607:f8b0:4864:20::732; envelope-from=tpeplt@gmail.com; helo=mail-qk1-x732.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:145055 Archived-At: The following message is a courtesy copy of an article that has been posted to gnu.emacs.help as well. John Haman 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 (=E2=80=98emacs-lisp-byte-compil= e=E2=80=99) or via the Emacs-Lisp menu when editing a .el file. With your =E2=80=98air-quality.el=E2=80=99 (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 > =E2=80=98url-http-end-of-headers=E2=80=99 2. Emacs Lisp also has a =E2=80=98lint=E2=80=99 available via the Emacs-Lis= p menu. This can be helpful, but it can also find spurious (non-existent) problems that are due to its limitations. For =E2=80=98air-quality.el=E2=80=99, 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. =E2=80=98Checkdoc=E2=80=99 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 =E2=80=98list-packages=E2=80=99) once it has reached a level of maturity th= at you consider acceptable. --