all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 59057@debbugs.gnu.org
Subject: bug#59057: Emacs 29. Byte compiler sometimes forgets about a defvar.
Date: Wed, 9 Nov 2022 13:40:57 +0000	[thread overview]
Message-ID: <Y2ut6a7AONZYR7Sy@ACM> (raw)
In-Reply-To: <jwv5yfqv4fx.fsf-monnier+emacs@gnu.org>

Hello, Stefan.

On Mon, Nov 07, 2022 at 16:31:32 -0500, Stefan Monnier wrote:
> >> (defvar VAR) does not "create a variable".
> > According to both its doc string and the Elisp manual it does.

> BTW, what I'm describing is how things have worked in `lexical-binding`
> since Emacs-24, basically.  A few corner cases didn't quite obey it
> (and I'm sure there are still a few remaining ones), but by and large
> this is how it has worked for the last 10 years.

OK, I see that now, having checked git logs and git blame.  There was a
bug report in 2018 about the documentation, which Noam Postavsky fixed.

The basic problem is that defvar is a dog's breakfast of a function.  In
fact, it's two distinct functions sharing a name.  These two functions
have little else to do with eachother.

And defvar appears to be the only function in Emacs where supplying nil
as an &optional argument has an effect different from omitting it.  This
is bad for anybody trying to learn Emacs Lisp.

Because defvar isn't a single function, it's impossible to document it
coherently without explicitly saying it's two functions.  I doubt the
powers that be would countenance such explicitness.  So the
documentation will continue to be confusing, and people like me will
continue to lose time sorting out what this hybrid function does.

I will alter the code in CC Mode which gave rise to this bug report.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2022-11-09 13:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-05 18:46 bug#59057: Emacs 29. Byte compiler sometimes forgets about a defvar Alan Mackenzie
2022-11-07 13:07 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-07 20:20   ` Alan Mackenzie
2022-11-07 21:29     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-08 11:01       ` Alan Mackenzie
2022-11-08 14:12         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-07 21:31     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-09 13:40       ` Alan Mackenzie [this message]
2022-11-09 17:54         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-24 19:29           ` Stefan Kangas
2022-11-24 19:33             ` Eli Zaretskii
2022-11-24 20:36             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-24 21:12               ` Stefan Kangas
2022-11-25 10:36                 ` Alan Mackenzie

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

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

  git send-email \
    --in-reply-to=Y2ut6a7AONZYR7Sy@ACM \
    --to=acm@muc.de \
    --cc=59057@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.
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.