• Stars
    star
    465
  • Rank 90,966 (Top 2 %)
  • Language
    Emacs Lisp
  • License
    GNU General Publi...
  • Created over 3 years ago
  • Updated 10 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A minor mode for Emacs that replace keywords with nice SVG labels

svg-tag-mode

A minor mode to replace keywords or regular expression with SVG tags.

Usage example

You need first to set svg-tag-tags that is a list of item here 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.

then you can invoke mode with M-x svg-tag-mode. Here are some examples:

  1. Replace any occurence of :TODO: with a static SVG tag displaying TODO
(setq svg-tag-tags
      '((":TODO:" . ((lambda (tag) (svg-tag-make "TODO"))))))
  1. Replace any occurence of :HELLO: with a static SVG tag displaying HELLO 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"))))
  1. Replace any occurence of :TODO: with a dynamic SVG tag displaying :TODO:
(setq svg-tag-tags
      '((":TODO:" . ((lambda (tag) (svg-tag-make tag))))))
  1. Replace any occurence of :TODO: with a dynamic SVG tag displaying TODO
(setq svg-tag-tags
      '((":TODO:" . ((lambda (tag)
                       (svg-tag-make tag :beg 1 :end -1))))))
  1. Replaces any occurence of :XXX: with a dynamic SVG tag displaying XXX
(setq svg-tag-tags
      '(("\\(:[A-Z]+:\\)" . ((lambda (tag)
                               (svg-tag-make tag :beg 1 :end -1))))))
  1. Replaces any occurence of :XXX|YYY: with two adjacent dynamic 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))))))
  1. This replaces any occurence of :#TAG1:#TAG2:…:$ ($ means end of line) with a dynamic 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))))))

Known Problems

SVG tags cannot render in org-agenda

As issue #27 mentioned, SVG tags cannot render in org-agenda, because svg-tag-mode uses font-lock-mode to show SVG tags. However, org-agenda does not use font-lock-mode, so it only shows rendered SVG tags in visited buffers. One way to solve this problem is to use overly:

  (defun org-agenda-show-svg ()
    (let* ((case-fold-search nil)
           (keywords (mapcar #'svg-tag--build-keywords svg-tag--active-tags))
           (keyword (car keywords)))
      (while keyword
        (save-excursion
          (while (re-search-forward (nth 0 keyword) nil t)
            (overlay-put (make-overlay
                          (match-beginning 0) (match-end 0))
                         'display  (nth 3 (eval (nth 2 keyword)))) ))
        (pop keywords)
        (setq keyword (car keywords)))))
  (add-hook 'org-agenda-finalize-hook #'org-agenda-show-svg)

More Repositories

1

numpy-100

100 numpy exercises (with solutions)
Python
10,706
star
2

scientific-visualization-book

An open access book on scientific visualization using python and matplotlib
Python
10,075
star
3

matplotlib-cheatsheet

Matplotlib 3.1 cheat sheet.
Python
2,899
star
4

matplotlib-tutorial

Matplotlib tutorial for beginner
Python
2,776
star
5

nano-emacs

GNU Emacs / N Λ N O - Emacs made simple
Emacs Lisp
2,472
star
6

from-python-to-numpy

An open-access book on numpy vectorization techniques, Nicolas P. Rougier, 2017
Python
1,904
star
7

freetype-gl

OpenGL text using one vertex buffer, one texture and FreeType
C
1,594
star
8

elegant-emacs

A very minimal but elegant emacs (I think)
Emacs Lisp
1,350
star
9

CPP-Crash-Course

C++ Crash Course
C++
667
star
10

ML-Recipes

A collection of stand-alone Python machine learning recipes
Python
642
star
11

notebook-mode

GNU Emacs notebook mode
Emacs Lisp
592
star
12

python-opengl

An open access book on Python, OpenGL and Scientific Visualization, Nicolas P. Rougier, 2018
HTML
575
star
13

numpy-tutorial

Numpy beginner tutorial
Python
459
star
14

mu4e-dashboard

A dashboard for mu4e (mu for emacs)
Emacs Lisp
450
star
15

emacs-gtd

Get Things Done with Emacs
CSS
408
star
16

nano-theme

GNU Emacs / N Λ N O Theme
Emacs Lisp
346
star
17

svg-lib

Emacs SVG libraries for creatings tags, icons and bars
Emacs Lisp
328
star
18

ten-rules

Ten simple rules for better figures
Python
274
star
19

book-mode

A clean interface for org files (Emacs)
Emacs Lisp
272
star
20

freetype-py

Python binding for the freetype library
Python
270
star
21

matplotlib-3d

Experimental 3D axis for matplotlib
Python
261
star
22

dotemacs

Litterate configuration for GNU Emacs
208
star
23

tiny-renderer

A tiny sotfware 3D renderer in 100 lines of Python
Python
168
star
24

nano-modeline

GNU Emacs / N Λ N O Modeline
Emacs Lisp
166
star
25

mu4e-thread-folding

Functions for folding threads in mu4e headers view
Emacs Lisp
134
star
26

neural-networks

Artificial Neural Networks / Python
Python
134
star
27

org-bib-mode

An Emacs minor mode for literate & annotated bibliography
Emacs Lisp
128
star
28

agenda

Org agenda in the console
Python
127
star
29

nano-sidebar

Emacs package to have configurable sidebars on a per frame basis.
Emacs Lisp
111
star
30

scipy-crash-course

Material for a 24 hours course on Scientific Python
100
star
31

python-visualization-landscape

Adaptation of Jake VanderPlas graphic about python visualization landscape
HTML
97
star
32

notes-list

Emacs notes list
Emacs Lisp
96
star
33

calendar-heatmap

Calendar heatmap with matplotlib and random data
Python
95
star
34

emacs-svg-icon

An emacs library to create SVG icons on the fly
Emacs Lisp
91
star
35

sideframe

Emacs side frames
Emacs Lisp
87
star
36

gl-agg

OpenGL Antigrain Geometry experiments
Python
83
star
37

nano-dialog

Emac native dialog box
Emacs Lisp
83
star
38

nano-agenda

A minimal org agenda for Emacs
Emacs Lisp
82
star
39

org-margin

Outdent headlines in emacs org-mode
Emacs Lisp
79
star
40

nano-elfeed

Emacs configuration file for elfeed (news reader)
Emacs Lisp
61
star
41

emacs-splash

An alternative splash screen for GNU Emacs
Emacs Lisp
61
star
42

recursive-voronoi

Recursive voronoi diagram
Python
57
star
43

2021-Dataviz

Material for dataviz course at university of Bordeaux
Jupyter Notebook
50
star
44

gallery

Gallery of matplotlib samples
Python
47
star
45

50-git-questions

50 Frequently Asked question about Git & GitHub
47
star
46

baby-gnu-tux

3D files for printing baby GNU and Tux
46
star
47

windmap

Streamlines animation (matplotlib)
Python
46
star
48

mastodon-alt

Emacs alternative mastodon layout
Emacs Lisp
45
star
49

CNCC-2020

Computational Neuroscience Crash Course (University of Bordeaux, 2020)
Jupyter Notebook
45
star
50

URFIST-git-course

This is the material for the URFIST course on Git & GitHub. Bordeaux, March 27 & 28, 2018.
44
star
51

open-heroes

Some people that facilitate science, one way or the other
41
star
52

alien-life

Remake of necessary disorrder beautiful animation
Python
41
star
53

minibuffer-header

Minibuffer header for GNU/Emacs
Emacs Lisp
41
star
54

pyglfw

Python bindings for GLFW 3.0
Python
40
star
55

rougier

Exended profile
39
star
56

nano-vertico

Emacs / nano + vertico
Emacs Lisp
36
star
57

pdf-drop-mode

Get DOI from PDF files dropped onto a Emacs buffer
Emacs Lisp
34
star
58

scientific-posters

A collection of scientific posters (with sources) made with Pages or ComicLife
Rich Text Format
34
star
59

nano-toolbar

Emacs toolbar in the header line
Emacs Lisp
31
star
60

persid

Persistent identifier library for GNU Emacs
Emacs Lisp
31
star
61

org-imenu

org-mode side menu with filtering capability
Emacs Lisp
30
star
62

Neurosciences

Computational Neurosciences repository
Python
30
star
63

org-outer-indent

An outer indentation org mode
Emacs Lisp
29
star
64

CNCC-2019

Computational Neuroscience Crash Course (CNCC 2019)
Jupyter Notebook
27
star
65

unknown-pleasures

Matplotlib animation from the Unknown Pleasures album cover (Joy Division)
Python
26
star
66

relative-date

Emacs package for formatting relative dates (dates difference)
Emacs Lisp
26
star
67

conference-posters

A collection of conferences posters (with sources) made with Pages
25
star
68

aerial-emacs

A cleaner and less cluttered style for emacs
Emacs Lisp
25
star
69

nano-calendar

An alternative calendar for Emacs
Emacs Lisp
25
star
70

VSOM

Randomize Self Organizing map
Python
24
star
71

emacs-octicons

Octicons glyph name for emacs
Emacs Lisp
22
star
72

dynamic-som

Dynamic Self-Organized maps
Python
22
star
73

Scipy-Bordeaux-2018

Notes for the Scientific Python course at the university of Bordeaux
21
star
74

Scipy-Bordeaux-2016

Course taught at the University of Bordeaux in the academic year 2015/16 for PhD students.
21
star
75

numpy-glm

GL Mathematics for Numpy
Python
20
star
76

bootstrap-rst

Restructured Text Bootstrap
Python
19
star
77

pendulum

Animated double pendulum using matplotlib
Python
18
star
78

spatial-computation

Spatial computation
Python
18
star
79

nano-bell

Visual bell for GNU Emacs
Emacs Lisp
18
star
80

reviewer-manifesto

A pledge for reviewers
17
star
81

nano-minibuffer

Minibuffer for NΛNO Emacs
Emacs Lisp
16
star
82

nano-splash

N Λ N O Splash
Emacs Lisp
16
star
83

Scipy-Bordeaux-2017

Course taught at the University of Bordeaux in the academic year 2017 for PhD students.
16
star
84

less-is-more

A remake of the animation by Dark Horse Analytics (http://www.darkhorseanalytics.com)
Python
16
star
85

org-agenda-conflict

Mark conflicting items in the org-agenda
Emacs Lisp
15
star
86

emacs-defaults

Defaults setting for vanilla emacs
Emacs Lisp
15
star
87

blog

My GitHub blog
14
star
88

2023-dataviz-nancy

Material for dataviz course (Nancy, 2023)
Jupyter Notebook
14
star
89

ASPP-2017

Material for the Advanced Scientific Python Programming course, Nikiti, Greece, 2017
Python
14
star
90

nano-command

Emacs / Quick command in the mode-line or header-line
Emacs Lisp
13
star
91

mu4e-folding

Thread folding support for mu4e
Emacs Lisp
13
star
92

figure-anatomy

Anatomy of a matplotlib figure
Python
13
star
93

EmacsConf-2022

Poster for the Emacs conference 2022
13
star
94

Scipy-Bordeaux-2019

Lecture notes (Université de Bordeaux)
Python
13
star
95

gl-bezier

Experiments on quadratic and cubic Bézier curves
Python
12
star
96

galaxy

Spiral galaxy simulator using the density wave theory
Python
12
star
97

mu4e-thread

mu4e thread folding
Emacs Lisp
11
star
98

dana

Distributed (Asynchronous) Numerical Adaptive computing framework
Python
11
star
99

pyd3

Python conversion of some D3 modules (https://github.com/d3) [WIP]
Python
10
star
100

youtube-dl

See https://youtube-dl.org/
10
star