annotate lisp/cus-theme.el @ 68153:27e860fd29ef

(describe-variable): Remove newlines from void variable output.
author John Paul Wallington <jpw@pobox.com>
date Thu, 12 Jan 2006 22:30:03 +0000
parents a711a44049e2
children fca6909a92e8
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 ;;
64762
41bb365f41c4 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64091
diff changeset
3 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4 ;;
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Author: Alex Schroeder <alex@gnu.org>
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Maintainer: FSF
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; Keywords: help, faces
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; any later version.
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64091
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63956
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63956
diff changeset
24 ;; Boston, MA 02110-1301, USA.
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;;; Code:
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 (require 'widget)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 (require 'cus-edit)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 (eval-when-compile
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 (require 'wid-edit))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33
67950
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
34 (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
35 (let ((map (make-keymap)))
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
36 (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
37 (suppress-keymap map)
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
38 (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
39 (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
40 (define-key map [mouse-1] 'widget-move-and-invoke)
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
41 map)
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
42 "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
43
63928
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
44 (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
45 "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
46 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
47 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
48 (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
49 (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
50 (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
51 (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
52 (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
53 (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
54 (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
55 (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
56 (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
57 (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
58 (set (make-local-variable 'widget-link-suffix) "")))
63928
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
59 (put 'custom-new-theme-mode 'mode-class 'special)
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
60
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
61 (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
62 (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
63 (defvar custom-theme-faces nil)
63928
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
64 (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
65 (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
66 (defvar custom-theme-insert-face-marker)
63928
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
67
50203
3803afb52e4f (custom-theme-create): Add autoload cookie.
John Paul Wallington <jpw@pobox.com>
parents: 49588
diff changeset
68 ;;;###autoload
50287
51b6a93f7e19 (customize-create-theme): Rename from
John Paul Wallington <jpw@pobox.com>
parents: 50203
diff changeset
69 (defun customize-create-theme ()
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 "Create a custom theme."
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 (interactive)
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
72 (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
73 (let ((inhibit-read-only t))
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
74 (erase-buffer))
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
75 (custom-new-theme-mode)
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 (make-local-variable 'custom-theme-name)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 (make-local-variable 'custom-theme-variables)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 (make-local-variable 'custom-theme-faces)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 (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
80 (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
81 (make-local-variable 'custom-theme-insert-face-marker)
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 (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
83 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
84
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
85 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
86 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
87 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
88 (widget-create 'push-button
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
89 :tag "Visit Theme"
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
90 :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
91 :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
92 (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
93 (widget-insert " ")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
94 (widget-create 'push-button
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
95 :tag "Merge Theme"
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
96 :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
97 :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
98 (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
99 (widget-insert " ")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
100 (widget-create 'push-button
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
101 :notify (lambda (&rest ignore)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
102 (when (y-or-n-p "Discard current changes?")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
103 (kill-buffer (current-buffer))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
104 (customize-create-theme)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
105 "Reset Buffer")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
106 (widget-insert " ")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
107 (widget-create 'push-button
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
108 :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
109 "Save Theme")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
110 (widget-insert "\n")
63928
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
111
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
112 (widget-insert "\n\nTheme name: ")
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 (setq custom-theme-name
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 (widget-create 'editable-field
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 :size 10
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 user-login-name))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 (widget-insert "\n\nDocumentation:\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 (setq custom-theme-description
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48952
diff changeset
119 (widget-create 'text
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 :value (format-time-string "Created %Y-%m-%d.")))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 (widget-insert "\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 (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
123 :tag "Insert Variable"
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
124 :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
125 :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
126 (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
127 (widget-insert "\n")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
128 (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
129 (widget-insert "\n")
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 (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
131 :tag "Insert Face"
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
132 :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
133 :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
134 (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
135 (widget-insert "\n")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
136 (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
137 (widget-insert "\n")
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 (widget-create 'push-button
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 :notify (lambda (&rest ignore)
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
140 (when (y-or-n-p "Discard current changes?")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
141 (kill-buffer (current-buffer))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
142 (customize-create-theme)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
143 "Reset Buffer")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
144 (widget-insert " ")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
145 (widget-create 'push-button
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
146 :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
147 "Save Theme")
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 (widget-insert "\n")
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
149 (widget-setup)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
150 (goto-char (point-min))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
151 (message ""))
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 ;;; Theme variables
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
154
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
155 (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
156 (interactive "vVariable name: ")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
157 (save-excursion
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
158 (goto-char 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
159 (if (assq symbol custom-theme-variables)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
160 (message "%s is already in the theme" (symbol-name symbol))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
161 (widget-insert "\n")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
162 (let ((widget (widget-create 'custom-variable
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
163 :tag (custom-unlispify-tag-name symbol)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
164 :custom-level 0
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
165 :action 'custom-theme-variable-action
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
166 :custom-state 'unknown
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
167 :value symbol)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
168 (push (cons symbol widget) custom-theme-variables)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
169 (custom-magic-reset widget))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
170 (widget-setup))))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
171
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
172 (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
173 `(("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
174 (lambda (widget)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
175 (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
176 (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
177 '(themed modified changed)))))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
178 ("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
179 (lambda (widget)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
180 (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
181 (symbol (widget-value widget))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
182 found)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
183 (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
184 (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
185 (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
186 (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
187 (setq found t)))))))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
188 ("---" ignore ignore)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
189 ("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
190 "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
191 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
192
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
193 (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
194 "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
195 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
196 (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
197 (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
198
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
199 (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
200 "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
201 (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
202 (symbol (widget-value widget))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
203 found)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
204 (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
205 (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
206 (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
207 (setq found setting)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
208 (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
209 (nth 3 found)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
210 (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
211 (custom-redraw-magic widget)
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 (widget-setup))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
214 (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
215 (setq custom-theme-variables
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
216 (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
217 (widget-delete widget))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
218
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
219 ;;; Theme faces
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
220
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
221 (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
222 (interactive (list (read-face-name "Face name" nil nil)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
223 (save-excursion
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
224 (goto-char custom-theme-insert-face-marker)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
225 (if (assq symbol custom-theme-faces)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
226 (message "%s is already in the theme" (symbol-name symbol))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
227 (widget-insert "\n")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
228 (let ((widget (widget-create 'custom-face
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
229 :tag (custom-unlispify-tag-name symbol)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
230 :custom-level 0
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
231 :action 'custom-theme-face-action
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
232 :custom-state 'unknown
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
233 :value symbol)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
234 (push (cons symbol widget) custom-theme-faces)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
235 (custom-magic-reset widget)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
236 (widget-setup)))))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
237
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
238 (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
239 `(("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
240 (lambda (widget)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
241 (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
242 (symbol (widget-value widget))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
243 found)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
244 (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
245 (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
246 (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
247 (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
248 (setq found t)))))))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
249 ("---" ignore ignore)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
250 ("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
251 "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
252 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
253
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
254 (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
255 "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
256 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
257 (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
258 (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
259
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
260 (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
261 "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
262 (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
263 (symbol (widget-value widget))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
264 found)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
265 (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
266 (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
267 (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
268 (setq found setting)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
269 (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
270 (nth 3 found)))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
271 (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
272 (custom-redraw-magic widget)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
273 (widget-setup))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
274
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
275 (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
276 (setq custom-theme-faces
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
277 (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
278 (widget-delete widget))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
279
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
280 ;;; Reading and writing
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
281
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
282 (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
283 (interactive)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
284 (when (or (null custom-theme-variables)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
285 (if (y-or-n-p "Discard current changes?")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
286 (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
287 (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
288 (unless (eq theme 'user)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
289 (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
290 (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
291 (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
292 (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
293 (widget-setup))))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
294
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
295 (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
296 (interactive "SCustom theme name: ")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
297 (unless (eq theme 'user)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
298 (load-theme theme))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
299 (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
300 (dolist (setting settings)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
301 (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
302 (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
303 (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
304 (disable-theme theme)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
305 theme)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
306
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307 (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
308 (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
309 (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
310 custom-theme-directory))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
311 (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
312 (vars custom-theme-variables)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
313 (faces custom-theme-faces))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
314 (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
315 (string-equal name "user")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
316 (string-equal name "changed"))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
317 (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
318 ((string-match " " name)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
319 (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
320 ((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
321 (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
322 (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
323 (error "Aborted")))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
324 (with-temp-buffer
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
325 (emacs-lisp-mode)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
326 (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
327 (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
328 (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
329 (erase-buffer)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
330 (insert "(deftheme " name)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
331 (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
332 (insert ")\n")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
333 (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
334 (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
335 (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
336 (save-buffer))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
337 (dolist (var vars)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
338 (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
339 (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
340 (dolist (face faces)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
341 (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
342 (custom-redraw-magic (cdr face)))))
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344 (defun custom-theme-write-variables (theme vars)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
345 "Write a `custom-theme-set-variables' command for THEME.
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346 It includes all variables in list VARS."
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347 (when vars
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348 (let ((standard-output (current-buffer)))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349 (princ "\n(custom-theme-set-variables\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 (princ " '")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
351 (princ theme)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352 (princ "\n")
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
353 (mapc (lambda (spec)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
354 (let* ((symbol (car spec))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
355 (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
356 (value (if child
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
357 (widget-value child)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
358 ;; 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
359 (get symbol 'standard-value))))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
360 (when (boundp symbol)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
361 (unless (bolp)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
362 (princ "\n"))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
363 (princ " '(")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
364 (prin1 symbol)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
365 (princ " ")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
366 (prin1 (custom-quote value))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
367 (princ ")"))))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
368 vars)
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
369 (if (bolp)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
370 (princ " "))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
371 (princ ")")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
372 (unless (looking-at "\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
373 (princ "\n")))))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
374
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
375 (defun custom-theme-write-faces (theme faces)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
376 "Write a `custom-theme-set-faces' command for THEME.
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
377 It includes all faces in list FACES."
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378 (when faces
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379 (let ((standard-output (current-buffer)))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
380 (princ "\n(custom-theme-set-faces\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381 (princ " '")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382 (princ theme)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
383 (princ "\n")
67982
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
384 (mapc (lambda (spec)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
385 (let* ((symbol (car spec))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
386 (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
387 (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
388 (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
389 (unless (bolp)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
390 (princ "\n"))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
391 (princ " '(")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
392 (prin1 symbol)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
393 (princ " ")
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
394 (prin1 value)
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
395 (princ ")"))))
a711a44049e2 * cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents: 67961
diff changeset
396 faces)
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
397 (if (bolp)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
398 (princ " "))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
399 (princ ")")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
400 (unless (looking-at "\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
401 (princ "\n")))))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
402
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 51745
diff changeset
403 ;;; arch-tag: cd6919bc-63af-410e-bae2-b6702e762344
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
404 ;;; cus-theme.el ends here