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

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

[elpa] externals/svg-lib 212cc8c8b7 3/3: Merge pull request #13 from aru


From: ELPA Syncer
Subject: [elpa] externals/svg-lib 212cc8c8b7 3/3: Merge pull request #13 from aru-hackZ/patch-2
Date: Thu, 3 Mar 2022 09:57:57 -0500 (EST)

branch: externals/svg-lib
commit 212cc8c8b762afd60b8f2f27411417c771f2bc44
Merge: 0486c94534 304a9e4fcd
Author: Nicolas P. Rougier <Nicolas.Rougier@inria.fr>
Commit: GitHub <noreply@github.com>

    Merge pull request #13 from aru-hackZ/patch-2
    
    [refactor] Use `when` and `unless` instead of `if` when possible
---
 svg-lib.el | 37 ++++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/svg-lib.el b/svg-lib.el
index 8002a09f78..7d19d7a4a8 100644
--- a/svg-lib.el
+++ b/svg-lib.el
@@ -99,7 +99,6 @@
      (error "svg-lib.el requires Emacs to be compiled with svg support.\n"))
   (apply #'svg-image args))
 
-
 (defgroup svg-lib nil
   "SVG tags, bars & icons."
   :group 'convenience
@@ -253,7 +252,7 @@ and style elements ARGS."
          (txt-char-height (window-font-height))
          (txt-char-height (if line-spacing
                               (+ txt-char-height line-spacing)
-                          txt-char-height))
+                            txt-char-height))
          (font-info       (font-info (format "%s-%d" font-family font-size)))
          (font-size       (aref font-info 2)) ;; redefine font-size
          (ascent          (aref font-info 8))
@@ -277,9 +276,9 @@ and style elements ARGS."
          
          (svg (svg-create svg-width svg-height)))
 
-    (if (>= stroke 0.25)
-        (svg-rectangle svg tag-x 0 tag-width tag-height
-                           :fill foreground :rx radius))
+    (when (>= stroke 0.25)
+      (svg-rectangle svg tag-x 0 tag-width tag-height
+                     :fill foreground :rx radius))
     (svg-rectangle svg (+ tag-x (/ stroke 2.0)) (/ stroke 2.0)
                        (- tag-width stroke) (- tag-height stroke)
                        :fill background :rx (- radius (/ stroke 2.0)))
@@ -340,11 +339,11 @@ and style elements ARGS."
          (x1              (+ cx (* iradius (cos angle1))))
          (y1              (+ cy (* iradius (sin angle1))))
 
-         (large-arc       (if (>= (- angle1 angle0) pi) t nil))
+         (large-arc       (>= (- angle1 angle0) pi))
          (svg (svg-create svg-width svg-height)))
 
-    (if (>= stroke 0.25)
-        (svg-circle svg cx cy radius :fill foreground))
+    (when (>= stroke 0.25)
+      (svg-circle svg cx cy radius :fill foreground))
 
     (svg-circle svg cx cy (- radius (/ stroke 2.0)) :fill background)
 
@@ -398,9 +397,9 @@ and style elements ARGS."
          (tag-x (/ (- svg-width tag-width) 2))
          (svg (svg-create svg-width svg-height)))
 
-    (if (>= stroke 0.25)
-        (svg-rectangle svg tag-x 0 tag-width tag-height
-                       :fill foreground :rx radius))
+    (when (>= stroke 0.25)
+      (svg-rectangle svg tag-x 0 tag-width tag-height
+                     :fill foreground :rx radius))
     (svg-rectangle svg (+ tag-x (/ stroke 2.0))
                        (/ stroke 2.0)
                        (- tag-width stroke)
@@ -493,9 +492,9 @@ given STYLE and style elements ARGS."
 
          (svg (svg-create svg-width svg-height)))
 
-    (if (>= stroke 0.25)
-        (svg-rectangle svg box-x box-y box-width box-height
-                       :fill foreground :rx radius))
+    (when (>= stroke 0.25)
+      (svg-rectangle svg box-x box-y box-width box-height
+                     :fill foreground :rx radius))
     (svg-rectangle svg (+ box-x (/ stroke 2.0))
                        (+ box-y (/ stroke 2.0))
                        (- box-width stroke)
@@ -578,9 +577,9 @@ and style elements ARGS."
                   (- (/ svg-height 2 scale) (/ icon-height 2))))
          (svg (svg-create svg-width svg-height)))
 
-    (if (>= stroke 0.25)
-        (svg-rectangle svg tag-x 0 tag-width tag-height
-                           :fill foreground :rx radius))
+    (when (>= stroke 0.25)
+      (svg-rectangle svg tag-x 0 tag-width tag-height
+                     :fill foreground :rx radius))
     (svg-rectangle svg (+ tag-x (/ stroke 2.0)) (/ stroke 2.0)
                        (- tag-width stroke) (- tag-height stroke)
                        :fill background :rx (- radius (/ stroke 2.0)))
@@ -629,8 +628,8 @@ and style elements ARGS."
      (dom-append-child svg child))
 
    (dolist (child children-2)
-     (if (not (stringp child))
-         (dom-set-attribute child 'transform transform))
+     (unless (stringp child)
+       (dom-set-attribute child 'transform transform))
      (dom-append-child svg child))
    svg))
 



reply via email to

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