[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/svg-tag-mode de9aba3f37 09/63: Fix style and naming
From: |
ELPA Syncer |
Subject: |
[elpa] externals/svg-tag-mode de9aba3f37 09/63: Fix style and naming |
Date: |
Mon, 27 Dec 2021 15:57:55 -0500 (EST) |
branch: externals/svg-tag-mode
commit de9aba3f37f9ed19f79e14f18007fff188900afd
Author: DK <beerandhot@gmail.com>
Commit: DK <beerandhot@gmail.com>
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 2c4a3a02a1 33/63: Enforce use of spaces for indentation, (continued)
- [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
- [elpa] externals/svg-tag-mode 4fb494db21 43/63: Changed style of date, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 3dd9bef838 59/63: Removed `org-plist-delete` dependency., ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 60140b7526 62/63: Remove ununsed local variables., ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode c78500db2c 60/63: Fix bugs (typos)., ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode de9aba3f37 09/63: Fix style and naming,
ELPA Syncer <=
- [elpa] externals/svg-tag-mode 90c15ebc07 05/63: Load subr-x for string-trim, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode e9d0df33a6 12/63: Better default, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode a5af3041c4 07/63: Added customizable options, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 0944bb3bce 14/63: Simplified tag setup and added custom variable for tags, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode db4d223352 18/63: Fixed documentation, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 9649055e90 20/63: Trying to fix header, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode cec780a16f 21/63: Added version, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 4fdc7ffbb3 23/63: Fixed font weights, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 609ed7cc32 24/63: Removed free variable, ELPA Syncer, 2021/12/27
- [elpa] externals/svg-tag-mode 0125ceca29 22/63: Fix README, ELPA Syncer, 2021/12/27