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

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

[nongnu] elpa-admin 8e351cc 425/439: * elpa-admin.el (elpaa--string-widt


From: Philip Kaludercic
Subject: [nongnu] elpa-admin 8e351cc 425/439: * elpa-admin.el (elpaa--string-width): Use `elpaa--call`
Date: Sun, 17 Oct 2021 15:48:50 -0400 (EDT)

branch: elpa-admin
commit 8e351cc4781cd232b5c2f723ef8f64b2663a75e1
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * elpa-admin.el (elpaa--string-width): Use `elpaa--call`
---
 elpa-admin.el | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/elpa-admin.el b/elpa-admin.el
index 38ace62..64e37dc 100644
--- a/elpa-admin.el
+++ b/elpa-admin.el
@@ -649,15 +649,14 @@ Return non-nil if a new tarball was created."
 
 (defun elpaa--string-width (str)
   "Determine string width in pixels of STR."
-  (let ((output (shell-command-to-string
-                 (format "convert -debug annotate xc: -font DejaVu-Sans\
-                         -pointsize 110 -annotate 0 %s null: 2>&1"
-                         (shell-quote-argument str)))))
-    (save-match-data
-      (if (string-match
-           "Metrics:.*?width: \\([0-9]+\\)"
-           output)
-          (string-to-number (match-string 1 output))
+  (with-temp-buffer
+    (elpaa--call (current-buffer)
+                 "convert" "-debug" "annotate" "xc:" "-font" "DejaVu-Sans"
+                 "-pointsize" "110" "-annotate" "0" str "null:")
+    (save-match-data ;;FIXME: Why?
+      (goto-char (point-min))
+      (if (re-search-forward "Metrics:.*?width: \\([0-9]+\\)")
+          (string-to-number (match-string 1))
         (error "Could not determine string width")))))
 
 (defun elpaa--make-badge (file left right)
@@ -676,6 +675,7 @@ Return non-nil if a new tarball was created."
                 (width . ,width)
                 (color . ,color)
                 (pad . ,pad))))
+    ;; FIXME: Use `svg.el'?
     (with-temp-buffer
       (insert
        (replace-regexp-in-string
@@ -821,10 +821,12 @@ place the resulting tarball into the file named 
ONE-TARBALL."
               (elpaa--release-email pkg-spec metadata dir)))))
 
         ;; Generate missing badges
+        ;; FIXME: Why here?
         (unless (and (not new) (file-exists-p devel-badge))
           (elpaa--make-badge devel-badge
                              (format "%s-devel ELPA" elpaa--name)
                              (format "%s %s" pkgname devel-vers)))
+        ;; FIXME: Shouldn't it be made already above?
         (unless (file-exists-p release-badge)
           (elpaa--make-badge release-badge
                              (format "%s ELPA" elpaa--name)



reply via email to

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