summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1998-09-04 20:48:11 +0000
committerKarl Heuer <kwzh@gnu.org>1998-09-04 20:48:11 +0000
commit41b3e67c3f4ae39ed006b7d9bebf8d0c4bf6f7a5 (patch)
tree2eb03aaece4575058678ae1b970971f9ef46c931
parent85c92c4050da1dc1dd0497b2841ac5437d775857 (diff)
downloademacs-41b3e67c3f4ae39ed006b7d9bebf8d0c4bf6f7a5.tar.gz
(customize-option): Refuse to customize
a variable that has no defcustom. But if variable is autoloaded, first try to load the library that defines it.
-rw-r--r--lisp/cus-edit.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 4d4fc083553..77b946ece1a 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -868,6 +868,28 @@ are shown; the contents of those subgroups are initially hidden."
(defun customize-option (symbol)
"Customize SYMBOL, which must be a user option variable."
(interactive (custom-variable-prompt))
+ ;; If we don't have SYMBOL's real definition loaded,
+ ;; try to load it.
+ (unless (get symbol 'custom-type)
+ (let ((loaddefs-file (locate-library "loaddefs.el" t))
+ file)
+ ;; See if it is autoloaded from some library.
+ (when loaddefs-file
+ (with-temp-buffer
+ (insert-file-contents loaddefs-file)
+ (when (re-search-forward (concat "^(defvar " (symbol-name symbol))
+ nil t)
+ (search-backward "\n;;; Generated autoloads from ")
+ (goto-char (match-end 0))
+ (setq file (buffer-substring (point)
+ (progn (end-of-line) (point)))))))
+ ;; If it is, load that library.
+ (when file
+ (when (string-match "\\.el\\'" file)
+ (setq file (substring file 0 (match-beginning 0))))
+ (load file))))
+ (unless (get symbol 'custom-type)
+ (error "Variable %s cannot be customized" symbol))
(custom-buffer-create (list (list symbol 'custom-variable))
(format "*Customize Option: %s*"
(custom-unlispify-tag-name symbol))))