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

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

[elpa] externals/kind-icon ee51d05c09 1/2: kind-icon-preview-all command


From: ELPA Syncer
Subject: [elpa] externals/kind-icon ee51d05c09 1/2: kind-icon-preview-all command
Date: Tue, 10 May 2022 13:57:38 -0400 (EDT)

branch: externals/kind-icon
commit ee51d05c09cfa9096abb9145313a604b89868b43
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>

    kind-icon-preview-all command
---
 README.md    |  4 ++++
 kind-icon.el | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/README.md b/README.md
index 8eb6d64af3..39a8c97e9b 100644
--- a/README.md
+++ b/README.md
@@ -102,6 +102,10 @@ And yes, you can use **any icons**!
 
 You can also use simple text-based prefixes instead of icons.  The icons are 
quite lightweight so there shouldn't be much performance difference, but some 
may prefer a simpler look.  A "text" icon is composed of either one or two 
characters (anything longer will be trimmed).  Simply set the 
`kind-icon-use-icons` variable to `nil` and (if desired) customize the 
"Short-Text" in the mapping.  Note that if you are not connected to the 
network, even if you have enabled icons, any icons which  [...]
 
+### Previewing
+
+Use `M-x kind-icon-preview-all` to reset and preview all icons (text and SVG 
icons both) in a view buffer.  This also has the effect of pre-downloading all 
icons, courtesy svg-lib.
+
 ### Debugging Tips
 
 If you get an error mentioning `corfu--post-command`, and notice that you 
don't get a backtrace even after invoking `toggle-debug-on-error`, this is 
because backtraces are inhibited during post-command hooks.  To re-enable them, 
evaluate the following (e.g. in your `*scratch*` buffer):
diff --git a/kind-icon.el b/kind-icon.el
index c8f7a15ba2..8af0a99818 100644
--- a/kind-icon.el
+++ b/kind-icon.el
@@ -218,6 +218,27 @@ float FRAC."
 (defconst kind-icon--unknown
   (propertize "???" 'face '(:weight bold :background "red")))
 
+(defun kind-icon-preview-all ()
+  "Preview all kind icons.
+In the process, svg-lib also downloads and caches them."
+  (interactive)
+  (with-current-buffer (get-buffer-create "*kind-icon-preview*")
+    (font-lock-mode 0)
+    (view-buffer-other-window (current-buffer))
+    (let ((inhibit-read-only t))
+      (erase-buffer)
+      (insert "kind-icon badges\n\ntxt icn\tkind\n")
+      (mapc (lambda (k)
+             (apply 'insert
+                    `(,(mapconcat
+                        (lambda (v)
+                          (kind-icon-reset-cache)
+                          (let ((kind-icon-use-icons v))
+                            (kind-icon-formatted k)))
+                        '(nil t) " ")
+                      "\t" ,(symbol-name k) "\n")))
+           (mapcar 'car kind-icon-mapping)))))
+
 (defun kind-icon-formatted (kind)
   "Return a formatted kind badge, either icon or text abbreviation.
 Caches this badge in `kind-icon--cache', and returns the cached



reply via email to

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