Mercurial > emacs
annotate lisp/cus-theme.el @ 110410:f2e111723c3a
Merge changes made in Gnus trunk.
Reimplement nnimap, and do tweaks to the rest of the code to support that.
* gnus-int.el (gnus-finish-retrieve-group-infos)
(gnus-retrieve-group-data-early): New functions.
* gnus-range.el (gnus-range-nconcat): New function.
* gnus-start.el (gnus-get-unread-articles): Support early retrieval of
data.
(gnus-read-active-for-groups): Support finishing the early retrieval of
data.
* gnus-sum.el (gnus-summary-move-article): Pass the move-to group name
if the move is internal, so that nnimap can do fast internal moves.
* gnus.el (gnus-article-special-mark-lists): Add uid/active tuples, for
nnimap usage.
* nnimap.el: Rewritten.
* nnmail.el (nnmail-inhibit-default-split-group): New internal variable
to allow the mail splitting to not return a default group. This is
useful for nnimap, which will leave unmatched mail in the inbox.
* utf7.el (utf7-encode): Autoload.
Implement shell connection.
* nnimap.el (nnimap-open-shell-stream): New function.
(nnimap-open-connection): Use it.
Get the number of lines by using BODYSTRUCTURE.
(nnimap-transform-headers): Get the number of lines in each message.
(nnimap-retrieve-headers): Query for BODYSTRUCTURE so that we get the
number of lines.
Not all servers return UIDNEXT. Work past this problem.
Remove junk from end of file.
Fix typo in "bogus" section.
Make capabilties be case-insensitive.
Require cl when compiling.
Don't bug out if the LIST command doesn't have any parameters.
2010-09-17 Knut Anders Hatlen <kahatlen@gmail.com> (tiny change)
* nnimap.el (nnimap-get-groups): Don't bug out if the LIST command
doesn't have any parameters.
(mm-text-html-renderer): Document gnus-article-html.
2010-09-17 Julien Danjou <julien@danjou.info> (tiny fix)
* mm-decode.el (mm-text-html-renderer): Document gnus-article-html.
* dgnushack.el: Define netrc-credentials.
If the user doesn't have a /etc/services, supply some sensible port defaults.
Have `unseen-or-unread' select an unread unseen article first.
(nntp-open-server): Return whether the open was successful or not.
Throughout all files, replace (save-excursion (set-buffer ...)) with (with-current-buffer ... ).
Save result so that it doesn't say "failed" all the time.
Add ~/.authinfo to the default, since that's probably most useful for users.
Don't use the "finish" method when we're reading from the agent.
Add some more nnimap-relevant agent stuff to nnagent.el.
* nnimap.el (nnimap-with-process-buffer): Removed.
Revert one line that was changed by mistake in the last checkin.
(nnimap-open-connection): Don't error out when we can't make a connection
nnimap-related changes to avoid bugging out if we can't contact a server.
* gnus-start.el (gnus-get-unread-articles): Don't try to scan groups
from methods that are denied.
* nnimap.el (nnimap-possibly-change-group): Return nil if we can't log
in.
(nnimap-finish-retrieve-group-infos): Make sure we're not waiting for
nothing.
* gnus-sum.el (gnus-select-newsgroup): Indent.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Sat, 18 Sep 2010 10:02:19 +0000 |
parents | 280c8ae2476d |
children | 0d6d71f9b91a |
rev | line source |
---|---|
48952 | 1 ;;; cus-theme.el -- custom theme creation user interface |
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, |
106815 | 4 ;; 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
48952 | 5 ;; |
6 ;; Author: Alex Schroeder <alex@gnu.org> | |
7 ;; Maintainer: FSF | |
8 ;; Keywords: help, faces | |
110015
280c8ae2476d
Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
9 ;; Package: emacs |
48952 | 10 |
11 ;; This file is part of GNU Emacs. | |
12 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
13 ;; GNU Emacs is free software: you can redistribute it and/or modify |
48952 | 14 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
15 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
16 ;; (at your option) any later version. |
48952 | 17 |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; You should have received a copy of the GNU General Public License | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
48952 | 25 |
26 ;;; Code: | |
27 | |
28 (require 'widget) | |
29 (require 'cus-edit) | |
30 | |
31 (eval-when-compile | |
32 (require 'wid-edit)) | |
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 map) |
87b213a028b3
* cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents:
67949
diff
changeset
|
41 "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
|
42 |
63928
e559c2c766bc
(custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
61603
diff
changeset
|
43 (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
|
44 "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
|
45 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
|
46 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
|
47 (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
|
48 (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
|
49 (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
|
50 (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
|
51 (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
|
52 (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
|
53 (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
|
54 (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
|
55 (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
|
56 (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
|
57 (set (make-local-variable 'widget-link-suffix) ""))) |
63928
e559c2c766bc
(custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
61603
diff
changeset
|
58 (put 'custom-new-theme-mode 'mode-class 'special) |
e559c2c766bc
(custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
61603
diff
changeset
|
59 |
67982
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
60 (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
|
61 (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
|
62 (defvar custom-theme-faces nil) |
63928
e559c2c766bc
(custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
61603
diff
changeset
|
63 (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
|
64 (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
|
65 (defvar custom-theme-insert-face-marker) |
63928
e559c2c766bc
(custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
61603
diff
changeset
|
66 |
50203
3803afb52e4f
(custom-theme-create): Add autoload cookie.
John Paul Wallington <jpw@pobox.com>
parents:
49588
diff
changeset
|
67 ;;;###autoload |
50287
51b6a93f7e19
(customize-create-theme): Rename from
John Paul Wallington <jpw@pobox.com>
parents:
50203
diff
changeset
|
68 (defun customize-create-theme () |
48952 | 69 "Create a custom theme." |
70 (interactive) | |
67982
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
71 (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
|
72 (let ((inhibit-read-only t)) |
e559c2c766bc
(custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
61603
diff
changeset
|
73 (erase-buffer)) |
e559c2c766bc
(custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
61603
diff
changeset
|
74 (custom-new-theme-mode) |
48952 | 75 (make-local-variable 'custom-theme-name) |
76 (make-local-variable 'custom-theme-variables) | |
77 (make-local-variable 'custom-theme-faces) | |
78 (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
|
79 (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
|
80 (make-local-variable 'custom-theme-insert-face-marker) |
48952 | 81 (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
|
82 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
|
83 |
67982
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
84 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
|
85 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
|
86 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
|
87 (widget-create 'push-button |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
88 :tag "Visit Theme" |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
89 :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
|
90 :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
|
91 (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
|
92 (widget-insert " ") |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
93 (widget-create 'push-button |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
94 :tag "Merge Theme" |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
95 :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
|
96 :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
|
97 (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
|
98 (widget-insert " ") |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
99 (widget-create 'push-button |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
100 :notify (lambda (&rest ignore) |
72386
2ce9bf47e864
* cus-theme.el (customize-create-theme)
Romain Francoise <romain@orebokech.com>
parents:
68912
diff
changeset
|
101 (when (y-or-n-p "Discard current changes? ") |
67982
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
102 (kill-buffer (current-buffer)) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
103 (customize-create-theme))) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
104 "Reset Buffer") |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
105 (widget-insert " ") |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
106 (widget-create 'push-button |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
107 :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
|
108 "Save Theme") |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
109 (widget-insert "\n") |
63928
e559c2c766bc
(custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents:
61603
diff
changeset
|
110 |
67982
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
111 (widget-insert "\n\nTheme name: ") |
48952 | 112 (setq custom-theme-name |
113 (widget-create 'editable-field | |
114 :size 10 | |
115 user-login-name)) | |
116 (widget-insert "\n\nDocumentation:\n") | |
117 (setq custom-theme-description | |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48952
diff
changeset
|
118 (widget-create 'text |
48952 | 119 :value (format-time-string "Created %Y-%m-%d."))) |
120 (widget-insert "\n") | |
121 (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
|
122 :tag "Insert Variable" |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
123 :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
|
124 :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
|
125 (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
|
126 (widget-insert "\n") |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
127 (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
|
128 (widget-insert "\n") |
48952 | 129 (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
|
130 :tag "Insert Face" |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
131 :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
|
132 :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
|
133 (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
|
134 (widget-insert "\n") |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
135 (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
|
136 (widget-insert "\n") |
48952 | 137 (widget-create 'push-button |
138 :notify (lambda (&rest ignore) | |
72386
2ce9bf47e864
* cus-theme.el (customize-create-theme)
Romain Francoise <romain@orebokech.com>
parents:
68912
diff
changeset
|
139 (when (y-or-n-p "Discard current changes? ") |
67982
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
140 (kill-buffer (current-buffer)) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
141 (customize-create-theme))) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
142 "Reset Buffer") |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
143 (widget-insert " ") |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
144 (widget-create 'push-button |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
145 :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
|
146 "Save Theme") |
48952 | 147 (widget-insert "\n") |
67982
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
148 (widget-setup) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
149 (goto-char (point-min)) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
150 (message "")) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
151 |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
152 ;;; Theme variables |
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 (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
|
155 (interactive "vVariable name: ") |
68161 | 156 (cond ((assq symbol custom-theme-variables) |
157 (message "%s is already in the theme" (symbol-name symbol))) | |
158 ((not (boundp symbol)) | |
159 (message "%s is not defined as a variable" (symbol-name symbol))) | |
160 ((eq symbol 'custom-enabled-themes) | |
161 (message "Custom theme cannot contain `custom-enabled-themes'")) | |
162 (t | |
163 (save-excursion | |
164 (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
|
165 (widget-insert "\n") |
fca6909a92e8
* cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents:
67982
diff
changeset
|
166 (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
|
167 :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
|
168 :custom-level 0 |
fca6909a92e8
* cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents:
67982
diff
changeset
|
169 :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
|
170 :custom-state 'unknown |
fca6909a92e8
* cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents:
67982
diff
changeset
|
171 :value symbol))) |
fca6909a92e8
* cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents:
67982
diff
changeset
|
172 (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
|
173 (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
|
174 (widget-setup))))) |
67982
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
175 |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
176 (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
|
177 `(("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
|
178 (lambda (widget) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
179 (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
|
180 (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
|
181 '(themed modified changed))))) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
182 ("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
|
183 (lambda (widget) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
184 (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
|
185 (symbol (widget-value widget)) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
186 found) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
187 (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
|
188 (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
|
189 (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
|
190 (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
|
191 (setq found t))))))) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
192 ("---" ignore ignore) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
193 ("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
|
194 "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
|
195 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
|
196 |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
197 (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
|
198 "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
|
199 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
|
200 (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
|
201 (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
|
202 |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
203 (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
|
204 "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
|
205 (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
|
206 (symbol (widget-value widget)) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
207 found) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
208 (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
|
209 (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
|
210 (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
|
211 (setq found setting))) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
212 (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
|
213 (nth 3 found))) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
214 (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
|
215 (custom-redraw-magic widget) |
48952 | 216 (widget-setup)) |
217 | |
67982
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
218 (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
|
219 (setq custom-theme-variables |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
220 (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
|
221 (widget-delete widget)) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
222 |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
223 ;;; Theme faces |
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 (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
|
226 (interactive (list (read-face-name "Face name" nil nil))) |
68161 | 227 (cond ((assq symbol custom-theme-faces) |
228 (message "%s is already in the theme" (symbol-name symbol))) | |
229 ((not (facep symbol)) | |
230 (message "%s is not defined as a face" (symbol-name symbol))) | |
231 (t | |
232 (save-excursion | |
233 (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
|
234 (widget-insert "\n") |
fca6909a92e8
* cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents:
67982
diff
changeset
|
235 (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
|
236 :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
|
237 :custom-level 0 |
fca6909a92e8
* cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents:
67982
diff
changeset
|
238 :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
|
239 :custom-state 'unknown |
fca6909a92e8
* cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents:
67982
diff
changeset
|
240 :value symbol))) |
fca6909a92e8
* cus-theme.el (custom-theme-add-variable, custom-theme-add-face):
Chong Yidong <cyd@stupidchicken.com>
parents:
67982
diff
changeset
|
241 (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
|
242 (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
|
243 (widget-setup)))))) |
67982
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
244 |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
245 (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
|
246 `(("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
|
247 (lambda (widget) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
248 (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
|
249 (symbol (widget-value widget)) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
250 found) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
251 (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
|
252 (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
|
253 (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
|
254 (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
|
255 (setq found t))))))) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
256 ("---" ignore ignore) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
257 ("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
|
258 "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
|
259 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
|
260 |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
261 (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
|
262 "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
|
263 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
|
264 (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
|
265 (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
|
266 |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
267 (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
|
268 "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
|
269 (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
|
270 (symbol (widget-value widget)) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
271 found) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
272 (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
|
273 (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
|
274 (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
|
275 (setq found setting))) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
276 (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
|
277 (nth 3 found))) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
278 (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
|
279 (custom-redraw-magic widget) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
280 (widget-setup)) |
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-delete-face (widget) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
283 (setq custom-theme-faces |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
284 (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
|
285 (widget-delete widget)) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
286 |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
287 ;;; Reading and writing |
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 (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
|
290 (interactive) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
291 (when (or (null custom-theme-variables) |
72386
2ce9bf47e864
* cus-theme.el (customize-create-theme)
Romain Francoise <romain@orebokech.com>
parents:
68912
diff
changeset
|
292 (if (y-or-n-p "Discard current changes? ") |
67982
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
293 (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
|
294 (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
|
295 (unless (eq theme 'user) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
296 (widget-value-set custom-theme-name (symbol-name theme))) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
297 (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
|
298 (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
|
299 (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
|
300 (widget-setup)))) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
301 |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
302 (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
|
303 (interactive "SCustom theme name: ") |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
304 (unless (eq theme 'user) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
305 (load-theme theme)) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
306 (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
|
307 (dolist (setting settings) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
308 (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
|
309 (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
|
310 (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
|
311 (disable-theme theme) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
312 theme) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
313 |
48952 | 314 (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
|
315 (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
|
316 (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
|
317 custom-theme-directory)) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
318 (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
|
319 (vars custom-theme-variables) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
320 (faces custom-theme-faces)) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
321 (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
|
322 (string-equal name "user") |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
323 (string-equal name "changed")) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
324 (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
|
325 ((string-match " " name) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
326 (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
|
327 ((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
|
328 (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
|
329 (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
|
330 (error "Aborted"))) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
331 (with-temp-buffer |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
332 (emacs-lisp-mode) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
333 (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
|
334 (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
|
335 (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
|
336 (erase-buffer) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
337 (insert "(deftheme " name) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
338 (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
|
339 (insert ")\n") |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
340 (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
|
341 (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
|
342 (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
|
343 (save-buffer)) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
344 (dolist (var vars) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
345 (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
|
346 (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
|
347 (dolist (face faces) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
348 (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
|
349 (custom-redraw-magic (cdr face))))) |
48952 | 350 |
351 (defun custom-theme-write-variables (theme vars) | |
352 "Write a `custom-theme-set-variables' command for THEME. | |
353 It includes all variables in list VARS." | |
354 (when vars | |
355 (let ((standard-output (current-buffer))) | |
356 (princ "\n(custom-theme-set-variables\n") | |
357 (princ " '") | |
358 (princ theme) | |
359 (princ "\n") | |
67982
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
360 (mapc (lambda (spec) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
361 (let* ((symbol (car spec)) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
362 (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
|
363 (value (if child |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
364 (widget-value child) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
365 ;; 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
|
366 (get symbol 'standard-value)))) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
367 (when (boundp symbol) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
368 (unless (bolp) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
369 (princ "\n")) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
370 (princ " '(") |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
371 (prin1 symbol) |
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 (custom-quote value)) |
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 vars) |
48952 | 376 (if (bolp) |
377 (princ " ")) | |
378 (princ ")") | |
379 (unless (looking-at "\n") | |
380 (princ "\n"))))) | |
381 | |
382 (defun custom-theme-write-faces (theme faces) | |
383 "Write a `custom-theme-set-faces' command for THEME. | |
384 It includes all faces in list FACES." | |
385 (when faces | |
386 (let ((standard-output (current-buffer))) | |
387 (princ "\n(custom-theme-set-faces\n") | |
388 (princ " '") | |
389 (princ theme) | |
390 (princ "\n") | |
67982
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
391 (mapc (lambda (spec) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
392 (let* ((symbol (car spec)) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
393 (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
|
394 (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
|
395 (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
|
396 (unless (bolp) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
397 (princ "\n")) |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
398 (princ " '(") |
a711a44049e2
* cus-theme.el: Rewrite the Custom New Theme Mode interface.
Chong Yidong <cyd@stupidchicken.com>
parents:
67961
diff
changeset
|
399 (prin1 symbol) |
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 value) |
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 faces) |
48952 | 404 (if (bolp) |
405 (princ " ")) | |
406 (princ ")") | |
407 (unless (looking-at "\n") | |
408 (princ "\n"))))) | |
409 | |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
79721
diff
changeset
|
410 ;; arch-tag: cd6919bc-63af-410e-bae2-b6702e762344 |
48952 | 411 ;;; cus-theme.el ends here |