Giter Club home page Giter Club logo

Comments (9)

chookity-pokk avatar chookity-pokk commented on May 29, 2024 1

Sorry for the delay, I was finishing up a term of school. Adding (add-hook 'dashboard-mode 'svg-tag-mode) seems to make it work just fine.

from svg-tag-mode.

rougier avatar rougier commented on May 29, 2024

Thanks for the report. I don't quite understand why svg-tag-mode would mess with image display. Is it loaded before or after the dashboard?

from svg-tag-mode.

chookity-pokk avatar chookity-pokk commented on May 29, 2024

I tried putting dashboard at the beginning and end on my init and it didn't change anything.

Also, it doesn't seem to interrupt any image display in org mode when use org-display-image-inline.

from svg-tag-mode.

rougier avatar rougier commented on May 29, 2024

Do you know what is the mode of the dashboard ? (org-mode? text-mode? dashboard-mode?)

from svg-tag-mode.

chookity-pokk avatar chookity-pokk commented on May 29, 2024

I believe it's dashboard-mode.

from svg-tag-mode.

rougier avatar rougier commented on May 29, 2024

What are the tags that you define?

from svg-tag-mode.

chookity-pokk avatar chookity-pokk commented on May 29, 2024

Here is my svg-tag setuo.

(use-package svg-tag-mode
  :config
  (plist-put svg-lib-style-default :font-family "Iosevka Nerd Font")
  (plist-put svg-lib-style-default :font-size 13))

(defconst date-re "[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}")
(defconst time-re "[0-9]\\{2\\}:[0-9]\\{2\\}")
(defconst day-re "[A-Za-z]\\{3\\}")
(defconst day-time-re (format "\\(%s\\)? ?\\(%s\\)?" day-re time-re))
(defun svg-progress-percent (value)
  (svg-image (svg-lib-concat
              (svg-lib-progress-bar (/ (string-to-number value) 100.0)
                                nil :margin 0 :stroke 2 :radius 3 :padding 2 :width 11)
              (svg-lib-tag (concat value "%")
                           nil :stroke 0 :margin 0)) :ascent 'center))

(defun svg-progress-count (value)
  (let* ((seq (mapcar #'string-to-number (split-string value "/")))
         (count (float (car seq)))
         (total (float (cadr seq))))
  (svg-image (svg-lib-concat
              (svg-lib-progress-bar (/ count total) nil
                                    :margin 0 :stroke 2 :radius 3 :padding 2 :width 11)
              (svg-lib-tag value nil
                           :stroke 0 :margin 0)) :ascent 'center)))

;Setting my own face
;(defface myface '((t (:inherit org-todo) :height 1.0 :background "#957DAD")) "Face for todo")
(defface pastelpurple '((t (:inherit org-todo :height 2.0 :foreground "#957DAD"))) "Face for todo")
(defface pastelgreen '((t (:inherit org-todo :height 2.0 :foreground "#B0EB93"))) "Face for WIP")
(defface pastelblue '((t (:inherit org-todo :height 2.0 :foreground "#B3E3DA"))) "Face for DONE")
(defface pastelred '((t (:inherit org-todo :height 2.0 :foreground "#F98284"))) "Face for tags")
(defface pastelpink '((t (:inherit org-todo :height 2.0 :foreground "#FEAAE4"))) "Face for Date")
(defface cyan '((t (:inherit org-todo :height 2.0 :foreground "#00b3b3"))) "Face for Code")
(defface cobolt '((t (:inherit org-todo :height 2.0 :foreground "#0047ab"))) "Face for Verbatim")


(setq svg-tag-tags
      `(
        ;; Task priority [#a]
        ("\\[#[a-zA-Z]\\]" . ( (lambda (tag)
                              (svg-tag-make tag :face 'org-priority 
                                            :beg 2 :end -1 :margin 0 :inverse t))))

        ;; Progress [1/3] or [45%]
        ("\\(\\[[0-9]\\{1,3\\}%\\]\\)" . ((lambda (tag)
                                            (svg-progress-percent (substring tag 1 -2)))))
        ("\\(\\[[0-9]+/[0-9]+\\]\\)" . ((lambda (tag)
                                          (svg-progress-count (substring tag 1 -1)))))

	;; Tags that allow spaces
	;; :FIXME: This needs to be fixed
	;; :HACK:Fix this regexp
	;; :FIX:TJere os more regexp
	;; :HACK:Insert text here

	("\\([:]\\{1,3\\}\\W?[FIXME|Fixme]*:.*\\)" . ((lambda (tag) (svg-tag-make tag
											  :face 'cyan
                                                                                          :inverse t
                                                                                          :crop-left t
											  :beg 7))))

	("\\([:]\\{1,3\\}\\W?[FIX|Fix]*:.*\\)" . ((lambda (tag) (svg-tag-make tag
											  :face 'cyan
                                                                                          :inverse t
                                                                                          :crop-left t
											  :beg 5))))

	("\\([:]\\{1,3\\}\\W?[HACK|PERF|MARK|Hack|NOTE]*:.*\\)" . ((lambda (tag) (svg-tag-make tag
											  :face 'cyan
                                                                                          :inverse t
                                                                                          :crop-left t
											  :beg 6))))
    
	("\\([:]\\{1,3\\}\\W?[HACK|Hack|PERF|FIXME|Fixme|FIX|Fix|MARK|NOTE]*:\\)" . ((lambda (tag) (svg-tag-make tag
                                                                                         :face 'cyan
											 :inverse nil
                                                                                         :margin 0
                                                                                         :crop-right t
											 :beg 1
											 :end -1))))
	
	
        ;; Org TAGS
        (":TODO:" . ((lambda (tag) (svg-tag-make "TODO" :inverse t :face 'pastelpurple))))
        (":WIP:" . ((lambda (tag) (svg-tag-make "WIP" :inverse t :face 'pastelgreen))))
        (":DONE:" . ((lambda (tag) (svg-tag-make "DONE" :inverse t :face 'pastelblue))))
        (":NOTE:" . ((lambda (tag) (svg-tag-make "NOTE"))))
        ("SCHEDULED:" . ((lambda (tag) (svg-tag-make "SCHEDULED" :inverse t :face 'cobolt))))
        ("DEADLINE:" . ((lambda (tag) (svg-tag-make "DEADLINE" :inverse t :face 'cobolt))))
	("elisp" . ((lambda (tag) (svg-tag-make "elisp" :face 'cyan))))
        ("+BEGIN_SRC" . ((lambda (tag) (svg-tag-make "BEGIN" :inverse t :face 'cyan))))
        ("+END_SRC" . ((lambda (tag) (svg-tag-make "END" :face 'cyan))))
        ("+RESULTS:" . ((lambda (tag) (svg-tag-make "RESULTS" :inverse t :face 'cobolt))))
        ("+title" . ((lambda (tag) (svg-tag-make "TITLE" :face 'cobolt))))
        ("+date" . ((lambda (tag) (svg-tag-make "DATE" :face 'cobolt))))
        ("+author" . ((lambda (tag) (svg-tag-make "AUTHOR" :face 'cobolt))))
        ("+OPTIONS" . ((lambda (tag) (svg-tag-make "OPTIONS" :face 'cobolt))))
        ("+PROPERTY" . ((lambda (tag) (svg-tag-make "PROPERTY" :face 'cobolt))))
        ("+STARTUP" . ((lambda (tag) (svg-tag-make "STARTUP" :inverse t :face 'cobolt))))
        ("+BEGIN:" . ((lambda (tag) (svg-tag-make "BEGIN" :inverse t :face 'org-tag))))
        ("+CAPTION:" . ((lambda (tag) (svg-tag-make "CAPTION" :inverse t :face 'cobolt))))
        ("+NAME:" . ((lambda (tag) (svg-tag-make "NAME" :face 'cobolt))))
        ("+END:" . ((lambda (tag) (svg-tag-make "END" :inverse t :face 'org-warning))))
	(":X" . ((lambda (tag) (svg-tag-make "[X]" :inverse t :face 'org-checkbox-statistics-done))))
        (":-" . ((lambda (tag) (svg-tag-make "[-]" :inverse t :face 'org-checkbox-statistics-todo))))
	
        ;; Citation of the form [cite:@Knuth:1984] 
        ("\\(\\[cite:@[A-Za-z]+:\\)" . ((lambda (tag)
                                          (svg-tag-make tag
                                                        :inverse t
                                                        :beg 7 :end -1
                                                        :crop-right t))))
        ("\\[cite:@[A-Za-z]+:\\([0-9]+\\]\\)" . ((lambda (tag)
                                                (svg-tag-make tag
                                                              :end -1
                                                              :crop-left t))))


	;;; Works for stuff like :XXX|YYY:
	("\\(:[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))))
	;; Active date (with or without day name, with or without time)
	;; <2023-04-03 Sun 17:45>
        (,(format "\\(<%s>\\)" date-re) .
         ((lambda (tag)
            (svg-tag-make tag :beg 1 :end -1 :margin 0))))
        (,(format "\\(<%s \\)%s>" date-re day-time-re) .
         ((lambda (tag)
            (svg-tag-make tag :beg 1 :inverse t :crop-right t :margin 0 :face 'org-agenda-date))))
        (,(format "<%s \\(%s>\\)" date-re day-time-re) .
         ((lambda (tag)
            (svg-tag-make tag :end -1 :inverse nil :crop-left t :margin 0 :face 'org-agenda-date))))))

(require 'svg-tag-mode)
;(global-svg-tag-mode 1)
(add-hook 'prog-mode-hook 'svg-tag-mode)
(add-hook 'org-mode-hook 'svg-tag-mode)
(use-package svg-lib)

from svg-tag-mode.

rougier avatar rougier commented on May 29, 2024

Sorry for delay. Can you try adding svg-tag-mode to the dashboar-mode ? Also, if the dashboard-mode does not use font-lock-mode, you'll need to activate it.

from svg-tag-mode.

storvik avatar storvik commented on May 29, 2024

I just hit this as well. Not sure that the hook mentioned above is the correct fix.

However, the fix in #27 is working in dashboard-mode too 🎉

(add-hook 'dashboard-mode-hook #'eli-org-agenda-show-svg)

As this is affecting more than org-mode, maybe this function should be added to svg-tag-mode? What do you think @rougier?

from svg-tag-mode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.