bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#28104: 25.2; autoload defcustom should put safe-local-variable


From: Allen Li
Subject: 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@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.





reply via email to

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