[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/nano-modeline 961065fe66 16/26: Added possibility to ha
From: |
ELPA Syncer |
Subject: |
[elpa] externals/nano-modeline 961065fe66 16/26: Added possibility to have icon in buttons |
Date: |
Fri, 2 Jun 2023 03:59:07 -0400 (EDT) |
branch: externals/nano-modeline
commit 961065fe66f3d4fc49fe5a02cee332240517f03c
Author: Nicolas P. Rougier <Nicolas.Rougier@inria.fr>
Commit: Nicolas P. Rougier <Nicolas.Rougier@inria.fr>
Added possibility to have icon in buttons
---
nano-modeline.el | 55 +++++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 41 insertions(+), 14 deletions(-)
diff --git a/nano-modeline.el b/nano-modeline.el
index 8eacd849ef..229c7ea5e2 100644
--- a/nano-modeline.el
+++ b/nano-modeline.el
@@ -295,23 +295,48 @@ using the given FACE-PREFIX as the default."
:foreground ,foreground
:background ,background))))
+(defvar nano-modeline--cached-svg-buttons nil
+ "List of cached SVG buttons indexed with (label . face)")
+(setq nano-modeline--cached-svg-buttons nil)
+
(defun nano-modeline--make-svg-button (label face)
"Make a svg button from LABEL and FACE"
-
+
(require 'svg-lib)
- (let ((foreground (face-foreground face nil 'default))
- (background (face-background face nil 'default))
- (weight (face-attribute face ':weight nil 'default))
- (stroke (nano-modeline--stroke-width face))
- (family (face-attribute face ':family nil 'default)))
- (propertize (concat label " ")
- 'display (svg-lib-tag label nil :foreground foreground
- :background background
- :font-weight weight
- :font-family family
- :stroke stroke
- :padding 1
- :margin 0))))
+ (let* ((key (cons label face))
+ (cached (assoc key nano-modeline--cached-svg-buttons))
+ (foreground (face-foreground face nil 'default))
+ (background (face-background face nil 'default))
+ (weight (face-attribute face ':weight nil 'default))
+ (stroke (nano-modeline--stroke-width face))
+ (family (face-attribute face ':family nil 'default))
+ (button (cond (cached (cdr cached))
+ ((string-match "\\([a-zA-Z0-9-]+\\):\\([a-zA-Z0-9]+\\)"
label)
+ (propertize " "
+ 'display (svg-lib-icon (match-string 1
label) nil
+ :foreground
foreground
+ :background
background
+ :font-weight weight
+ :font-family family
+ :stroke stroke
+ :height 1.
+ :padding 1
+ :margin 0
+ :collection
(match-string 2 label))))
+ (t
+ (propertize (concat label " ")
+ 'display (svg-lib-tag label nil
+ :foreground
foreground
+ :background
background
+ :font-weight weight
+ :font-family family
+ :stroke stroke
+ :padding 1
+ :margin 0))))))
+ (unless cached
+ (add-to-list 'nano-modeline--cached-svg-buttons (cons key button)))
+ button))
+
(defun nano-modeline--make-button (button &optional use-svg)
"Make a button from a BUTTON decription. When USE-SVG is t and
@@ -368,6 +393,8 @@ other button states."
"Install a header line made of LEFT and RIGHT parts. Line can be
made DEFAULT."
+ (require 'tooltip)
+
(if default
(setq-default header-line-format (nano-modeline--make left right
'header))
(setq-local header-line-format (nano-modeline--make left right 'header)))
- [elpa] externals/nano-modeline updated (b8795c14ad -> bead6850a1), ELPA Syncer, 2023/06/02
- [elpa] externals/nano-modeline 21263a0b3d 01/26: Complete rewrite, ELPA Syncer, 2023/06/02
- [elpa] externals/nano-modeline 7f8c45c5fb 02/26: Some modelines can be made default (text or prog), ELPA Syncer, 2023/06/02
- [elpa] externals/nano-modeline d18fa48999 08/26: Update documentation, ELPA Syncer, 2023/06/02
- [elpa] externals/nano-modeline 3e29afaea2 09/26: Better alignment with fringes and margins, ELPA Syncer, 2023/06/02
- [elpa] externals/nano-modeline 7663311747 04/26: Bugfix with deadline date, ELPA Syncer, 2023/06/02
- [elpa] externals/nano-modeline 26470be833 07/26: Nil face is ok, ELPA Syncer, 2023/06/02
- [elpa] externals/nano-modeline 7503853c0b 13/26: Added clickalt text/svg buttons, ELPA Syncer, 2023/06/02
- [elpa] externals/nano-modeline 961065fe66 16/26: Added possibility to have icon in buttons,
ELPA Syncer <=
- [elpa] externals/nano-modeline a2bf4fd073 22/26: Several group of butons are now possible, ELPA Syncer, 2023/06/02
- [elpa] externals/nano-modeline bead6850a1 26/26: Add usage example to documentation, ELPA Syncer, 2023/06/02
- [elpa] externals/nano-modeline 0b47e73d04 18/26: Added possibility for dynamic buttons, ELPA Syncer, 2023/06/02
- [elpa] externals/nano-modeline 7331307df8 03/26: Upated documentation to new implementation, ELPA Syncer, 2023/06/02
- [elpa] externals/nano-modeline 239000d7e1 10/26: Handle case when fringes are outside margins, ELPA Syncer, 2023/06/02
- [elpa] externals/nano-modeline 93c78fd956 12/26: Renamed faces to name/primary/secondary, ELPA Syncer, 2023/06/02
- [elpa] externals/nano-modeline 7f5879ead9 14/26: Better org-mode, ELPA Syncer, 2023/06/02
- [elpa] externals/nano-modeline 4e5be76d98 17/26: Message compose mode with buttons, ELPA Syncer, 2023/06/02
- [elpa] externals/nano-modeline e3a04505ff 05/26: Optional symbols, ELPA Syncer, 2023/06/02
- [elpa] externals/nano-modeline 8304ce072f 06/26: Simplification of faces, ELPA Syncer, 2023/06/02