annotate lisp/cus-theme.el @ 68819:a87d4de213c5

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