From addd445155786fb3fc6ebf04adadecf74a353eea Mon Sep 17 00:00:00 2001 From: Greg Pfeil Date: Tue, 7 Feb 2023 11:26:04 -0700 Subject: [PATCH] Eliminate create-solarized-theme macro This was a remnant from having separate solarized-dark and -light themes. We only ever produce one theme now, so use the usual theme definition mechanism. --- solarized-definitions.el | 24 ------------------------ solarized-theme.el | 25 +++++++++++++++++++++---- 2 files changed, 21 insertions(+), 28 deletions(-) diff --git a/solarized-definitions.el b/solarized-definitions.el index dcd9a0e..cee5e5d 100644 --- a/solarized-definitions.el +++ b/solarized-definitions.el @@ -823,29 +823,5 @@ contains Solarized symbols." ;; haskell (haskell-keyword-face (,@fg-cyan))))))) -;;;###autoload -(when (boundp 'custom-theme-load-path) - (add-to-list 'custom-theme-load-path - (file-name-as-directory (file-name-directory load-file-name)))) - -(defmacro create-solarized-theme (name description color-definitions) - "Define the theme from the provided pieces. -NAME is a bare symbol, DESCRIPTION is the text that will be presented to users, -and COLOR-DEFINITIONS is the list of face-specs that comprise the theme." - `(let ((name ,name) - (description ,description) - (color-definitions ,color-definitions)) - (custom-declare-theme name (custom-make-theme-feature name) description) - (apply #'custom-theme-set-faces name color-definitions) - (custom-theme-set-variables - name - ;; This is obsolete, but something might still be referencing it. - '(ansi-color-names-vector - ,(apply #'vector - (mapcar (lambda (color-name) - (nth 1 (assoc color-name solarized-colors))) - '(base02 red green yellow blue magenta cyan base2))))) - (provide-theme name))) - (provide 'solarized-definitions) ;;; solarized-definitions.el ends here diff --git a/solarized-theme.el b/solarized-theme.el index 2eebb6e..ce77f65 100644 --- a/solarized-theme.el +++ b/solarized-theme.el @@ -1,12 +1,21 @@ -;; -*- lexical-binding: t; -*- +;; solarized-theme.el --- Solarized custom theme -*- lexical-binding: t; -*- (require 'solarized-definitions (locate-file "solarized-definitions.el" custom-theme-load-path '("c" ""))) -(create-solarized-theme 'solarized - solarized-description - (solarized-color-definitions)) +(deftheme solarized solarized-description) + +(apply #'custom-theme-set-faces 'solarized (solarized-color-definitions)) + +(custom-theme-set-variables + 'solarized + ;; This is obsolete, but something might still be referencing it. + `(ansi-color-names-vector + ,(apply #'vector + (mapcar (lambda (color-name) + (nth 1 (assoc color-name solarized-colors))) + '(base02 red green yellow blue magenta cyan base2))))) (cl-defun solarized-update-background-mode (appearance &optional (frames (frame-list))) @@ -31,3 +40,11 @@ that observes the background characteristic." ('dark 'light) (_ 'dark)))) (solarized-update-background-mode new-mode))) + +;;;###autoload +(when load-file-name + (add-to-list 'custom-theme-load-path + (file-name-as-directory (file-name-directory load-file-name)))) + +(provide-theme 'solarized) +;;; solarized-theme.el ends here