diff options
| -rw-r--r-- | lisp/cus-edit.el | 139 |
1 files changed, 50 insertions, 89 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index fd458300ca6..1b3cebb6962 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el | |||
| @@ -440,6 +440,11 @@ WIDGET is the widget to apply the filter entries of MENU on." | |||
| 440 | :group 'custom-menu | 440 | :group 'custom-menu |
| 441 | :type 'boolean) | 441 | :type 'boolean) |
| 442 | 442 | ||
| 443 | (defcustom custom-unlispify-remove-prefixes nil | ||
| 444 | "Non-nil means remove group prefixes from option names in buffer." | ||
| 445 | :group 'custom-menu | ||
| 446 | :type 'boolean) | ||
| 447 | |||
| 443 | (defun custom-unlispify-menu-entry (symbol &optional no-suffix) | 448 | (defun custom-unlispify-menu-entry (symbol &optional no-suffix) |
| 444 | "Convert symbol into a menu entry." | 449 | "Convert symbol into a menu entry." |
| 445 | (cond ((not custom-unlispify-menu-entries) | 450 | (cond ((not custom-unlispify-menu-entries) |
| @@ -458,15 +463,16 @@ WIDGET is the widget to apply the filter entries of MENU on." | |||
| 458 | (re-search-forward "-p\\'" nil t)) | 463 | (re-search-forward "-p\\'" nil t)) |
| 459 | (replace-match "" t t) | 464 | (replace-match "" t t) |
| 460 | (goto-char (point-min))) | 465 | (goto-char (point-min))) |
| 461 | (let ((prefixes custom-prefix-list) | 466 | (if custom-unlispify-remove-prefixes |
| 462 | prefix) | 467 | (let ((prefixes custom-prefix-list) |
| 463 | (while prefixes | 468 | prefix) |
| 464 | (setq prefix (car prefixes)) | 469 | (while prefixes |
| 465 | (if (search-forward prefix (+ (point) (length prefix)) t) | 470 | (setq prefix (car prefixes)) |
| 466 | (progn | 471 | (if (search-forward prefix (+ (point) (length prefix)) t) |
| 467 | (setq prefixes nil) | 472 | (progn |
| 468 | (delete-region (point-min) (point))) | 473 | (setq prefixes nil) |
| 469 | (setq prefixes (cdr prefixes))))) | 474 | (delete-region (point-min) (point))) |
| 475 | (setq prefixes (cdr prefixes)))))) | ||
| 470 | (subst-char-in-region (point-min) (point-max) ?- ?\ t) | 476 | (subst-char-in-region (point-min) (point-max) ?- ?\ t) |
| 471 | (capitalize-region (point-min) (point-max)) | 477 | (capitalize-region (point-min) (point-max)) |
| 472 | (unless no-suffix | 478 | (unless no-suffix |
| @@ -1113,52 +1119,45 @@ Reset all values in this buffer to their standard settings." | |||
| 1113 | ;;; The Tree Browser. | 1119 | ;;; The Tree Browser. |
| 1114 | 1120 | ||
| 1115 | ;;;###autoload | 1121 | ;;;###autoload |
| 1116 | (defun customize-browse (group) | 1122 | (defun customize-browse () |
| 1117 | "Create a tree browser for the customize hierarchy." | 1123 | "Create a tree browser for the customize hierarchy." |
| 1118 | (interactive (list (let ((completion-ignore-case t)) | 1124 | (interactive) |
| 1119 | (completing-read "Customize group: (default emacs) " | 1125 | (let ((group 'emacs)) |
| 1120 | obarray | 1126 | (let ((name "*Customize Browser*")) |
| 1121 | (lambda (symbol) | 1127 | (kill-buffer (get-buffer-create name)) |
| 1122 | (get symbol 'custom-group)) | 1128 | (switch-to-buffer (get-buffer-create name))) |
| 1123 | t)))) | 1129 | (custom-mode) |
| 1124 | 1130 | (widget-insert "\ | |
| 1125 | (when (stringp group) | 1131 | Square brackets show active fields; type RET or click mouse-1 |
| 1126 | (if (string-equal "" group) | 1132 | on an active field to invoke its action. |
| 1127 | (setq group 'emacs) | ||
| 1128 | (setq group (intern group)))) | ||
| 1129 | (let ((name "*Customize Browser*")) | ||
| 1130 | (kill-buffer (get-buffer-create name)) | ||
| 1131 | (switch-to-buffer (get-buffer-create name))) | ||
| 1132 | (custom-mode) | ||
| 1133 | (widget-insert "\ | ||
| 1134 | Invoke [+] or [?] below to expand items, and [-] to collapse items.\n") | 1133 | Invoke [+] or [?] below to expand items, and [-] to collapse items.\n") |
| 1135 | (if custom-browse-only-groups | 1134 | (if custom-browse-only-groups |
| 1136 | (widget-insert "\ | 1135 | (widget-insert "\ |
| 1137 | Invoke the [Group] button below to edit that item in another window.\n\n") | 1136 | Invoke the [Group] button below to edit that item in another window.\n\n") |
| 1138 | (widget-insert "Invoke the ") | 1137 | (widget-insert "Invoke the ") |
| 1139 | (widget-create 'item | 1138 | (widget-create 'item |
| 1140 | :format "%t" | 1139 | :format "%t" |
| 1141 | :tag "[Group]" | 1140 | :tag "[Group]" |
| 1142 | :tag-glyph "folder") | 1141 | :tag-glyph "folder") |
| 1143 | (widget-insert ", ") | 1142 | (widget-insert ", ") |
| 1144 | (widget-create 'item | 1143 | (widget-create 'item |
| 1145 | :format "%t" | 1144 | :format "%t" |
| 1146 | :tag "[Face]" | 1145 | :tag "[Face]" |
| 1147 | :tag-glyph "face") | 1146 | :tag-glyph "face") |
| 1148 | (widget-insert ", and ") | 1147 | (widget-insert ", and ") |
| 1149 | (widget-create 'item | 1148 | (widget-create 'item |
| 1150 | :format "%t" | 1149 | :format "%t" |
| 1151 | :tag "[Option]" | 1150 | :tag "[Option]" |
| 1152 | :tag-glyph "option") | 1151 | :tag-glyph "option") |
| 1153 | (widget-insert " buttons below to edit that | 1152 | (widget-insert " buttons below to edit that |
| 1154 | item in another window.\n\n")) | 1153 | item in another window.\n\n")) |
| 1155 | (let ((custom-buffer-style 'tree)) | 1154 | (let ((custom-buffer-style 'tree)) |
| 1156 | (widget-create 'custom-group | 1155 | (widget-create 'custom-group |
| 1157 | :custom-last t | 1156 | :custom-last t |
| 1158 | :custom-state 'unknown | 1157 | :custom-state 'unknown |
| 1159 | :tag (custom-unlispify-tag-name group) | 1158 | :tag (custom-unlispify-tag-name group) |
| 1160 | :value group)) | 1159 | :value group)) |
| 1161 | (goto-char (point-min))) | 1160 | (goto-char (point-min)))) |
| 1162 | 1161 | ||
| 1163 | (define-widget 'custom-browse-visibility 'item | 1162 | (define-widget 'custom-browse-visibility 'item |
| 1164 | "Control visibility of of items in the customize tree browser." | 1163 | "Control visibility of of items in the customize tree browser." |
| @@ -2996,44 +2995,6 @@ Leave point at the location of the call, or after the last expression." | |||
| 2996 | 2995 | ||
| 2997 | ;;; Menu support | 2996 | ;;; Menu support |
| 2998 | 2997 | ||
| 2999 | (unless (string-match "XEmacs" emacs-version) | ||
| 3000 | (defconst custom-help-menu | ||
| 3001 | '("Customize" | ||
| 3002 | ["Update menu" Custom-menu-update t] | ||
| 3003 | ["Browse" (customize-browse 'emacs) t] | ||
| 3004 | ["Group..." customize-group t] | ||
| 3005 | ["Option..." customize-option t] | ||
| 3006 | ["Face..." customize-face t] | ||
| 3007 | ["Saved..." customize-saved t] | ||
| 3008 | ["Set..." customize-customized t] | ||
| 3009 | "--" | ||
| 3010 | ["Apropos..." customize-apropos t] | ||
| 3011 | ["Group apropos..." customize-apropos-groups t] | ||
| 3012 | ["Option apropos..." customize-apropos-options t] | ||
| 3013 | ["Face apropos..." customize-apropos-faces t]) | ||
| 3014 | ;; This menu should be identical to the one defined in `menu-bar.el'. | ||
| 3015 | "Customize menu") | ||
| 3016 | |||
| 3017 | (defun custom-menu-reset () | ||
| 3018 | "Reset customize menu." | ||
| 3019 | (remove-hook 'custom-define-hook 'custom-menu-reset) | ||
| 3020 | (define-key global-map [menu-bar help-menu customize-menu] | ||
| 3021 | (cons (car custom-help-menu) | ||
| 3022 | (easy-menu-create-keymaps (car custom-help-menu) | ||
| 3023 | (cdr custom-help-menu))))) | ||
| 3024 | |||
| 3025 | (defun Custom-menu-update (event) | ||
| 3026 | "Update customize menu." | ||
| 3027 | (interactive "e") | ||
| 3028 | (add-hook 'custom-define-hook 'custom-menu-reset) | ||
| 3029 | (let* ((emacs (widget-apply '(custom-group) :custom-menu 'emacs)) | ||
| 3030 | (menu `(,(car custom-help-menu) | ||
| 3031 | ,emacs | ||
| 3032 | ,@(cdr (cdr custom-help-menu))))) | ||
| 3033 | (let ((map (easy-menu-create-keymaps (car menu) (cdr menu)))) | ||
| 3034 | (define-key global-map [menu-bar help-menu customize-menu] | ||
| 3035 | (cons (car menu) map)))))) | ||
| 3036 | |||
| 3037 | (defcustom custom-menu-nesting 2 | 2998 | (defcustom custom-menu-nesting 2 |
| 3038 | "Maximum nesting in custom menus." | 2999 | "Maximum nesting in custom menus." |
| 3039 | :type 'integer | 3000 | :type 'integer |