* bug#57915: 29.0.50; Misleading warning about use of quote in clause of cl-case @ 2022-09-18 19:35 Jonas Bernoulli 2022-09-19 8:32 ` Lars Ingebrigtsen 0 siblings, 1 reply; 4+ messages in thread From: Jonas Bernoulli @ 2022-09-18 19:35 UTC (permalink / raw) To: 57915 I inherited some code like this: (cl-case foo ((quote) ...) ((funcall) ...)) While I probably would not have written it like this, I think it makes sense, since (quote ...) looks like ... is being quoted. Using ((quote) ...) make it clear to the human reader that that is not what is happening. Unfortunately the byte-compiler now provides this misleading warning: Warning: Case (quote) will match ‘quote’. If that’s intended, write (nil quote) instead. Otherwise, don’t quote ‘nil’. This is misleading because the conditions (quote) and (nil quote) are not equivalent; obviously the first only matches `quote', while second also matches nil. I have seen this exact warning for a few other packages and fear that someone might blindly follow the suggestion. Could this special case, (quote), be handled differently? I understand we want to catch, pcase-inspired clauses like 'x. I am not sure we can tell the difference between (quote), (quote nil) and 'nil, but it seems to me, that if that is not the case, we should avoid the invalid recommendation at the cost of not warning about the other, likely unintended uses. Cheers, Jonas ^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#57915: 29.0.50; Misleading warning about use of quote in clause of cl-case 2022-09-18 19:35 bug#57915: 29.0.50; Misleading warning about use of quote in clause of cl-case Jonas Bernoulli @ 2022-09-19 8:32 ` Lars Ingebrigtsen 2022-09-19 11:38 ` Philipp Stephani via Bug reports for GNU Emacs, the Swiss army knife of text editors 0 siblings, 1 reply; 4+ messages in thread From: Lars Ingebrigtsen @ 2022-09-19 8:32 UTC (permalink / raw) To: Jonas Bernoulli; +Cc: Philipp Stephani, 57915 Jonas Bernoulli <jonas@bernoul.li> writes: > I inherited some code like this: > > (cl-case foo > ((quote) ...) > ((funcall) ...)) > > While I probably would not have written it like this, I think it > makes sense, since (quote ...) looks like ... is being quoted. Using > ((quote) ...) make it clear to the human reader that that is not what is > happening. Unfortunately the byte-compiler now provides this misleading > warning: > > Warning: Case (quote) will match ‘quote’. If that’s intended, > write (nil quote) instead. Otherwise, don’t quote ‘nil’. [...] > Could this special case, (quote), be handled differently? I understand > we want to catch, pcase-inspired clauses like 'x. I am not sure we can > tell the difference between (quote), (quote nil) and 'nil, but it seems > to me, that if that is not the case, we should avoid the invalid > recommendation at the cost of not warning about the other, likely > unintended uses. Yeah, since there isn't really any other way to express this (or is there?), we should probably not warn about this construction. I've added Philipp to the CCs; perhaps he has some comments. ^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#57915: 29.0.50; Misleading warning about use of quote in clause of cl-case 2022-09-19 8:32 ` Lars Ingebrigtsen @ 2022-09-19 11:38 ` Philipp Stephani via Bug reports for GNU Emacs, the Swiss army knife of text editors 2022-09-19 18:42 ` Lars Ingebrigtsen 0 siblings, 1 reply; 4+ messages in thread From: Philipp Stephani via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-09-19 11:38 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: Jonas Bernoulli, 57915 On Mon, 19 Sept 2022 at 10:32, Lars Ingebrigtsen <larsi@gnus.org> wrote: > > Jonas Bernoulli <jonas@bernoul.li> writes: > > > I inherited some code like this: > > > > (cl-case foo > > ((quote) ...) > > ((funcall) ...)) > > > > While I probably would not have written it like this, I think it > > makes sense, since (quote ...) looks like ... is being quoted. Using > > ((quote) ...) make it clear to the human reader that that is not what is > > happening. Unfortunately the byte-compiler now provides this misleading > > warning: > > > > Warning: Case (quote) will match ‘quote’. If that’s intended, > > write (nil quote) instead. Otherwise, don’t quote ‘nil’. > > [...] > > > Could this special case, (quote), be handled differently? I understand > > we want to catch, pcase-inspired clauses like 'x. I am not sure we can > > tell the difference between (quote), (quote nil) and 'nil, but it seems > > to me, that if that is not the case, we should avoid the invalid > > recommendation at the cost of not warning about the other, likely > > unintended uses. > > Yeah, since there isn't really any other way to express this (or is > there?), we should probably not warn about this construction. > > I've added Philipp to the CCs; perhaps he has some comments. Makes sense, fixed in commit a71de4b52d3de14349ded7d88c4cae6e2a9376ae. -- Google Germany GmbH Erika-Mann-Straße 33 80636 München Geschäftsführer: Paul Manicle, Liana Sebastian Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Diese E-Mail ist vertraulich. Falls Sie diese fälschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde. This e-mail is confidential. If you received this communication by mistake, please don’t forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person. ^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#57915: 29.0.50; Misleading warning about use of quote in clause of cl-case 2022-09-19 11:38 ` Philipp Stephani via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-09-19 18:42 ` Lars Ingebrigtsen 0 siblings, 0 replies; 4+ messages in thread From: Lars Ingebrigtsen @ 2022-09-19 18:42 UTC (permalink / raw) To: Philipp Stephani; +Cc: Jonas Bernoulli, 57915 Philipp Stephani <phst@google.com> writes: > Makes sense, fixed in commit a71de4b52d3de14349ded7d88c4cae6e2a9376ae. Thanks; I can confirm that this fixes the problem, so I'm closing this bug report. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-09-19 18:42 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-09-18 19:35 bug#57915: 29.0.50; Misleading warning about use of quote in clause of cl-case Jonas Bernoulli 2022-09-19 8:32 ` Lars Ingebrigtsen 2022-09-19 11:38 ` Philipp Stephani via Bug reports for GNU Emacs, the Swiss army knife of text editors 2022-09-19 18:42 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.