[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/svg-tag-mode 4894900f52 10/63: Merge pull request #6 fr
From: |
ELPA Syncer |
Subject: |
[elpa] externals/svg-tag-mode 4894900f52 10/63: Merge pull request #6 from a13/main |
Date: |
Mon, 27 Dec 2021 15:57:55 -0500 (EST) |
branch: externals/svg-tag-mode
commit 4894900f5263b4e0ec732d0c61f2f4e1d0e4cba5
Merge: fe508895e1 de9aba3f37
Author: Nicolas P. Rougier <Nicolas.Rougier@inria.fr>
Commit: GitHub <noreply@github.com>
Merge pull request #6 from a13/main
Fix style and naming
---
svg-tag-mode.el | 56 +++++++++++++++++++++++++++++---------------------------
1 file changed, 29 insertions(+), 27 deletions(-)
diff --git a/svg-tag-mode.el b/svg-tag-mode.el
index f93339be0c..5deb132bce 100644
--- a/svg-tag-mode.el
+++ b/svg-tag-mode.el
@@ -6,7 +6,7 @@
;; Homepage: https://github.com/rougier/svg-tag-mode
;; Keywords: convenience
-;; Package-Requires: ((emacs "25"))
+;; Package-Requires: ((emacs "26.1"))
;; This file is not part of GNU Emacs.
@@ -64,39 +64,39 @@
(eval-when-compile (require 'subr-x))
(defvar svg-tags nil)
-(defvar active-svg-tags nil)
+(defvar svg-tags--active-tags nil)
-(defgroup svg-tag-mode nil
+(defgroup svg-tag nil
"Replace keywords with SVG rounded box labels"
:group 'convenience
:prefix "svg-tag-")
(defcustom svg-tag-default-outer-padding 1
- "Default outer padding (in characters, null or positive)"
+ "Default outer padding (in characters, null or positive)."
:type 'integer
- :group 'svg-tag-mode)
+ :group 'svg-tag)
(defcustom svg-tag-default-inner-padding 1
- "Default inner padding (in characters, null or positive)"
+ "Default inner padding (in characters, null or positive)."
:type 'integer
- :group 'svg-tag-mode)
+ :group 'svg-tag)
(defcustom svg-tag-default-radius 3
- "Default radius (in pixels, null or positive)"
+ "Default radius (in pixels, null or positive)."
:type 'integer
- :group 'svg-tag-mode)
+ :group 'svg-tag)
(defcustom svg-tag-vertical-offset 0
"Vertical offset for text (in pixels).
This should be zero for most fonts but some fonts may need this."
:type 'integer
- :group 'svg-tag-mode)
+ :group 'svg-tag)
(defcustom svg-tag-horizontal-offset 0
"Horizontal offset for text (in pixels).
This should be zero for most fonts but some fonts may need this."
:type 'integer
- :group 'svg-tag-mode)
+ :group 'svg-tag)
(defface svg-tag-default-face
`((t :foreground "white"
@@ -106,7 +106,7 @@ This should be zero for most fonts but some fonts may need
this."
:weight ,(face-attribute 'default :weight)
:height 120))
"Default face for tag"
- :group 'svg-tag-mode)
+ :group 'svg-tag)
(defun svg-tag-make (text &optional face inner-padding outer-padding radius)
(let* ((face (or face 'svg-tag-default-face))
@@ -129,25 +129,25 @@ This should be zero for most fonts but some fonts may
need this."
(text (string-trim text))
(tag-width (* (+ (length text) inner-padding) txt-char-width))
(tag-height (* txt-char-height 0.9))
-
+
(svg-width (+ tag-width (* outer-padding txt-char-width)))
(svg-height tag-height)
(tag-x (/ (- svg-width tag-width) 2))
(text-x (+ tag-x (/ (- tag-width (* (length text) tag-char-width))
2)))
(text-y (- tag-char-height (- txt-char-height tag-char-height)))
-
+
(radius (or radius svg-tag-default-radius))
(svg (svg-create svg-width svg-height)))
-
+
(svg-rectangle svg tag-x 0 tag-width tag-height
:fill border
:rx radius)
(svg-rectangle svg (+ tag-x (/ stroke 2.0)) (/ stroke 2.0)
- (- tag-width stroke) (- tag-height stroke)
+ (- tag-width stroke) (- tag-height stroke)
:fill background
:rx (- radius (/ stroke 2.0)))
- (svg-text svg text
+ (svg-text svg text
:font-family family
:font-weight weight
:font-size size
@@ -158,23 +158,25 @@ This should be zero for most fonts but some fonts may
need this."
(defun svg-tag-mode-on ()
(add-to-list 'font-lock-extra-managed-props 'display)
- (if active-svg-tags
- (font-lock-remove-keywords nil active-svg-tags))
- (if svg-tags
- (font-lock-add-keywords nil svg-tags))
- (setq active-svg-tags (copy-sequence svg-tags))
+ (when svg-tags--active-tags
+ (font-lock-remove-keywords nil svg-tags--active-tags))
+ (when svg-tags
+ (font-lock-add-keywords nil svg-tags))
+ (setq svg-tags--active-tags (copy-sequence svg-tags))
(message "SVG tag mode on"))
-(defun svg-tag-mode-off ()
- (if active-svg-tags
- (font-lock-remove-keywords nil active-svg-tags))
- (setq active-svg-tags nil)
+(defun svg-tag-mode-off ()
+ (when svg-tags--active-tags
+ (font-lock-remove-keywords nil svg-tags--active-tags))
+ (setq svg-tags--active-tags nil)
(message "SVG tag mode off"))
(define-minor-mode svg-tag-mode
"Minor mode for graphical tag as rounded box."
- :group 'svg-tag-mode
+ :group 'svg-tag
(if svg-tag-mode (svg-tag-mode-on) (svg-tag-mode-off))
(font-lock-flush))
(provide 'svg-tag-mode)
+
+;;; svg-tag-mode.el ends here
- [elpa] externals/svg-tag-mode 81cb79335c 02/63: Added installation instructions, (continued)
- [elpa] externals/svg-tag-mode 81cb79335c 02/63: Added installation instructions, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode fe508895e1 08/63: Removed spurious backquote, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode ffc6631dd2 16/63: Cosmetic, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 7a4e0df952 17/63: Added org-mode example, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 2bcf213527 26/63: Added global mode, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 3c38d60cb7 06/63: Merge pull request #3 from tsuu32/fix/load-subr-x, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode d62ae5bc4d 03/63: Typo, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 664fbec919 01/63: First version, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 63d8710d1a 04/63: Better example syntax, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 4fe6ce8681 13/63: Typo, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 4894900f52 10/63: Merge pull request #6 from a13/main,
ELPA Syncer <=
- [elpa] externals/svg-tag-mode fc57d2d4bb 11/63: Normalized names, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 2dc379039a 15/63: Updated example, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 87489d2845 31/63: Fixed warning (see https://github.com/melpa/melpa/pull/7217#issuecomment-735307276), ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode a34a2e1128 32/63: Added scale of 1 just in case, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 2c4a3a02a1 33/63: Enforce use of spaces for indentation, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 83fc912461 51/63: Updated screenshots, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 837dfbdd06 48/63: Fixed documentation., ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode ede0edb5c3 25/63: Lint correction, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 607d05d972 37/63: Fix conflict, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 60d56f3f41 29/63: Fixed terminal mode error, ELPA Syncer, 2021/12/27