GNU bug report logs - #28104
25.2; autoload defcustom should put safe-local-variable

Previous Next

Package: emacs;

Reported by: Allen Li <vianchielfaura <at> gmail.com>

Date: Tue, 15 Aug 2017 21:31:02 UTC

Severity: wishlist

Found in version 25.2

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 28104 in the body.
You can then email your comments to 28104 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#28104; Package emacs. (Tue, 15 Aug 2017 21:31:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Allen Li <vianchielfaura <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 15 Aug 2017 21:31:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Allen Li <vianchielfaura <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.2; autoload defcustom should put safe-local-variable
Date: Tue, 15 Aug 2017 14:30:35 -0700
Generating autoloads for a defcustom form will not put
safe-local-variable.  Given:

;;;###autoload
(defcustom mir-python-hanging-indent-levels 1
  "Number of ‘python-indent-offset’ to use for hanging indentation."
  :type 'integer
  :safe 'integerp)

This generates the following autoloads:

(defvar mir-python-hanging-indent-levels 1 "\
Number of ‘python-indent-offset’ to use for hanging indentation.")

(custom-autoload 'mir-python-hanging-indent-levels "mir-python" t)

It would be useful to also include:

(put 'mir-python-hanging-indent-levels 'safe-local-variable 'integerp)

Otherwise, Emacs will complain about file local variables that are
safe if you do not (require 'foo) in advance, which is very annoying.

In GNU Emacs 25.2.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.8),
modified by Debian
Windowing system distributor 'The X.Org Foundation', version 11.0.11803000
System Description: Ubuntu 14.04 LTS




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28104; Package emacs. (Tue, 15 Aug 2017 23:59:01 GMT) Full text and rfc822 format available.

Message #8 received at 28104 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Allen Li <vianchielfaura <at> gmail.com>
Cc: 28104 <at> debbugs.gnu.org
Subject: Re: bug#28104: 25.2; autoload defcustom should put safe-local-variable
Date: Tue, 15 Aug 2017 19:57:50 -0400
It's rare to need to autoload a defcustom.
If you need to autoload the safety property, specify it separately,
and autoload just that statement. Otherwise I suppose you could wrap
the defcustom in a progn and autoload the whole thing.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28104; Package emacs. (Wed, 16 Aug 2017 03:31:01 GMT) Full text and rfc822 format available.

Message #11 received at 28104 <at> debbugs.gnu.org (full text, mbox):

From: Allen Li <vianchielfaura <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 28104 <at> debbugs.gnu.org
Subject: Re: bug#28104: 25.2; autoload defcustom should put safe-local-variable
Date: Tue, 15 Aug 2017 20:29:53 -0700
On Tue, Aug 15, 2017 at 4:57 PM, Glenn Morris <rgm <at> gnu.org> wrote:
>
> It's rare to need to autoload a defcustom.

What are some intended use cases for an autoloaded defcustom?  For me,
applying safe-local-variable seems like a leading use case.

I'm fine with writing

(defcustom foo nil
  "Doc"
  :safe 'symbolp)
;;;###autoload
(put 'foo 'safe-local-variable 'symbolp)

But that seems redundant, and especially so in such use cases where
you would want to autoload the defcustom.

;;;###autoload
(defcustom foo nil
  "Doc"
  :safe 'symbolp)
;;;###autoload
(put 'foo 'safe-local-variable 'symbolp)

You could omit the :safe in defcustom, I suppose, but the
inconsistency bugs me; defcustom can be autoloaded and defcustom can
set safe-local-variable, but not both at the same time.  It makes
either feature feel like it was tacked on as an afterthought and not
part of a homogeneous whole.

> If you need to autoload the safety property, specify it separately,
> and autoload just that statement. Otherwise I suppose you could wrap
> the defcustom in a progn and autoload the whole thing.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28104; Package emacs. (Mon, 05 Jul 2021 13:57:01 GMT) Full text and rfc822 format available.

Message #14 received at 28104 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Allen Li <vianchielfaura <at> gmail.com>
Cc: 28104 <at> debbugs.gnu.org, Glenn Morris <rgm <at> gnu.org>
Subject: Re: bug#28104: 25.2; autoload defcustom should put safe-local-variable
Date: Mon, 05 Jul 2021 15:56:32 +0200
Allen Li <vianchielfaura <at> gmail.com> writes:

> You could omit the :safe in defcustom, I suppose, but the
> inconsistency bugs me; defcustom can be autoloaded and defcustom can
> set safe-local-variable, but not both at the same time. 

Yeah, I think it makes sense to propagate the :safe setting to the
loaddefs file when doing this (even if it's slightly unusual).  So I've
now made this change in Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 28.1, send any further explanations to 28104 <at> debbugs.gnu.org and Allen Li <vianchielfaura <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 05 Jul 2021 13:57:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 03 Aug 2021 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 265 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.