Mercurial > emacs
comparison lisp/cus-edit.el @ 110938:17bbe431e616
New interface for choosing Custom themes.
* lisp/cus-edit.el (custom--initialize-widget-variables): New function.
(Custom-mode): Use it.
* lisp/cus-face.el (custom-theme-set-faces): Remove dead code. Obey
custom--inhibit-theme-enable.
* lisp/cus-theme.el (describe-theme, customize-themes)
(custom-theme-save): New commands.
(custom-new-theme-mode-map): Bind C-x C-s.
(custom-new-theme-mode): Use custom--initialize-widget-variables.
(customize-create-theme): New optional arg THEME.
(custom-theme-revert): Use it.
(custom-theme-visit-theme): Remove dead code.
(custom-theme-merge-theme): Use custom-available-themes.
(custom-theme-write): Make interactive.
(custom-theme-write): Use custom-theme-name-valid-p.
(describe-theme-1, custom-theme-choose-revert)
(custom-theme-checkbox-toggle, custom-theme-selections-toggle):
New funs.
(custom-theme-allow-multiple-selections): New option.
(custom-theme-choose-mode): New major mode.
* lisp/custom.el (custom-theme-set-variables): Remove dead code. Obey
custom--inhibit-theme-enable.
(custom--inhibit-theme-enable): New var.
(provide-theme): Obey it.
(load-theme): Replace load with manual read/eval, in order to
check for correctness. Use custom-theme-name-valid-p.
(custom-theme-name-valid-p): New function.
(custom-available-themes): Use it.
* lisp/help-mode.el (help-theme-def, help-theme-edit): New buttons.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Mon, 11 Oct 2010 23:10:21 -0400 |
parents | ccdc694ce7bd |
children | 5ffdb52c377c |
comparison
equal
deleted
inserted
replaced
110937:51080327d173 | 110938:17bbe431e616 |
---|---|
437 :group 'environment) | 437 :group 'environment) |
438 | 438 |
439 ;;; Custom mode keymaps | 439 ;;; Custom mode keymaps |
440 | 440 |
441 (defvar custom-mode-map | 441 (defvar custom-mode-map |
442 ;; This keymap should be dense, but a dense keymap would prevent inheriting | |
443 ;; "\r" bindings from the parent map. | |
444 ;; Actually, this misfeature of dense keymaps was fixed on 2001-11-26. | |
445 (let ((map (make-keymap))) | 442 (let ((map (make-keymap))) |
446 (set-keymap-parent map widget-keymap) | 443 (set-keymap-parent map widget-keymap) |
447 (define-key map [remap self-insert-command] 'Custom-no-edit) | 444 (define-key map [remap self-insert-command] 'Custom-no-edit) |
448 (define-key map "\^m" 'Custom-newline) | 445 (define-key map "\^m" 'Custom-newline) |
449 (define-key map " " 'scroll-up) | 446 (define-key map " " 'scroll-up) |
4704 | 4701 |
4705 (defun custom-state-buffer-message (widget) | 4702 (defun custom-state-buffer-message (widget) |
4706 (if (eq (widget-get (widget-get widget :parent) :custom-state) 'modified) | 4703 (if (eq (widget-get (widget-get widget :parent) :custom-state) 'modified) |
4707 (message "To install your edits, invoke [State] and choose the Set operation"))) | 4704 (message "To install your edits, invoke [State] and choose the Set operation"))) |
4708 | 4705 |
4706 (defun custom--initialize-widget-variables () | |
4707 (set (make-local-variable 'widget-documentation-face) 'custom-documentation) | |
4708 (set (make-local-variable 'widget-button-face) custom-button) | |
4709 (set (make-local-variable 'widget-button-pressed-face) custom-button-pressed) | |
4710 (set (make-local-variable 'widget-mouse-face) custom-button-mouse) | |
4711 ;; We need this because of the "More" button on docstrings. | |
4712 ;; Otherwise clicking on "More" can push point offscreen, which | |
4713 ;; causes the window to recenter on point, which pushes the | |
4714 ;; newly-revealed docstring offscreen; which is annoying. -- cyd. | |
4715 (set (make-local-variable 'widget-button-click-moves-point) t) | |
4716 ;; When possible, use relief for buttons, not bracketing. This test | |
4717 ;; may not be optimal. | |
4718 (when custom-raised-buttons | |
4719 (set (make-local-variable 'widget-push-button-prefix) "") | |
4720 (set (make-local-variable 'widget-push-button-suffix) "") | |
4721 (set (make-local-variable 'widget-link-prefix) "") | |
4722 (set (make-local-variable 'widget-link-suffix) "")) | |
4723 (setq show-trailing-whitespace nil)) | |
4724 | |
4709 (define-derived-mode Custom-mode nil "Custom" | 4725 (define-derived-mode Custom-mode nil "Custom" |
4710 "Major mode for editing customization buffers. | 4726 "Major mode for editing customization buffers. |
4711 | 4727 |
4712 The following commands are available: | 4728 The following commands are available: |
4713 | 4729 |
4741 :label (nth 5 arg))) | 4757 :label (nth 5 arg))) |
4742 custom-commands) | 4758 custom-commands) |
4743 (setq custom-tool-bar-map map)))) | 4759 (setq custom-tool-bar-map map)))) |
4744 (make-local-variable 'custom-options) | 4760 (make-local-variable 'custom-options) |
4745 (make-local-variable 'custom-local-buffer) | 4761 (make-local-variable 'custom-local-buffer) |
4746 (make-local-variable 'widget-documentation-face) | 4762 (custom--initialize-widget-variables) |
4747 (setq widget-documentation-face 'custom-documentation) | |
4748 (make-local-variable 'widget-button-face) | |
4749 (setq widget-button-face custom-button) | |
4750 (setq show-trailing-whitespace nil) | |
4751 | |
4752 ;; We need this because of the "More" button on docstrings. | |
4753 ;; Otherwise clicking on "More" can push point offscreen, which | |
4754 ;; causes the window to recenter on point, which pushes the | |
4755 ;; newly-revealed docstring offscreen; which is annoying. -- cyd. | |
4756 (set (make-local-variable 'widget-button-click-moves-point) t) | |
4757 | |
4758 (set (make-local-variable 'widget-button-pressed-face) custom-button-pressed) | |
4759 (set (make-local-variable 'widget-mouse-face) custom-button-mouse) | |
4760 | |
4761 ;; When possible, use relief for buttons, not bracketing. This test | |
4762 ;; may not be optimal. | |
4763 (when custom-raised-buttons | |
4764 (set (make-local-variable 'widget-push-button-prefix) "") | |
4765 (set (make-local-variable 'widget-push-button-suffix) "") | |
4766 (set (make-local-variable 'widget-link-prefix) "") | |
4767 (set (make-local-variable 'widget-link-suffix) "")) | |
4768 (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t)) | 4763 (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t)) |
4769 | 4764 |
4770 (put 'Custom-mode 'mode-class 'special) | 4765 (put 'Custom-mode 'mode-class 'special) |
4771 | 4766 |
4772 ;; backward-compatibility | 4767 ;; backward-compatibility |