rougier / svg-lib

Emacs SVG libraries for creatings tags, icons and bars
GNU General Public License v3.0
334 stars 30 forks source link

Errors with various icons #30

Open bdarcus opened 1 year ago

bdarcus commented 1 year ago

Not sure where the problems are, but:

ELISP> (insert-image (svg-lib-icon "journal" nil :collection "material" :stroke 0 :scale .75 :padding 0))
*** Eval error ***  Wrong type argument: stringp, nil
ELISP> (insert-image (svg-lib-icon "note_alt" nil :collection "material" :stroke 0 :scale .75 :padding 0))
*** Eval error ***  Wrong type argument: stringp, nil
ELISP> (insert-image (svg-lib-icon "file_present" nil :collection "material" :stroke 0 :scale .75 :padding 0))
*** Eval error ***  Wrong type argument: stringp, nil

On the latter two, split-string is being called and generating the error; not sure why that's the case.

I'm wanting to come up with some examples for configuring this new functionality in citar:

https://github.com/emacs-citar/citar#indicators

Any suggestions on icons that would work well there?

Here's what this config looks like with all-the-icons:

image

rougier commented 1 year ago

Some icon reprositories have changed (just merged a PR for bootstrap). Can you check if material points to https://raw.githubusercontent.com/Templarian/MaterialDesign/master/svg/%s.svg in svg-lib-icon-collections?

rougier commented 1 year ago

And you need to clean the cache directory before testing.

bdarcus commented 1 year ago

Can you check if material points to https://raw.githubusercontent.com/Templarian/MaterialDesign/master/svg/%s.svg ...

❯ curl https://raw.githubusercontent.com/Templarian/MaterialDesign/master/svg/note.svg
<svg xmlns="http://www.w3.org/2000/svg" id="mdi-note" viewBox="0 0 24 24"><path d="M14,10V4.5L19.5,10M5,3C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V9L15,3H5Z" /></svg>⏎      

So that one works, but I get 404s for other names I try from here:

https://fonts.google.com/icons

Maybe I'm selecting from the wrong options?

rougier commented 1 year ago

It seems some icon repositories have changed their URL. I merged several PR to fix them. You might need to update svg-lib and to clear the cache (in .emacs.d/.cache)

bdarcus commented 1 year ago

The example I have at the top still don't work.

ELISP> (insert-image (svg-lib-icon "notes" nil :collection "opticon" :stroke 0 :scale .75 :padding 0))
*** Eval error ***  Wrong type argument: stringp, nil
rougier commented 1 year ago

octicon (not opticon) maybe?

bdarcus commented 1 year ago

Oh yeah, that was a typo.

But I had initially tried with the examples at top.

I'll experiment more later.

PS - either way, you might add error handing to that function?

bdarcus commented 1 year ago

OK, a backtrace; it's returning nil.

  svg-lib--icon-get-data("octicon" "note")
  svg-lib-icon("note" nil :collection "octicon" :stroke 0 :scale 0.75 :padding 0)
  eval((svg-lib-icon "note" nil :collection "octicon" :stroke 0 :scale 0.75 :padding 0) t)

I deleted the cache.