all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] master 012487b: * lisp/display-line-numbers.el (display-line-numbers-type): Autoload it.
Date: Tue, 25 Jul 2017 09:56:29 -0400	[thread overview]
Message-ID: <jwv60egprbs.fsf-monnier+Inbox@gnu.org> (raw)
In-Reply-To: <87inih6k78.fsf@detlef> (Michael Albinus's message of "Tue, 25 Jul 2017 09:37:31 +0200")

>>> We are miscommunicating.  By "the problem" I meant the reason(s) why
>>> autoloading a defcustom should be considered undesirable, and by
>>> "proposed solutions" the alternatives for making sure a defcustom'd
>>> variable is defined when it is needed.
>> There is no need for the variable to be defined in order to `setq' it,
>> which is why a simple (defvar foo) is sufficient here.
> In menu-bar.el (the case we are speaking about) and every other package,
> which might be interested to modify this variable prior calling the
> corresponding autoloaded function. I still don't see why it is better,
> to mandate every package using that variable a (defvar foo).

- There is currently no other package in this situation.
  And I don't expect a deluge of such packages either.
- Another package might do (require 'display-line-numbers) anyway.
- In general when a package doesn't want to (require 'bar) but needs
  to let-bind or set some variable bar-baz, the answer is to either live
  with the byte-compiler warning (that's the typical case for code in
  ~/.emacs) or to add a (defvar bar-baz).  It's been that way for ever.

Autoloading the variable is used when you need to know the var's value
(rather than merely set it) and where (require 'bar) is undesirable.

> And if this is better, it must be documented in the manual with a reasoning.

Simple reason: the code worked just fine, so all there was to fix was
a warning, and (defvar bar-baz) is the tool specifically designed to
silence those compiler warnings.

The autoload you added won't cause you to rot in hell the for eternity
(I think), but it's definitely not the best tool to fix the problem at hand.


        Stefan



  reply	other threads:[~2017-07-25 13:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170723072843.23485.53761@vcs0.savannah.gnu.org>
     [not found] ` <20170723072844.877FD22EF0@vcs0.savannah.gnu.org>
2017-07-23 13:28   ` [Emacs-diffs] master 012487b: * lisp/display-line-numbers.el (display-line-numbers-type): Autoload it Stefan Monnier
2017-07-23 14:02     ` Michael Albinus
2017-07-24 16:57       ` Glenn Morris
2017-07-24 17:01         ` Eli Zaretskii
2017-07-24 17:29           ` Stefan Monnier
2017-07-24 18:04             ` Eli Zaretskii
2017-07-24 18:16               ` Stefan Monnier
2017-07-24 18:37                 ` Eli Zaretskii
2017-07-24 20:05                   ` Stefan Monnier
2017-07-24 18:20               ` Stefan Monnier
2017-07-24 18:43                 ` Eli Zaretskii
2017-07-24 20:02                   ` Stefan Monnier
2017-07-25  2:36                     ` Eli Zaretskii
2017-07-25  3:22                       ` Stefan Monnier
2017-07-25  5:18                         ` Eli Zaretskii
2017-07-25  7:37                         ` Michael Albinus
2017-07-25 13:56                           ` Stefan Monnier [this message]
2017-07-26 16:54                           ` Glenn Morris
2017-07-26 18:59                             ` Eli Zaretskii
2017-07-24 17:26         ` Michael Albinus
2017-07-24 17:30           ` Stefan Monnier
2017-07-24 17:34             ` Michael Albinus

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=jwv60egprbs.fsf-monnier+Inbox@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=michael.albinus@gmx.de \
    /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.