* lisp/emacs-lisp/autoload.el: Improve last change
It turns out there were other places that used `custom-initialize-delay` on autoloaded variables and used various hacks to make it work with `autoload.el`. The new code makes those hacks unneeded. Also, there's no point trying to "optimize" those rare cases anyway, so I simplified the `autoload.el` code for those cases. (make-autoload): For non-trivial cases, just include the whole `defcustom` instead of trying to mimic it. * lisp/mail/rmail.el (rmail-spool-directory): Remove hacks. * lisp/info.el (Info-default-directory-list): Remove `progn` hack. * lisp/custom.el (custom-declare-variable) (custom-handle-all-keywords): Don't use pseudo-group `nil`.
This commit is contained in:
parent
048b1aaec8
commit
7d7bfbf034
4 changed files with 34 additions and 37 deletions
|
@ -161,7 +161,9 @@ set to nil, as the value is no longer rogue."
|
|||
;; Whether automatically buffer-local.
|
||||
buffer-local)
|
||||
(unless (memq :group args)
|
||||
(custom-add-to-group (custom-current-group) symbol 'custom-variable))
|
||||
(let ((cg (custom-current-group)))
|
||||
(when cg
|
||||
(custom-add-to-group cg symbol 'custom-variable))))
|
||||
(while args
|
||||
(let ((keyword (pop args)))
|
||||
(unless (symbolp keyword)
|
||||
|
@ -525,7 +527,9 @@ If no such group is found, return nil."
|
|||
"For customization option SYMBOL, handle keyword arguments ARGS.
|
||||
Third argument TYPE is the custom option type."
|
||||
(unless (memq :group args)
|
||||
(custom-add-to-group (custom-current-group) symbol type))
|
||||
(let ((cg (custom-current-group)))
|
||||
(when cg
|
||||
(custom-add-to-group cg symbol type))))
|
||||
(while args
|
||||
(let ((arg (car args)))
|
||||
(setq args (cdr args))
|
||||
|
|
|
@ -220,22 +220,27 @@ expression, in which case we want to handle forms differently."
|
|||
|
||||
;; Convert defcustom to less space-consuming data.
|
||||
((eq car 'defcustom)
|
||||
(let ((varname (car-safe (cdr-safe form)))
|
||||
(initializer (plist-get (nthcdr 4 form) :initialize))
|
||||
(init (car-safe (cdr-safe (cdr-safe form))))
|
||||
(doc (car-safe (cdr-safe (cdr-safe (cdr-safe form)))))
|
||||
;; (rest (cdr-safe (cdr-safe (cdr-safe (cdr-safe form)))))
|
||||
)
|
||||
(let* ((varname (car-safe (cdr-safe form)))
|
||||
(props (nthcdr 4 form))
|
||||
(initializer (plist-get props :initialize))
|
||||
(init (car-safe (cdr-safe (cdr-safe form))))
|
||||
(doc (car-safe (cdr-safe (cdr-safe (cdr-safe form)))))
|
||||
;; (rest (cdr-safe (cdr-safe (cdr-safe (cdr-safe form)))))
|
||||
)
|
||||
`(progn
|
||||
,(if (null initializer)
|
||||
`(defvar ,varname ,init ,doc)
|
||||
`(progn (defvar ,varname nil ,doc)
|
||||
(let ((exp ',init))
|
||||
(put ',varname 'standard-value (list exp))
|
||||
(,(eval initializer t) ',varname exp))))
|
||||
,(if (not (member initializer '(nil 'custom-initialize-default
|
||||
#'custom-initialize-default
|
||||
'custom-initialize-reset
|
||||
#'custom-initialize-reset)))
|
||||
form
|
||||
`(defvar ,varname ,init ,doc))
|
||||
;; When we include the complete `form', this `custom-autoload'
|
||||
;; is not indispensable, but it still helps in case the `defcustom'
|
||||
;; doesn't specify its group explicitly, and probably in a few other
|
||||
;; corner cases.
|
||||
(custom-autoload ',varname ,file
|
||||
,(condition-case nil
|
||||
(null (cadr (memq :set form)))
|
||||
(null (plist-get props :set))
|
||||
(error nil))))))
|
||||
|
||||
((eq car 'defgroup)
|
||||
|
|
21
lisp/info.el
21
lisp/info.el
|
@ -160,17 +160,14 @@ A header-line does not scroll with the rest of the buffer."
|
|||
:version "24.4")
|
||||
|
||||
;; This is a defcustom largely so that we can get the benefit
|
||||
;; of custom-initialize-delay. Perhaps it would work to make it a
|
||||
;; defvar and explicitly give it a standard-value property, and
|
||||
;; call custom-initialize-delay on it.
|
||||
;; The progn forces the autoloader to include the whole thing, not
|
||||
;; just an abbreviated version. The value is initialized at startup
|
||||
;; time, when command-line calls custom-reevaluate-setting on all
|
||||
;; the defcustoms in custom-delayed-init-variables. This is
|
||||
;; somewhat sub-optimal, as ideally this should be done when Info
|
||||
;; mode is first invoked.
|
||||
;; of `custom-initialize-delay'. Perhaps it would work to make it a
|
||||
;; `defvar' and explicitly give it a `standard-value' property, and
|
||||
;; call `custom-initialize-delay' on it.
|
||||
;; The value is initialized at startup time, when command-line calls
|
||||
;; `custom-reevaluate-setting' on all the defcustoms in
|
||||
;; `custom-delayed-init-variables'. This is somewhat sub-optimal, as ideally
|
||||
;; this should be done when Info mode is first invoked.
|
||||
;;;###autoload
|
||||
(progn
|
||||
(defcustom Info-default-directory-list
|
||||
(let* ((config-dir
|
||||
(file-name-as-directory
|
||||
|
@ -232,8 +229,8 @@ the environment variable INFOPATH is set.
|
|||
Although this is a customizable variable, that is mainly for technical
|
||||
reasons. Normally, you should either set INFOPATH or customize
|
||||
`Info-additional-directory-list', rather than changing this variable."
|
||||
:initialize 'custom-initialize-delay
|
||||
:type '(repeat directory)))
|
||||
:initialize #'custom-initialize-delay
|
||||
:type '(repeat directory))
|
||||
|
||||
(defvar Info-directory-list nil
|
||||
"List of directories to search for Info documentation files.
|
||||
|
|
|
@ -160,13 +160,6 @@ its character representation and its display representation.")
|
|||
:group 'rmail
|
||||
:version "21.1")
|
||||
|
||||
;;;###autoload
|
||||
(put 'rmail-spool-directory 'standard-value
|
||||
'((cond ((file-exists-p "/var/mail") "/var/mail/")
|
||||
((file-exists-p "/var/spool/mail") "/var/spool/mail/")
|
||||
((memq system-type '(hpux usg-unix-v)) "/usr/mail/")
|
||||
(t "/usr/spool/mail/"))))
|
||||
|
||||
;;;###autoload
|
||||
(defcustom rmail-spool-directory
|
||||
(purecopy
|
||||
|
@ -181,12 +174,10 @@ its character representation and its display representation.")
|
|||
(t "/usr/spool/mail/")))
|
||||
"Name of directory used by system mailer for delivering new mail.
|
||||
Its name should end with a slash."
|
||||
:initialize 'custom-initialize-delay
|
||||
:initialize #'custom-initialize-delay
|
||||
:type 'directory
|
||||
:group 'rmail)
|
||||
|
||||
;;;###autoload(custom-initialize-delay 'rmail-spool-directory nil)
|
||||
|
||||
(defcustom rmail-movemail-program nil
|
||||
"If non-nil, the file name of the `movemail' program."
|
||||
:group 'rmail-retrieve
|
||||
|
|
Loading…
Add table
Reference in a new issue