;;; cus-theme.el -- custom theme creation user interface
;;
-;; Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2002, 2003, 2004, 2005,
+;; 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
;;
;; Author: Alex Schroeder <alex@gnu.org>
;; Maintainer: FSF
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Code:
(suppress-keymap map)
(define-key map "n" 'widget-forward)
(define-key map "p" 'widget-backward)
- (define-key map [mouse-1] 'widget-move-and-invoke)
map)
"Keymap for `custom-new-theme-mode'.")
(widget-insert " ")
(widget-create 'push-button
:notify (lambda (&rest ignore)
- (when (y-or-n-p "Discard current changes?")
+ (when (y-or-n-p "Discard current changes? ")
(kill-buffer (current-buffer))
(customize-create-theme)))
"Reset Buffer")
(widget-insert "\n")
(widget-create 'push-button
:notify (lambda (&rest ignore)
- (when (y-or-n-p "Discard current changes?")
+ (when (y-or-n-p "Discard current changes? ")
(kill-buffer (current-buffer))
(customize-create-theme)))
"Reset Buffer")
(defun custom-theme-add-variable (symbol)
(interactive "vVariable name: ")
- (save-excursion
- (goto-char custom-theme-insert-variable-marker)
- (if (assq symbol custom-theme-variables)
- (message "%s is already in the theme" (symbol-name symbol))
- (widget-insert "\n")
- (let ((widget (widget-create 'custom-variable
- :tag (custom-unlispify-tag-name symbol)
- :custom-level 0
- :action 'custom-theme-variable-action
- :custom-state 'unknown
- :value symbol)))
- (push (cons symbol widget) custom-theme-variables)
- (custom-magic-reset widget))
- (widget-setup))))
+ (cond ((assq symbol custom-theme-variables)
+ (message "%s is already in the theme" (symbol-name symbol)))
+ ((not (boundp symbol))
+ (message "%s is not defined as a variable" (symbol-name symbol)))
+ ((eq symbol 'custom-enabled-themes)
+ (message "Custom theme cannot contain `custom-enabled-themes'"))
+ (t
+ (save-excursion
+ (goto-char custom-theme-insert-variable-marker)
+ (widget-insert "\n")
+ (let ((widget (widget-create 'custom-variable
+ :tag (custom-unlispify-tag-name symbol)
+ :custom-level 0
+ :action 'custom-theme-variable-action
+ :custom-state 'unknown
+ :value symbol)))
+ (push (cons symbol widget) custom-theme-variables)
+ (custom-magic-reset widget))
+ (widget-setup)))))
(defvar custom-theme-variable-menu
`(("Reset to Current" custom-redraw
(defun custom-theme-add-face (symbol)
(interactive (list (read-face-name "Face name" nil nil)))
- (save-excursion
- (goto-char custom-theme-insert-face-marker)
- (if (assq symbol custom-theme-faces)
- (message "%s is already in the theme" (symbol-name symbol))
- (widget-insert "\n")
- (let ((widget (widget-create 'custom-face
- :tag (custom-unlispify-tag-name symbol)
- :custom-level 0
- :action 'custom-theme-face-action
- :custom-state 'unknown
- :value symbol)))
- (push (cons symbol widget) custom-theme-faces)
- (custom-magic-reset widget)
- (widget-setup)))))
+ (cond ((assq symbol custom-theme-faces)
+ (message "%s is already in the theme" (symbol-name symbol)))
+ ((not (facep symbol))
+ (message "%s is not defined as a face" (symbol-name symbol)))
+ (t
+ (save-excursion
+ (goto-char custom-theme-insert-face-marker)
+ (widget-insert "\n")
+ (let ((widget (widget-create 'custom-face
+ :tag (custom-unlispify-tag-name symbol)
+ :custom-level 0
+ :action 'custom-theme-face-action
+ :custom-state 'unknown
+ :value symbol)))
+ (push (cons symbol widget) custom-theme-faces)
+ (custom-magic-reset widget)
+ (widget-setup))))))
(defvar custom-theme-face-menu
`(("Reset to Theme Value" custom-face-reset-theme
(defun custom-theme-visit-theme ()
(interactive)
(when (or (null custom-theme-variables)
- (if (y-or-n-p "Discard current changes?")
+ (if (y-or-n-p "Discard current changes? ")
(progn (customize-create-theme) t)))
(let ((theme (call-interactively 'custom-theme-merge-theme)))
(unless (eq theme 'user)
(unless (looking-at "\n")
(princ "\n")))))
-;;; arch-tag: cd6919bc-63af-410e-bae2-b6702e762344
+;; arch-tag: cd6919bc-63af-410e-bae2-b6702e762344
;;; cus-theme.el ends here