GNU-devel ELPA - svg-tag-mode

svg-tag-mode

Description
Replace keywords with SVG tags
Latest
svg-tag-mode-0.3.2.0.20240122.120925.tar (.sig), 2024-Mar-31, 300 KiB
Maintainer
Nicolas P. Rougier <Nicolas.Rougier@inria.fr>
Atom feed
svg-tag-mode.xml
Website
https://github.com/rougier/svg-tag-mode
Browse ELPA's repository
CGit or Gitweb
Badge

To install this package from Emacs, use package-install or list-packages.

Full description

This minor mode replaces keywords or expressions with SVG tags
that are fully customizable and activable.

Usage example:
--------------

(setq svg-tag-tags '((":TODO:"  ((lambda (tag)
                                     (svg-tag-make "TODO"))))))

Each item has the form '(KEYWORD (TAG COMMAND HELP)) where:
 - KEYWORD is a regular expression including a matched group of 
   the form "\\(xxx\\)". If this is not the case the whole
   string will be used a the matched group.
 - TAG is either a SVG image that will be displayed using the
   'display property or a function that accepts a unique string
   argument (match-string 1) and returns an SVG image.
 - COMMAND is a command to be executed when user clicks on the tag.
   It can be nil if no command is associated with the tag.
 - HELP is a string to be displayed when mouse pointer is over
   the tag. It can be nil if no command is associated with the tag.


Examples:
---------

;; This replaces any occurrence of ":TODO:" with a SVG tag
;; displaying "TODO"
(setq svg-tag-tags
      '((":TODO:" . ((lambda (tag) (svg-tag-make "TODO" ))))))

;; This replaces any occurrence of ":HELLO:" with a SVG tag that
;; can be clicked to execute the specified command. Help message is
;; displayed when the tag is hovered with the pointer.
(setq svg-tag-tags
      '((":HELLO:" .  ((lambda (tag) (svg-tag-make "HELLO"))
                       (lambda () (interactive) (message "Hello world!"))
                       "Print a greeting message"))))

;; This replaces any occurrence of ":XYZ:" with a SVG tag
;; displaying "XYZ"
(setq svg-tag-tags
      '(("\\(:[A-Z]+:\\)" . ((lambda (tag)
                                 (svg-tag-make tag :beg 1 :end -1))))))

;; This replaces any occurrence of ":XXX|YYY:" with two adjacent
;; SVG tags displaying "XXX" and "YYY"
(setq svg-tag-tags
      '(("\\(:[A-Z]+\\)\|[a-zA-Z#0-9]+:" .
                 ((lambda (tag) (svg-tag-make tag :beg 1
                                                  :inverse t
                                                  :margin 0
                                                  :crop-right t))))
        (":[A-Z]+\\(\|[a-zA-Z#0-9]+:\\)" .
                 ((lambda (tag) (svg-tag-make tag :beg 1
                                                  :end -1
                                                  :margin 0
                                                  :crop-left t))))))

;; This replaces any occurrence of ":#TAG1:#TAG2:…:$" ($ means end of
;; line) with a collection of SVG tags. Note the # symbol in
;; front of tags. This is mandatory because Emacs cannot do regex look
;; ahead.
(setq svg-tag-tags
      '(("\\(:#[A-Za-z0-9]+\\)" . ((lambda (tag)
                                     (svg-tag-make tag :beg 2))))
        ("\\(:#[A-Za-z0-9]+:\\)$" . ((lambda (tag)
                                       (svg-tag-make tag :beg 2
                                                         :end -1))))))

Old versions

svg-tag-mode-0.3.2.0.20240108.113259.tar.lz2024-Jan-08 219 KiB
svg-tag-mode-0.3.2.0.20230824.94303.tar.lz2023-Aug-24 219 KiB
svg-tag-mode-0.3.2.0.20230803.50443.tar.lz2023-Aug-03 219 KiB
svg-tag-mode-0.3.2.0.20230110.182450.tar.lz2023-Jan-10 219 KiB
svg-tag-mode-0.3.2.0.20230109.90138.tar.lz2023-Jan-09 219 KiB
svg-tag-mode-0.3.2.0.20221017.121636.tar.lz2022-Oct-17 219 KiB
svg-tag-mode-0.3.2.0.20220525.175402.tar.lz2022-May-25 218 KiB
svg-tag-mode-0.3.2.0.20220103.181755.tar.lz2022-Jan-03 218 KiB
svg-tag-mode-0.3.2.0.20211229.92023.tar.lz2021-Dec-29 218 KiB
svg-tag-mode-0.3.1.0.20211228.184803.tar.lz2021-Dec-28 218 KiB

News

Version 0.3.2
- Fixed dependency on svg-lib

Version 0.3.1:
- Tags are now editable when cursor is inside.

Version 0.2:
- Added activable tags
- svg-lib dependency

Version 0.1:
- Proof of concept