annotate lisp/cus-theme.el @ 101078:5f4e85fd7c0a

Comments (minor fixes of some header conventions).
author Glenn Morris <rgm@gnu.org>
date Sat, 10 Jan 2009 21:50:40 +0000
parents a9dc0e7c3f2b
children 1d1d5d9bd884
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; cus-theme.el -- custom theme creation user interface
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2 ;;
68651
3bd95f4f2941 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 68161
diff changeset
3 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005,
100908
a9dc0e7c3f2b Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
4 ;; 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;;
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Author: Alex Schroeder <alex@gnu.org>
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; Maintainer: FSF
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 ;; Keywords: help, faces
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
14 ;; the Free Software Foundation, either version 3 of the License, or
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
15 ;; (at your option) any later version.
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; GNU General Public License for more details.
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;;; Code:
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 (require 'widget)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 (require 'cus-edit)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 (eval-when-compile
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 (require 'wid-edit))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32
67950
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
33 (defvar custom-new-theme-mode-map
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
34 (let ((map (make-keymap)))
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
35 (set-keymap-parent map widget-keymap)
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
36 (suppress-keymap map)
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
37 (define-key map "n" 'widget-forward)
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
38 (define-key map "p" 'widget-backward)
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
39 map)
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
40 "Keymap for `custom-new-theme-mode'.")
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
41
63928
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
42 (define-derived-mode custom-new-theme-mode nil "New-Theme"
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
43 "Major mode for the buffer created by `customize-create-theme'.
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
44 Do not call this mode function yourself. It is only meant for internal
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
45 use by `customize-create-theme'."
67950
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
46 (use-local-map custom-new-theme-mode-map)
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
47 (define-key custom-new-theme-mode-map [mouse-1] 'widget-move-and-invoke)
67948
5bf588b1a01e * cus-theme.el (custom-new-theme-mode): Use cus-edit faces.
Chong Yidong <cyd@stupidchicken.com>
parents: 65341
diff changeset
48 (set (make-local-variable 'widget-documentation-face) 'custom-documentation)
5bf588b1a01e * cus-theme.el (custom-new-theme-mode): Use cus-edit faces.
Chong Yidong <cyd@stupidchicken.com>
parents: 65341
diff changeset
49 (set (make-local-variable 'widget-button-face) custom-button)
5bf588b1a01e * cus-theme.el (custom-new-theme-mode): Use cus-edit faces.
Chong Yidong <cyd@stupidchicken.com>
parents: 65341
diff changeset
50 (set (make-local-variable 'widget-button-pressed-face) custom-button-pressed)
67961
52f526ce11f6 * cus-edit.el (custom-button-mouse): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67951
diff changeset
51 (set (make-local-variable 'widget-mouse-face) custom-button-mouse)
67948
5bf588b1a01e * cus-theme.el (custom-new-theme-mode): Use cus-edit faces.
Chong Yidong <cyd@stupidchicken.com>
parents: 65341
diff changeset
52 (when custom-raised-buttons
5bf588b1a01e * cus-theme.el (custom-new-theme-mode): Use cus-edit faces.
Chong Yidong <cyd@stupidchicken.com>
parents: 65341
diff changeset
53 (set (make-local-variable 'widget-push-button-prefix) "")
5bf588b1a01e * cus-theme.el (custom-new-theme-mode): Use cus-edit faces.
Chong Yidong <cyd@stupidchicken.com>
parents: 65341
diff changeset
54 (set (make-local-variable 'widget-push-button-suffix) "")
5bf588b1a01e * cus-theme.el (custom-new-theme-mode): Use cus-edit faces.
Chong Yidong <cyd@stupidchicken.com>
parents: 65341
diff changeset
55 (set (make-local-variable 'widget-link-prefix) "")
5bf588b1a01e * cus-theme.el (custom-new-theme-mode): Use cus-edit faces.
Chong Yidong <cyd@stupidchicken.com>
parents: 65341
diff changeset
56 (set (make-local-variable 'widget-link-suffix) "")))
63928
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
57 (put 'custom-new-theme-mode 'mode-class 'special)
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
58
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
59 (defvar custom-theme-name nil)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
60 (defvar custom-theme-variables nil)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
61 (defvar custom-theme-faces nil)
63928
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
62 (defvar custom-theme-description)
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
63 (defvar custom-theme-insert-variable-marker)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
64 (defvar custom-theme-insert-face-marker)
63928
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
65
50203
3803afb52e4f (custom-theme-create): Add autoload cookie.
John Paul Wallington <jpw@pobox.com>
parents: 49588
diff changeset
66 ;;;###autoload
50287
51b6a93f7e19 (customize-create-theme): Rename from
John Paul Wallington <jpw@pobox.com>
parents: 50203
diff changeset
67 (defun customize-create-theme ()
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 "Create a custom theme."
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 (interactive)
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
70 (switch-to-buffer (generate-new-buffer "*New Custom Theme*"))
63928
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
71 (let ((inhibit-read-only t))
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
72 (erase-buffer))
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
73 (custom-new-theme-mode)
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 (make-local-variable 'custom-theme-name)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 (make-local-variable 'custom-theme-variables)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 (make-local-variable 'custom-theme-faces)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 (make-local-variable 'custom-theme-description)
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
78 (make-local-variable 'custom-theme-insert-variable-marker)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
79 (make-local-variable 'custom-theme-insert-face-marker)
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 (widget-insert "This buffer helps you write a custom theme elisp file.
63928
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
81 This will help you share your customizations with other people.
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
82
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
83 Insert the names of all variables and faces you want the theme to include.
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
84 Invoke \"Save Theme\" to save the theme. The theme file will be saved to
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
85 the directory " custom-theme-directory "\n\n")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
86 (widget-create 'push-button
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
87 :tag "Visit Theme"
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
88 :help-echo "Insert the settings of a pre-defined theme."
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
89 :action (lambda (widget &optional event)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
90 (call-interactively 'custom-theme-visit-theme)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
91 (widget-insert " ")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
92 (widget-create 'push-button
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
93 :tag "Merge Theme"
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
94 :help-echo "Merge in the settings of a pre-defined theme."
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
95 :action (lambda (widget &optional event)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
96 (call-interactively 'custom-theme-merge-theme)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
97 (widget-insert " ")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
98 (widget-create 'push-button
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
99 :notify (lambda (&rest ignore)
72386
2ce9bf47e864 * cus-theme.el (customize-create-theme)
Romain Francoise <romain@orebokech.com>
parents: 68912
diff changeset
100 (when (y-or-n-p "Discard current changes? ")
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
101 (kill-buffer (current-buffer))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
102 (customize-create-theme)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
103 "Reset Buffer")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
104 (widget-insert " ")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
105 (widget-create 'push-button
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
106 :notify (function custom-theme-write)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
107 "Save Theme")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
108 (widget-insert "\n")
63928
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
109
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
110 (widget-insert "\n\nTheme name: ")
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 (setq custom-theme-name
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 (widget-create 'editable-field
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 :size 10
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 user-login-name))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 (widget-insert "\n\nDocumentation:\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 (setq custom-theme-description
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48952
diff changeset
117 (widget-create 'text
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 :value (format-time-string "Created %Y-%m-%d.")))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 (widget-insert "\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 (widget-create 'push-button
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
121 :tag "Insert Variable"
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
122 :help-echo "Add another variable to this theme."
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
123 :action (lambda (widget &optional event)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
124 (call-interactively 'custom-theme-add-variable)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
125 (widget-insert "\n")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
126 (setq custom-theme-insert-variable-marker (point-marker))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
127 (widget-insert "\n")
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 (widget-create 'push-button
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
129 :tag "Insert Face"
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
130 :help-echo "Add another face to this theme."
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
131 :action (lambda (widget &optional event)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
132 (call-interactively 'custom-theme-add-face)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
133 (widget-insert "\n")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
134 (setq custom-theme-insert-face-marker (point-marker))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
135 (widget-insert "\n")
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 (widget-create 'push-button
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 :notify (lambda (&rest ignore)
72386
2ce9bf47e864 * cus-theme.el (customize-create-theme)
Romain Francoise <romain@orebokech.com>
parents: 68912
diff changeset
138 (when (y-or-n-p "Discard current changes? ")
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
139 (kill-buffer (current-buffer))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
140 (customize-create-theme)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
141 "Reset Buffer")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
142 (widget-insert " ")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
143 (widget-create 'push-button
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
144 :notify (function custom-theme-write)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
145 "Save Theme")
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 (widget-insert "\n")
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
147 (widget-setup)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
148 (goto-char (point-min))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
149 (message ""))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
150
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
151 ;;; Theme variables
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
152
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
153 (defun custom-theme-add-variable (symbol)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
154 (interactive "vVariable name: ")
68161
b219be97e734 Minor fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 68160
diff changeset
155 (cond ((assq symbol custom-theme-variables)
b219be97e734 Minor fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 68160
diff changeset
156 (message "%s is already in the theme" (symbol-name symbol)))
b219be97e734 Minor fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 68160
diff changeset
157 ((not (boundp symbol))
b219be97e734 Minor fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 68160
diff changeset
158 (message "%s is not defined as a variable" (symbol-name symbol)))
b219be97e734 Minor fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 68160
diff changeset
159 ((eq symbol 'custom-enabled-themes)
b219be97e734 Minor fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 68160
diff changeset
160 (message "Custom theme cannot contain `custom-enabled-themes'"))
b219be97e734 Minor fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 68160
diff changeset
161 (t
b219be97e734 Minor fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 68160
diff changeset
162 (save-excursion
b219be97e734 Minor fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 68160
diff changeset
163 (goto-char custom-theme-insert-variable-marker)
68159
fca6909a92e8 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents: 67982
diff changeset
164 (widget-insert "\n")
fca6909a92e8 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents: 67982
diff changeset
165 (let ((widget (widget-create 'custom-variable
fca6909a92e8 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents: 67982
diff changeset
166 :tag (custom-unlispify-tag-name symbol)
fca6909a92e8 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents: 67982
diff changeset
167 :custom-level 0
fca6909a92e8 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents: 67982
diff changeset
168 :action 'custom-theme-variable-action
fca6909a92e8 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents: 67982
diff changeset
169 :custom-state 'unknown
fca6909a92e8 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents: 67982
diff changeset
170 :value symbol)))
fca6909a92e8 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents: 67982
diff changeset
171 (push (cons symbol widget) custom-theme-variables)
fca6909a92e8 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents: 67982
diff changeset
172 (custom-magic-reset widget))
fca6909a92e8 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents: 67982
diff changeset
173 (widget-setup)))))
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
174
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
175 (defvar custom-theme-variable-menu
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
176 `(("Reset to Current" custom-redraw
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
177 (lambda (widget)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
178 (and (boundp (widget-value widget))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
179 (memq (widget-get widget :custom-state)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
180 '(themed modified changed)))))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
181 ("Reset to Theme Value" custom-variable-reset-theme
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
182 (lambda (widget)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
183 (let ((theme (intern (widget-value custom-theme-name)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
184 (symbol (widget-value widget))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
185 found)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
186 (and (custom-theme-p theme)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
187 (dolist (setting (get theme 'theme-settings) found)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
188 (if (and (eq (cadr setting) symbol)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
189 (eq (car setting) 'theme-value))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
190 (setq found t)))))))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
191 ("---" ignore ignore)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
192 ("Delete" custom-theme-delete-variable nil))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
193 "Alist of actions for the `custom-variable' widget in Custom Theme Mode.
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
194 See the documentation for `custom-variable'.")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
195
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
196 (defun custom-theme-variable-action (widget &optional event)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
197 "Show the Custom Theme Mode menu for a `custom-variable' widget.
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
198 Optional EVENT is the location for the menu."
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
199 (let ((custom-variable-menu custom-theme-variable-menu))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
200 (custom-variable-action widget event)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
201
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
202 (defun custom-variable-reset-theme (widget)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
203 "Reset WIDGET to its value for the currently edited theme."
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
204 (let ((theme (intern (widget-value custom-theme-name)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
205 (symbol (widget-value widget))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
206 found)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
207 (dolist (setting (get theme 'theme-settings))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
208 (if (and (eq (cadr setting) symbol)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
209 (eq (car setting) 'theme-value))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
210 (setq found setting)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
211 (widget-value-set (car (widget-get widget :children))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
212 (nth 3 found)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
213 (widget-put widget :custom-state 'themed)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
214 (custom-redraw-magic widget)
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 (widget-setup))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
217 (defun custom-theme-delete-variable (widget)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
218 (setq custom-theme-variables
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
219 (assq-delete-all (widget-value widget) custom-theme-variables))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
220 (widget-delete widget))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
221
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
222 ;;; Theme faces
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
223
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
224 (defun custom-theme-add-face (symbol)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
225 (interactive (list (read-face-name "Face name" nil nil)))
68161
b219be97e734 Minor fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 68160
diff changeset
226 (cond ((assq symbol custom-theme-faces)
b219be97e734 Minor fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 68160
diff changeset
227 (message "%s is already in the theme" (symbol-name symbol)))
b219be97e734 Minor fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 68160
diff changeset
228 ((not (facep symbol))
b219be97e734 Minor fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 68160
diff changeset
229 (message "%s is not defined as a face" (symbol-name symbol)))
b219be97e734 Minor fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 68160
diff changeset
230 (t
b219be97e734 Minor fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 68160
diff changeset
231 (save-excursion
b219be97e734 Minor fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 68160
diff changeset
232 (goto-char custom-theme-insert-face-marker)
68159
fca6909a92e8 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents: 67982
diff changeset
233 (widget-insert "\n")
fca6909a92e8 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents: 67982
diff changeset
234 (let ((widget (widget-create 'custom-face
fca6909a92e8 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents: 67982
diff changeset
235 :tag (custom-unlispify-tag-name symbol)
fca6909a92e8 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents: 67982
diff changeset
236 :custom-level 0
fca6909a92e8 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents: 67982
diff changeset
237 :action 'custom-theme-face-action
fca6909a92e8 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents: 67982
diff changeset
238 :custom-state 'unknown
fca6909a92e8 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents: 67982
diff changeset
239 :value symbol)))
fca6909a92e8 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents: 67982
diff changeset
240 (push (cons symbol widget) custom-theme-faces)
fca6909a92e8 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents: 67982
diff changeset
241 (custom-magic-reset widget)
fca6909a92e8 * cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents: 67982
diff changeset
242 (widget-setup))))))
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
243
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
244 (defvar custom-theme-face-menu
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
245 `(("Reset to Theme Value" custom-face-reset-theme
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
246 (lambda (widget)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
247 (let ((theme (intern (widget-value custom-theme-name)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
248 (symbol (widget-value widget))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
249 found)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
250 (and (custom-theme-p theme)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
251 (dolist (setting (get theme 'theme-settings) found)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
252 (if (and (eq (cadr setting) symbol)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
253 (eq (car setting) 'theme-face))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
254 (setq found t)))))))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
255 ("---" ignore ignore)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
256 ("Delete" custom-theme-delete-face nil))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
257 "Alist of actions for the `custom-variable' widget in Custom Theme Mode.
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
258 See the documentation for `custom-variable'.")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
259
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
260 (defun custom-theme-face-action (widget &optional event)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
261 "Show the Custom Theme Mode menu for a `custom-face' widget.
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
262 Optional EVENT is the location for the menu."
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
263 (let ((custom-face-menu custom-theme-face-menu))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
264 (custom-face-action widget event)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
265
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
266 (defun custom-face-reset-theme (widget)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
267 "Reset WIDGET to its value for the currently edited theme."
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
268 (let ((theme (intern (widget-value custom-theme-name)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
269 (symbol (widget-value widget))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
270 found)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
271 (dolist (setting (get theme 'theme-settings))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
272 (if (and (eq (cadr setting) symbol)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
273 (eq (car setting) 'theme-face))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
274 (setq found setting)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
275 (widget-value-set (car (widget-get widget :children))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
276 (nth 3 found)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
277 (widget-put widget :custom-state 'themed)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
278 (custom-redraw-magic widget)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
279 (widget-setup))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
280
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
281 (defun custom-theme-delete-face (widget)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
282 (setq custom-theme-faces
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
283 (assq-delete-all (widget-value widget) custom-theme-faces))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
284 (widget-delete widget))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
285
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
286 ;;; Reading and writing
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
287
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
288 (defun custom-theme-visit-theme ()
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
289 (interactive)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
290 (when (or (null custom-theme-variables)
72386
2ce9bf47e864 * cus-theme.el (customize-create-theme)
Romain Francoise <romain@orebokech.com>
parents: 68912
diff changeset
291 (if (y-or-n-p "Discard current changes? ")
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
292 (progn (customize-create-theme) t)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
293 (let ((theme (call-interactively 'custom-theme-merge-theme)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
294 (unless (eq theme 'user)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
295 (widget-value-set custom-theme-name (symbol-name theme)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
296 (widget-value-set custom-theme-description
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
297 (or (get theme 'theme-documentation)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
298 (format-time-string "Created %Y-%m-%d.")))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
299 (widget-setup))))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
300
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
301 (defun custom-theme-merge-theme (theme)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
302 (interactive "SCustom theme name: ")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
303 (unless (eq theme 'user)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
304 (load-theme theme))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
305 (let ((settings (get theme 'theme-settings)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
306 (dolist (setting settings)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
307 (if (eq (car setting) 'theme-value)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
308 (custom-theme-add-variable (cadr setting))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
309 (custom-theme-add-face (cadr setting)))))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
310 (disable-theme theme)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
311 theme)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
312
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313 (defun custom-theme-write (&rest ignore)
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
314 (let* ((name (widget-value custom-theme-name))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
315 (filename (expand-file-name (concat name "-theme.el")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
316 custom-theme-directory))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
317 (doc (widget-value custom-theme-description))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
318 (vars custom-theme-variables)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
319 (faces custom-theme-faces))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
320 (cond ((or (string-equal name "")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
321 (string-equal name "user")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
322 (string-equal name "changed"))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
323 (error "Custom themes cannot be named `%s'" name))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
324 ((string-match " " name)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
325 (error "Custom theme names should not contain spaces"))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
326 ((if (file-exists-p filename)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
327 (not (y-or-n-p
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
328 (format "File %s exists. Overwrite? " filename))))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
329 (error "Aborted")))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
330 (with-temp-buffer
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
331 (emacs-lisp-mode)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
332 (unless (file-exists-p custom-theme-directory)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
333 (make-directory (file-name-as-directory custom-theme-directory) t))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
334 (setq buffer-file-name filename)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
335 (erase-buffer)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
336 (insert "(deftheme " name)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
337 (if doc (insert "\n \"" doc "\""))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
338 (insert ")\n")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
339 (custom-theme-write-variables name vars)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
340 (custom-theme-write-faces name faces)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
341 (insert "\n(provide-theme '" name ")\n")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
342 (save-buffer))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
343 (dolist (var vars)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
344 (widget-put (cdr var) :custom-state 'saved)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
345 (custom-redraw-magic (cdr var)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
346 (dolist (face faces)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
347 (widget-put (cdr face) :custom-state 'saved)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
348 (custom-redraw-magic (cdr face)))))
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 (defun custom-theme-write-variables (theme vars)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
351 "Write a `custom-theme-set-variables' command for THEME.
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352 It includes all variables in list VARS."
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
353 (when vars
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354 (let ((standard-output (current-buffer)))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355 (princ "\n(custom-theme-set-variables\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
356 (princ " '")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
357 (princ theme)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
358 (princ "\n")
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
359 (mapc (lambda (spec)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
360 (let* ((symbol (car spec))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
361 (child (car-safe (widget-get (cdr spec) :children)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
362 (value (if child
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
363 (widget-value child)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
364 ;; For hidden widgets, use the standard value
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
365 (get symbol 'standard-value))))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
366 (when (boundp symbol)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
367 (unless (bolp)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
368 (princ "\n"))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
369 (princ " '(")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
370 (prin1 symbol)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
371 (princ " ")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
372 (prin1 (custom-quote value))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
373 (princ ")"))))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
374 vars)
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
375 (if (bolp)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
376 (princ " "))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
377 (princ ")")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378 (unless (looking-at "\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379 (princ "\n")))))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
380
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381 (defun custom-theme-write-faces (theme faces)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382 "Write a `custom-theme-set-faces' command for THEME.
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
383 It includes all faces in list FACES."
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
384 (when faces
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
385 (let ((standard-output (current-buffer)))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
386 (princ "\n(custom-theme-set-faces\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
387 (princ " '")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
388 (princ theme)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
389 (princ "\n")
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
390 (mapc (lambda (spec)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
391 (let* ((symbol (car spec))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
392 (child (car-safe (widget-get (cdr spec) :children)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
393 (value (if child (widget-value child))))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
394 (when (and (facep symbol) child)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
395 (unless (bolp)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
396 (princ "\n"))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
397 (princ " '(")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
398 (prin1 symbol)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
399 (princ " ")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
400 (prin1 value)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
401 (princ ")"))))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
402 faces)
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403 (if (bolp)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
404 (princ " "))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
405 (princ ")")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
406 (unless (looking-at "\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407 (princ "\n")))))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
408
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 79721
diff changeset
409 ;; arch-tag: cd6919bc-63af-410e-bae2-b6702e762344
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410 ;;; cus-theme.el ends here