emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/autothemer 8f72afc6db 1/2: Fix actions / 0.2.18


From: ELPA Syncer
Subject: [nongnu] elpa/autothemer 8f72afc6db 1/2: Fix actions / 0.2.18
Date: Fri, 14 Apr 2023 11:14:28 -0400 (EDT)

branch: elpa/autothemer
commit 8f72afc6dba5ad7cc3a201a084fd20571f945d2e
Author: Jason Milkins <jasonm23@gmail.com>
Commit: Jason Milkins <jasonm23@gmail.com>

    Fix actions / 0.2.18
---
 .github/workflows/test.yml |  2 +-
 README.md                  |  1 +
 autothemer.el              | 80 ++++++++++++++++++++++++++++++++++++----------
 tests/autothemer-tests.el  |  2 +-
 4 files changed, 67 insertions(+), 18 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 6a2f8ec3a2..4e88f024c3 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -23,7 +23,7 @@ jobs:
     steps:
     - uses: actions/checkout@v3
     - name: Set up Emacs
-      uses: purcell/setup-emacs@v3.0
+      uses: purcell/setup-emacs@v4.0
       with:
         version: ${{ matrix.emacs_version }}
 
diff --git a/README.md b/README.md
index 626a7973d7..26202a5779 100644
--- a/README.md
+++ b/README.md
@@ -584,6 +584,7 @@ Make sure you eval all the theme's elisp files before 
enabling the theme.)
 - [emacsfodder/Orangey 
Bits](https://github.com/emacsfodder/emacs-theme-orangey-bits)
 - 
[emacsfodder/Cyanometric](https://github.com/emacsfodder/emacs-theme-cyanometric)
 - 
[emacsfodder/Vegetative](https://github.com/emacsfodder/emacs-theme-vegetative)
+- 
[Patrick-Poitras/emacs-material-ocean](https://github.com/Patrick-Poitras/emacs-material-ocean)
 
 If you are creating themes with Autothemer, please let us know, you can add the
 theme info to README and open a pull request. If you haven't released it as a
diff --git a/autothemer.el b/autothemer.el
index 8d2def7121..b76018b6eb 100644
--- a/autothemer.el
+++ b/autothemer.el
@@ -7,7 +7,7 @@
 ;; Maintainer: Jason Milkins <jasonm23@gmail.com>
 ;;
 ;; URL: https://github.com/jasonm23/autothemer
-;; Version: 0.2.14
+;; Version: 0.2.18
 ;; Package-Requires: ((dash "2.10.0") (emacs "26.1"))
 ;;
 ;;; License:
@@ -34,6 +34,8 @@
 ;; - Generate specs for unthemed faces using the theme color palette.
 ;;   - `autothemer-generate-templates'
 ;;   - `autothemer-generate-templates-filtered' (filter by regexp)
+;;   - `autothemer-insert-missing-face'
+;;   - `autothemer-insert-missing-faces'
 ;; - Generate a palette SVG image
 ;;   - `autothemer-generate-palette-svg'
 ;; - Insert a color name or color from the active palette
@@ -62,9 +64,7 @@
   description)
 
 (defvar autothemer-current-theme nil
-  "Internal variable of type `autothemer--theme' used by autothemer.
-Contains the color palette and the list of faces most recently
-customized using `autothemer-deftheme'.")
+  "Palette and face list for last evaluated `autothemer-deftheme'.")
 
 (defvar autothemer-hue-groups
   '((red             (345 . 10))
@@ -364,6 +364,50 @@ Will become:
   (cl-loop for row in (cdr palette)
            collect (list (car row) (elt row (1+ n)))))
 
+;;;###autoload
+(defun autothemer-insert-missing-face ()
+  "Insert a face spec template for an unthemed face.
+An approximate color from the palette will be used for
+color attributes."
+  (interactive)
+  (let ((selected (completing-read "Select an un-themed face: " 
(autothemer--unthemed-faces))))
+    (insert
+     (replace-regexp-in-string "\n" ""
+      (pp-to-string
+       (autothemer--approximate-spec
+        (autothemer--alist-to-reduced-spec (intern selected) 
(autothemer--face-to-alist (intern selected)))
+        autothemer-current-theme))))))
+
+;;;###autoload
+(defun autothemer-insert-missing-faces (&optional regexp)
+  "Insert face spec templates for unthemed faces matching REGEXP.
+An error is shown when no current theme is available."
+  (interactive)
+  (autothemer--current-theme-guard)
+  (let* ((regexp (or regexp
+                     (completing-read
+                      "(Match un-themed face set) Regexp: "
+                      (autothemer--unthemed-faces))))
+         (missing-faces
+          (if (null regexp)
+              (autothemer--unthemed-faces)
+            (--filter
+             (string-match-p regexp (symbol-name it))
+             (autothemer--unthemed-faces))))
+         (templates (--reduce
+                     (format "%s%s" acc it)
+                     (--map
+                      (format "%s\n"
+                              (replace-regexp-in-string
+                               "\n" ""
+                               (pp-to-string
+                                (autothemer--approximate-spec
+                                 (autothemer--alist-to-reduced-spec
+                                  it (autothemer--face-to-alist it))
+                                 autothemer-current-theme))))
+                      missing-faces))))
+    (insert templates)))
+
 ;;;###autoload
 (defun autothemer-generate-templates-filtered (regexp)
   "Autogenerate customizations for unthemed faces matching REGEXP.
@@ -410,18 +454,6 @@ Otherwise, append NEW-COLUMN to every element of LISTS."
   (if lists (inline (-zip-with #'append lists new-column))
     new-column))
 
-(defun autothemer-insert-missing-face ()
-  "Insert a face spec template for an unthemed face.
-An approximate color from the palette will be used for
-color attributes."
-  (interactive)
-  (let ((selected (completing-read "Select an un-themed face: " 
(autothemer--unthemed-faces))))
-    (insert
-     (pp
-      (autothemer--approximate-spec
-       (autothemer--alist-to-reduced-spec (intern selected) 
(autothemer--face-to-alist (intern selected)))
-       autothemer-current-theme)))))
-
 (defun autothemer--current-theme-guard ()
   "Guard functions from executing when there's no current theme."
   (unless autothemer-current-theme
@@ -1054,5 +1086,21 @@ Swatch Template parameters:
                      svg-swatches)))
       (message "%s generated." svg-out-file)))))
 
+(defun autothemer--locate-source ()
+  "Return the absolute file path of autothemer source.
+
+Return nil if not found."
+  (let* ((lib-file-name "autothemer.el")
+         (located-file (file-truename (locate-library "autothemer")))
+         (is-byte-compiled (string= "elc" (file-name-extension located-file)))
+         (el-name (format "%s.el" (file-name-sans-extension located-file)))
+         (located-el (file-truename (if (and is-byte-compiled (file-exists-p 
el-name))
+                                        el-name
+                                      located-file)))
+         (located-folder (file-name-directory located-el)))
+    (if (file-directory-p located-folder)
+        located-folder
+      nil)))
+
 (provide 'autothemer)
 ;;; autothemer.el ends here
diff --git a/tests/autothemer-tests.el b/tests/autothemer-tests.el
index 390e589979..5fe9f6bd13 100644
--- a/tests/autothemer-tests.el
+++ b/tests/autothemer-tests.el
@@ -1,6 +1,6 @@
 ;; autothemer-tests.el
 
-;; Version: 0.2.14
+;; Version: 0.2.18
 
 ;;; Code:
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]