[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/svg-lib d1f1a51b7c 4/5: Merge pull request #41 from tar
From: |
ELPA Syncer |
Subject: |
[elpa] externals/svg-lib d1f1a51b7c 4/5: Merge pull request #41 from tarsiiformes/silencio |
Date: |
Mon, 8 Jan 2024 06:58:49 -0500 (EST) |
branch: externals/svg-lib
commit d1f1a51b7c32fea513316a7e4898bb4fdb302cde
Merge: 913d86b0ec 555f43a5b0
Author: Nicolas P. Rougier <Nicolas.Rougier@inria.fr>
Commit: GitHub <noreply@github.com>
Merge pull request #41 from tarsiiformes/silencio
Address new unused variable warning
---
svg-lib-demo.el | 2 +-
svg-lib.el | 58 +++++++++++++++++++++++++++------------------------------
2 files changed, 28 insertions(+), 32 deletions(-)
diff --git a/svg-lib-demo.el b/svg-lib-demo.el
index f611f41766..588c46b278 100644
--- a/svg-lib-demo.el
+++ b/svg-lib-demo.el
@@ -18,7 +18,7 @@
;;; Commentary:
;;
;; This file demonstrates some usage examples of the svg-lib package.
-:; Each line should insert some svg objets into the current buffer.
+:; Each line should insert some svg objects into the current buffer.
(require 'svg-lib)
diff --git a/svg-lib.el b/svg-lib.el
index f5e823716e..5d52c84212 100644
--- a/svg-lib.el
+++ b/svg-lib.el
@@ -95,7 +95,7 @@
;; - Better error handling if SVG support is missing
;; Version 0.2.2
-;; - Added a left/righ crop style argument to allow for tags collage.
+;; - Added a left/right crop style argument to allow for tags collage.
;; Version 0.2.1
;; - Added an alignment parameter for moving tags inside margins.
@@ -168,7 +168,7 @@
"https://boxicons.com/static/img/svg/regular/bx-%s.svg")
("vscode" .
"https://raw.githubusercontent.com/microsoft/vscode-icons/main/icons/light/%s.svg"))
-
+
"Various icons collections stored as (name . base-url).
The name of the collection is used as a pointer for the various
@@ -214,10 +214,10 @@ to the default face)."
:scale 0.75 ;; Icon scaling
:ascent center ;; Position / baseline
:crop-left nil ;; Whether to crop on left (for collage with other
tags)
- :crop-right nil ;; Whether to crop on righ (for collage with other
tags)
+ :crop-right nil ;; Whether to crop on right (for collage with
other tags)
:collection "material" ;; Icon collection
-
+
:font-family ,font-family
:font-size ,font-size
:font-weight ,font-weight)))
@@ -264,12 +264,12 @@ If COLOR-NAME is unknown to Emacs, then return COLOR-NAME
as-is."
(let ((rgb-color (color-name-to-rgb color-name)))
(if rgb-color
(apply #'color-rgb-to-hex (append rgb-color '(2)))
- color-name))))
+ color-name))))
;; SVG Library style build from partial specification
(defun svg-lib-style (&optional base &rest args)
"Build a news style using BASE and style elements ARGS."
-
+
(let* ((default svg-lib-style-default)
(base (or base default))
(keys (cl-loop for (key _value) on default by 'cddr
@@ -352,7 +352,7 @@ and additional style elements ARGS."
(defun svg-lib-text-tag (label &optional face-or-style &rest args)
"Create an image displaying LABEL in a rounded box using given FACE-OR-STYLE
and additional style elements ARGS."
-
+
(let* ((style (cond ((facep face-or-style)
(apply #'svg-lib-style-from-face face-or-style args))
(face-or-style
@@ -394,7 +394,7 @@ and additional style elements ARGS."
(text-x (if crop-left (- text-x (/ stroke 2)) text-x))
(tag-width (if crop-right (+ tag-width txt-char-width) tag-width))
(text-x (if crop-right (+ text-x (/ stroke 2)) text-x))
-
+
(svg (svg-create svg-width svg-height)))
(when (>= stroke 0.25)
@@ -486,7 +486,7 @@ and additional style elements ARGS."
(tag-height (* txt-char-height height))
(svg-width (+ tag-width (* margin txt-char-width)))
(svg-height tag-height)
- (svg-ascent (plist-get style :ascent))
+ (svg-ascent (plist-get style :ascent))
(tag-x (/ (- svg-width tag-width) 2))
(svg (svg-create svg-width svg-height)))
@@ -503,7 +503,7 @@ and additional style elements ARGS."
(- (* value tag-width) stroke (* 2 padding))
(- tag-height stroke (* 2 padding))
:fill foreground :rx (- radius (/ stroke 2.0)))
-
+
(svg-lib--image svg :ascent svg-ascent)))
;; Create a rounded box icon
@@ -551,7 +551,7 @@ given FACE-OR-STYLE and additional style elements ARGS."
(scale (plist-get style :scale))
(margin (plist-get style :margin))
(padding (plist-get style :padding))
- (width (+ 2 padding))
+ (width (+ 2 padding))
(txt-char-width (window-font-width))
(txt-char-height (window-font-height))
(box-width (* width txt-char-width))
@@ -587,7 +587,7 @@ given FACE-OR-STYLE and additional style elements ARGS."
(- box-width stroke)
(- box-height stroke)
:fill background :rx (- radius (/ stroke 2.0))))
-
+
(dolist (item (xml-get-children (car root) 'path))
(let* ((attrs (xml-node-attributes item))
(path (cdr (assoc 'd attrs)))
@@ -612,7 +612,7 @@ and additional style elements ARGS."
(t
(apply #'svg-lib-style svg-lib-style-default args))))
(collection (plist-get style :collection))
- (root (svg-lib--icon-get-data collection icon))
+ (root (svg-lib--icon-get-data collection icon))
(foreground (plist-get style :foreground))
(background (plist-get style :background))
(stroke (plist-get style :stroke))
@@ -702,7 +702,7 @@ FACE-OR-STYLE and additional style elements ARGS."
(day (format-time-string "%d" date)))
(apply 'svg-lib-box weekday day face-or-style args)))
-
+
(defun svg-lib-box (top bottom &optional face-or-style &rest args)
"Create a two lines icon showing given TOP and BOTTOM text, using
given STYLE and style elements ARGS."
@@ -731,7 +731,7 @@ given STYLE and style elements ARGS."
(svg-ascent (or (plist-get style :ascent) 'center))
(tag-x (/ (- svg-width tag-width) 2) )
(svg (svg-create svg-width svg-height)))
-
+
(when (>= stroke 0.25)
(svg-rectangle svg tag-x 0 tag-width tag-height
:fill foreground :rx radius))
@@ -772,16 +772,16 @@ given STYLE and style elements ARGS."
"Concatenate two svg images horizontally."
(let* ((svg (car (with-temp-buffer
- (insert (plist-get (cdr svg-image-1) :data))
- (xml-parse-region (point-min) (point-max)))))
+ (insert (plist-get (cdr svg-image-1) :data))
+ (xml-parse-region (point-min) (point-max)))))
(attrs (xml-node-attributes svg))
(width-1 (string-to-number (cdr (assq 'width attrs))))
(height-1 (string-to-number (cdr (assq 'height attrs))))
(children-1 (xml-node-children svg))
-
+
(svg (car (with-temp-buffer
- (insert (plist-get (cdr svg-image-2) :data))
- (xml-parse-region (point-min) (point-max)))))
+ (insert (plist-get (cdr svg-image-2) :data))
+ (xml-parse-region (point-min) (point-max)))))
(attrs (xml-node-attributes svg))
(width-2 (string-to-number (cdr (assq 'width attrs))))
(height-2 (string-to-number (cdr (assq 'height attrs))))
@@ -821,7 +821,7 @@ given STYLE and style elements ARGS."
(defun svg-lib-button--get-state (id &optional region)
"Return the state of button ID"
-
+
(when-let* ((region (or region (svg-lib-button--search id))))
(get-text-property (car region) 'button-state)))
@@ -848,7 +848,7 @@ hovered button unless NO-RESET is t"
(setq-local svg-lib-button--press-id id)))))
(defun svg-lib-button--tooltip-hide (&rest _args)
- "Set currently press or hightlighted button to default
+ "Set currently press or highlighted button to default
state (active) and hover button at point if any."
(when svg-lib-button--press-id
@@ -894,7 +894,7 @@ problem if the hook creates a frame."
(if-let ((id (svg-lib-button--at-point mouse-point)))
(svg-lib-button--set-state svg-lib-button--press-id 'hover)
(svg-lib-button--set-state svg-lib-button--press-id 'active)))
-
+
(when-let* ((region (svg-lib-button--search svg-lib-button--press-id))
(hook (get-text-property (car region) 'button-hook)))
(if (minibufferp nil t)
@@ -902,10 +902,10 @@ problem if the hook creates a frame."
(abort-minibuffers)
(funcall hook))
(funcall hook))))
-
+
(defun svg-lib-button--mouse-drag ()
"Update the state of the button under mouse"
-
+
(interactive)
(save-excursion
(mouse-set-point last-input-event)
@@ -996,7 +996,7 @@ activated before inserting a button into a buffer."
"This advice function ensures keymap is not removed when in
svg-lib-button-mode"
(let ((properties (if (and svg-lib-button-mode (derived-mode-p 'org-mode))
- (org-plist-delete properties 'keymap)
+ (svg--plist-delete properties 'keymap)
properties)))
(apply orig-fun (list beg end properties object))))
@@ -1029,13 +1029,9 @@ work properly. This mode also installs an advice on
(dolist (property '(help-echo keymap display))
(setq-local font-lock-extra-managed-props
(remove property font-lock-extra-managed-props))))
-
+
(unless svg-lib-button-mode
(advice-remove #'remove-text-properties
#'svg-lib-button--remove-text-properties)))
(provide 'svg-lib)
;;; svg-lib.el ends here
-
-
-
-