rougier / svg-tag-mode

A minor mode for Emacs that replace keywords with nice SVG labels
GNU General Public License v3.0
496 stars 28 forks source link

svg-tag-mode causing issue with src block on Emacs 29 #51

Open wustho opened 1 year ago

wustho commented 1 year ago

Here is my emacs version:

GNU Emacs 29.1
Development version 28fb02492c24 on master branch; build date 2023-09-23.
Copyright (C) 2023 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

And here is my svg-tag-mode config:

(use-package svg-tag-mode
  :ensure t
  :hook org-mode
  :config
  (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)))))
  (setq svg-tag-tags
    '(("TODO" . ((lambda (tag) (svg-tag-make tag :face '(:foreground "IndianRed" :weight bold) :inverse t))))
      ("NEXT" . ((lambda (tag) (svg-tag-make tag :face '(:foreground "#007acc" :weight bold) :inverse t))))
      ("WAIT" . ((lambda (tag) (svg-tag-make tag :face '(:foreground "GoldenRod" :weight bold) :inverse t))))
      ("PROJ" . ((lambda (tag) (svg-tag-make tag :face '(:foreground "DarkMagenta" :weight bold) :inverse t))))
      ("LOOP" . ((lambda (tag) (svg-tag-make tag :face '(:foreground "Salmon" :weight bold) :inverse t))))
      ("SMDY" . ((lambda (tag) (svg-tag-make tag :face '(:foreground "MediumTurquoise" :weight bold) :inverse t))))
      ("CANC" . ((lambda (tag) (svg-tag-make tag :face '(:foreground "DarkGrey" :weight bold :strike-through t) :inverse t))))
      ("DONE" . ((lambda (tag) (svg-tag-make tag :face '(:foreground "DarkSeaGreen" :weight bold :strike-through t) :inverse t))))
      ("\\[#A\\]" . ((lambda (tag) (svg-tag-make "(󰄿)" :face '(:foreground "IndianRed" :weight bold) :inverse t))))
      ("\\[#B\\]" . ((lambda (tag) (svg-tag-make "(󰅃)" :face '(:foreground "DarkOrange" :weight bold) :inverse t))))
      ("\\[#C\\]" . ((lambda (tag) (svg-tag-make "(󰅀)" :face '(:foreground "Grey" :weight bold) :inverse t))))
      ;; (":\\([@A-Za-z0-9]+\\)" . ((lambda (tag) (svg-tag-make tag))))
      ;; (":\\([@A-Za-z0-9]+[ \-]\\)" . ((lambda (tag) tag)))
      ))
  (add-hook 'org-agenda-finalize-hook #'org-agenda-show-svg)
  )

And here is the result: Screenshot_20231001_114208

Variable containing underscore displayed like subscript.

My current workaround is:

(setq org-use-sub-superscripts "{}")

But seems like this shouldn't happen.

rougier commented 1 year ago

I think this might be due to this line: (add-to-list 'font-lock-extra-managed-props 'display) Can you check that even without svg-tag-mode, evaluating this line reproduces the problem?