annotate lisp/cus-theme.el @ 67969:3ca8b2234237

* mh-customize.el: Sync docstrings with manual for faces and sort them alphabetically. (mh-faces): Move below mh-hooks. (mh-folder-faces, mh-index-faces, mh-letter-faces) (mh-show-faces, mh-speed-faces): Delete. Organize faces like hooks. (mh-speed-update-interval): Fix group (mh-speedbar, not mh-speed). (facemenu-unlisted-faces): Might as well ignore all MH-E faces. (mh-folder-body-face, mh-folder-cur-msg-face) (mh-folder-cur-msg-number-face, mh-folder-date-face) (mh-folder-followup-face, mh-folder-msg-number-face) (mh-folder-deleted-face, mh-folder-refiled-face) (mh-folder-subject-face, mh-folder-address-face) (mh-folder-scan-format-face, mh-folder-to-face) (mh-index-folder-face, mh-show-cc-face, mh-show-date-face) (mh-show-header-face, mh-show-pgg-good-face) (mh-show-pgg-unknown-face, mh-show-pgg-bad-face) (mh-show-to-face, mh-show-from-face, mh-show-subject-face): Delete. (mh-folder-cur-msg): Unused. Delete. (mh-folder-address): Use defface; inherit from mh-folder-subject. (mh-folder-body, mh-folder-cur-msg-number, mh-folder-date): Inherit from mh-folder-msg-number. (mh-folder-deleted): Use defface. Inherit from mh-folder-msg-number. (mh-folder-sent-to-me-hint): New face. Inherit from mh-folder-date. (mh-folder-sent-to-me-sender): Rename from mh-folder-scan-format. Use defface. Inherit from mh-folder-followup. (mh-show-xface): Inherit from mh-show-from and highlight. (bw-face-generation, bw-toggle-faces) (bw-new-face-to-old, bw-old-face-to-new): New (tempoarary) variables, functions for toggling between old and new faces. * mh-e.el (font-lock-auto-fontify, font-lock-defaults): Hide in eval-when-compile. We should probably do this throughout. (mh-scan-good-msg-regexp, mh-scan-deleted-msg-regexp) (mh-scan-refiled-msg-regexp, mh-scan-cur-msg-number-regexp) (mh-scan-date-regexp, mh-scan-rcpt-regexp, mh-scan-body-regexp) (mh-scan-subject-regexp): Sync docstrings with manual (mh-scan-format-regexp): Rename to mh-scan-sent-to-me-sender-regexp. Drop date parenthesized expression. Make expression more like the others (anchored at the beginning of line). Sync docstrings with manual. (mh-folder-font-lock-keywords): Use faces directly rather than -face variables. Use mh-scan-sent-to-me-sender-regexp instead of mh-scan-format-regexp, and within that expression, use faces mh-folder-sent-to-me-hint and mh-folder-sent-to-me-sender instead of mh-folder-date-face and mh-folder-scan-format-face which were misleading. * mh-mime.el (mh-mime-security-button-face): Use faces directly rather than -face variables. * mh-utils.el (mh-show-font-lock-keywords): Use faces directly rather than -face variables. (mh-face-foreground-compat, mh-face-background-compat): New macros. (mh-face-display-function): Use mh-face-foreground-compat and mh-face-background-compat to use inherited attributes of mh-show-xface on Emacs 22 while still working on Emacs 21.
author Bill Wohler <wohler@newt.com>
date Sun, 01 Jan 2006 18:51:18 +0000
parents 52f526ce11f6
children a711a44049e2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; cus-theme.el -- custom theme creation user interface
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2 ;;
64762
41bb365f41c4 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64091
diff changeset
3 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4 ;;
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Author: Alex Schroeder <alex@gnu.org>
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Maintainer: FSF
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; Keywords: help, faces
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; any later version.
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64091
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63956
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63956
diff changeset
24 ;; Boston, MA 02110-1301, USA.
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;;; Code:
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 (require 'widget)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 (require 'cus-edit)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 (eval-when-compile
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 (require 'wid-edit))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33
67950
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
34 (defvar custom-new-theme-mode-map
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
35 (let ((map (make-keymap)))
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
36 (set-keymap-parent map widget-keymap)
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
37 (suppress-keymap map)
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
38 (define-key map "n" 'widget-forward)
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
39 (define-key map "p" 'widget-backward)
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
40 (define-key map [mouse-1] 'widget-move-and-invoke)
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
41 map)
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
42 "Keymap for `custom-new-theme-mode'.")
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
43
63928
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
44 (define-derived-mode custom-new-theme-mode nil "New-Theme"
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
45 "Major mode for the buffer created by `customize-create-theme'.
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
46 Do not call this mode function yourself. It is only meant for internal
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
47 use by `customize-create-theme'."
67950
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
48 (use-local-map custom-new-theme-mode-map)
87b213a028b3 * cus-theme.el (custom-new-theme-mode-map): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67949
diff changeset
49 (define-key custom-new-theme-mode-map [mouse-1] 'widget-move-and-invoke)
67948
5bf588b1a01e * cus-theme.el (custom-new-theme-mode): Use cus-edit faces.
Chong Yidong <cyd@stupidchicken.com>
parents: 65341
diff changeset
50 (set (make-local-variable 'widget-documentation-face) 'custom-documentation)
5bf588b1a01e * cus-theme.el (custom-new-theme-mode): Use cus-edit faces.
Chong Yidong <cyd@stupidchicken.com>
parents: 65341
diff changeset
51 (set (make-local-variable 'widget-button-face) custom-button)
5bf588b1a01e * cus-theme.el (custom-new-theme-mode): Use cus-edit faces.
Chong Yidong <cyd@stupidchicken.com>
parents: 65341
diff changeset
52 (set (make-local-variable 'widget-button-pressed-face) custom-button-pressed)
67961
52f526ce11f6 * cus-edit.el (custom-button-mouse): New variable.
Chong Yidong <cyd@stupidchicken.com>
parents: 67951
diff changeset
53 (set (make-local-variable 'widget-mouse-face) custom-button-mouse)
67948
5bf588b1a01e * cus-theme.el (custom-new-theme-mode): Use cus-edit faces.
Chong Yidong <cyd@stupidchicken.com>
parents: 65341
diff changeset
54 (when custom-raised-buttons
5bf588b1a01e * cus-theme.el (custom-new-theme-mode): Use cus-edit faces.
Chong Yidong <cyd@stupidchicken.com>
parents: 65341
diff changeset
55 (set (make-local-variable 'widget-push-button-prefix) "")
5bf588b1a01e * cus-theme.el (custom-new-theme-mode): Use cus-edit faces.
Chong Yidong <cyd@stupidchicken.com>
parents: 65341
diff changeset
56 (set (make-local-variable 'widget-push-button-suffix) "")
5bf588b1a01e * cus-theme.el (custom-new-theme-mode): Use cus-edit faces.
Chong Yidong <cyd@stupidchicken.com>
parents: 65341
diff changeset
57 (set (make-local-variable 'widget-link-prefix) "")
5bf588b1a01e * cus-theme.el (custom-new-theme-mode): Use cus-edit faces.
Chong Yidong <cyd@stupidchicken.com>
parents: 65341
diff changeset
58 (set (make-local-variable 'widget-link-suffix) "")))
63928
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
59 (put 'custom-new-theme-mode 'mode-class 'special)
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
60
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
61 (defvar custom-theme-name)
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
62 (defvar custom-theme-variables)
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
63 (defvar custom-theme-faces)
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
64 (defvar custom-theme-description)
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
65
50203
3803afb52e4f (custom-theme-create): Add autoload cookie.
John Paul Wallington <jpw@pobox.com>
parents: 49588
diff changeset
66 ;;;###autoload
50287
51b6a93f7e19 (customize-create-theme): Rename from
John Paul Wallington <jpw@pobox.com>
parents: 50203
diff changeset
67 (defun customize-create-theme ()
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 "Create a custom theme."
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 (interactive)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 (if (get-buffer "*New Custom Theme*")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 (kill-buffer "*New Custom Theme*"))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 (switch-to-buffer "*New Custom Theme*")
63928
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
73 (let ((inhibit-read-only t))
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
74 (erase-buffer))
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
75 (custom-new-theme-mode)
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 (make-local-variable 'custom-theme-name)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 (make-local-variable 'custom-theme-variables)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 (make-local-variable 'custom-theme-faces)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 (make-local-variable 'custom-theme-description)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 (widget-insert "This buffer helps you write a custom theme elisp file.
63928
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
81 This will help you share your customizations with other people.
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
82
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
83 Just insert the names of all variables and faces you want the theme
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
84 to include. Then clicking mouse-2 or pressing RET on the [Done] button
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
85 will write a theme file that sets all these variables and faces to their
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
86 current global values. It will write that file into the directory given
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
87 by the variable `custom-theme-directory', usually \"~/.emacs.d/\".
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
88
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
89 To undo all your edits to the buffer, use the [Reset] button.\n\n")
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 (widget-insert "Theme name: ")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 (setq custom-theme-name
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 (widget-create 'editable-field
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 :size 10
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 user-login-name))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 (widget-insert "\n\nDocumentation:\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 (setq custom-theme-description
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48952
diff changeset
97 (widget-create 'text
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 :value (format-time-string "Created %Y-%m-%d.")))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 (widget-insert "\nVariables:\n\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 (setq custom-theme-variables
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 (widget-create 'editable-list
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 :entry-format "%i %d %v"
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 'variable))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 (widget-insert "\nFaces:\n\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 (setq custom-theme-faces
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 (widget-create 'editable-list
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 :entry-format "%i %d %v"
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 'face))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 (widget-insert "\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 (widget-create 'push-button
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 :notify (function custom-theme-write)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 "Done")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 (widget-insert " ")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 (widget-create 'push-button
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 :notify (lambda (&rest ignore)
51745
11d27dde6451 (customize-create-theme): Call `customize-create-theme' in
John Paul Wallington <jpw@pobox.com>
parents: 50287
diff changeset
116 (customize-create-theme))
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 "Reset")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 (widget-insert " ")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 (widget-create 'push-button
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 :notify (lambda (&rest ignore)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 (bury-buffer))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 "Bury Buffer")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 (widget-insert "\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 (widget-setup))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 (defun custom-theme-write (&rest ignore)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 (let ((name (widget-value custom-theme-name))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 (doc (widget-value custom-theme-description))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 (variables (widget-value custom-theme-variables))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 (faces (widget-value custom-theme-faces)))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 (switch-to-buffer (concat name "-theme.el"))
63928
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
132 (emacs-lisp-mode)
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
133 (unless (file-exists-p custom-theme-directory)
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
134 (make-directory (file-name-as-directory custom-theme-directory) t))
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
135 (setq default-directory custom-theme-directory)
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 (setq buffer-file-name (expand-file-name (concat name "-theme.el")))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 (let ((inhibit-read-only t))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 (erase-buffer))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 (insert "(deftheme " name)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 (when doc
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 (newline)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 (insert " \"" doc "\""))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 (insert ")\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 (custom-theme-write-variables name variables)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 (custom-theme-write-faces name faces)
63928
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
146 (insert "\n(provide-theme '" name ")\n")
e559c2c766bc (custom-new-theme-mode): New function.
Luc Teirlinck <teirllm@auburn.edu>
parents: 61603
diff changeset
147 (save-buffer)))
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 (defun custom-theme-write-variables (theme vars)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 "Write a `custom-theme-set-variables' command for THEME.
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 It includes all variables in list VARS."
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 ;; Most code is stolen from `custom-save-variables'.
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 (when vars
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 (let ((standard-output (current-buffer)))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 (princ "\n(custom-theme-set-variables\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 (princ " '")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 (princ theme)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 (princ "\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 (mapc (lambda (symbol)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 (when (boundp symbol)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 (unless (bolp)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 (princ "\n"))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 (princ " '(")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 (prin1 symbol)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 (princ " ")
61603
dbec9d2e3f52 (custom-theme-write-variables): Quote variables
David Kastrup <dak@gnu.org>
parents: 52401
diff changeset
166 (prin1 (custom-quote (symbol-value symbol)))
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 (princ ")")))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 vars)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 (if (bolp)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170 (princ " "))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 (princ ")")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 (unless (looking-at "\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 (princ "\n")))))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 (defun custom-theme-write-faces (theme faces)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 "Write a `custom-theme-set-faces' command for THEME.
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177 It includes all faces in list FACES."
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 (when faces
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 (let ((standard-output (current-buffer)))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 (princ "\n(custom-theme-set-faces\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 (princ " '")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 (princ theme)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 (princ "\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 (mapc (lambda (symbol)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 (when (facep symbol)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 (unless (bolp)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 (princ "\n"))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 (princ " '(")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 (prin1 symbol)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 (princ " ")
65341
6990826a916f Custom Theme bugfixes.
Chong Yidong <cyd@stupidchicken.com>
parents: 64762
diff changeset
191 (prin1 (list (append '(t)
6990826a916f Custom Theme bugfixes.
Chong Yidong <cyd@stupidchicken.com>
parents: 64762
diff changeset
192 (custom-face-attributes-get
6990826a916f Custom Theme bugfixes.
Chong Yidong <cyd@stupidchicken.com>
parents: 64762
diff changeset
193 'font-lock-comment-face nil))))
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 (princ ")")))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 faces)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 (if (bolp)
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 (princ " "))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 (princ ")")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 (unless (looking-at "\n")
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 (princ "\n")))))
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 51745
diff changeset
202 ;;; arch-tag: cd6919bc-63af-410e-bae2-b6702e762344
48952
ac7ebc63415a New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 ;;; cus-theme.el ends here