diff options
| author | Karl Heuer | 1998-09-04 20:48:11 +0000 |
|---|---|---|
| committer | Karl Heuer | 1998-09-04 20:48:11 +0000 |
| commit | 41b3e67c3f4ae39ed006b7d9bebf8d0c4bf6f7a5 (patch) | |
| tree | 2eb03aaece4575058678ae1b970971f9ef46c931 | |
| parent | 85c92c4050da1dc1dd0497b2841ac5437d775857 (diff) | |
| download | emacs-41b3e67c3f4ae39ed006b7d9bebf8d0c4bf6f7a5.tar.gz emacs-41b3e67c3f4ae39ed006b7d9bebf8d0c4bf6f7a5.zip | |
(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.el | 22 |
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." | |||
| 868 | (defun customize-option (symbol) | 868 | (defun customize-option (symbol) |
| 869 | "Customize SYMBOL, which must be a user option variable." | 869 | "Customize SYMBOL, which must be a user option variable." |
| 870 | (interactive (custom-variable-prompt)) | 870 | (interactive (custom-variable-prompt)) |
| 871 | ;; If we don't have SYMBOL's real definition loaded, | ||
| 872 | ;; try to load it. | ||
| 873 | (unless (get symbol 'custom-type) | ||
| 874 | (let ((loaddefs-file (locate-library "loaddefs.el" t)) | ||
| 875 | file) | ||
| 876 | ;; See if it is autoloaded from some library. | ||
| 877 | (when loaddefs-file | ||
| 878 | (with-temp-buffer | ||
| 879 | (insert-file-contents loaddefs-file) | ||
| 880 | (when (re-search-forward (concat "^(defvar " (symbol-name symbol)) | ||
| 881 | nil t) | ||
| 882 | (search-backward "\n;;; Generated autoloads from ") | ||
| 883 | (goto-char (match-end 0)) | ||
| 884 | (setq file (buffer-substring (point) | ||
| 885 | (progn (end-of-line) (point))))))) | ||
| 886 | ;; If it is, load that library. | ||
| 887 | (when file | ||
| 888 | (when (string-match "\\.el\\'" file) | ||
| 889 | (setq file (substring file 0 (match-beginning 0)))) | ||
| 890 | (load file)))) | ||
| 891 | (unless (get symbol 'custom-type) | ||
| 892 | (error "Variable %s cannot be customized" symbol)) | ||
| 871 | (custom-buffer-create (list (list symbol 'custom-variable)) | 893 | (custom-buffer-create (list (list symbol 'custom-variable)) |
| 872 | (format "*Customize Option: %s*" | 894 | (format "*Customize Option: %s*" |
| 873 | (custom-unlispify-tag-name symbol)))) | 895 | (custom-unlispify-tag-name symbol)))) |