emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] master 012487b: * lisp/display-line-numbers.el (displa


From: Stefan Monnier
Subject: Re: [Emacs-diffs] master 012487b: * lisp/display-line-numbers.el (display-line-numbers-type): Autoload it.
Date: Mon, 24 Jul 2017 13:29:39 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

>> +;; Following function calls will autoload the library.
>> +(defvar display-line-numbers-type)
>> +
>> (defun menu-bar-display-line-numbers-mode (type)
>> (setq display-line-numbers-type type)
>> (if global-display-line-numbers-mode
> How is this better than the autoload?

Autoloading variables is a source of corner-case problems, and
autoloading defcustoms even more so.  It's not serious enough to ban
such autoloads, but it's a good practice to try and avoid them when it
can be done cheaply, and to clearly document them when we do need them.

> At least the autoload doesn't need a comment to explain why it
> is there.

I find this very amusing:
- my asking Micheal "Why?" is another way to say "I'd have liked to see
  a comment explaining why we need the autoload".
- the comment on the defvar isn't needed anyway: it's pretty clear why the
  defvar is used, and even if nothing autoloads the library, the code with
  defvar+setq is correct.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]