rougier / svg-lib

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

Error retrieving icon function #20

Open shamindras opened 2 years ago

shamindras commented 2 years ago

@rougier - thanks for creating such a cool package.

I tried to install this using straight.el as follows locally:

(use-package svg-lib
      :straight '(svg-lib
          :host github
          :repo "rougier/svg-lib"))

It seems to run without error. However when I try to use this with corfu which relies on the svg-icons, I keep getting the warning:

Warning (emacs): Error retrieving icon function, falling back on short-text
(svg-lib.el requires Emacs to be compiled with svg support.
) Disable showing Disable logging

Unfortunately the svg-lib icons don't show as a result. I've attached a screenshot of the situation below:

Screen Shot 2022-06-13 at 12 38 54 PM

As you can see the pop up dialog from corfu completion does not have the icons but just the fallback text i.e. kw and f etc.

I have the following questions:

  1. Is there something I'm doing wrong with installing the svg-lib package?
  2. Are there any other packages I need to install on my machine before installing on emacs?

I'm running this on macOS (Monterey v12.2.1) and using Emacs v28.1 on a macbook with 64GB ram.

I'm relatively new to emacs, so apologies if this is covered elsewhere. I just wasn't able to solve it.

rougier commented 2 years ago

You need to have Emacs with svg suppport. I'm also on OSX and I'm using emacs-mac (you can install it via homebrew). Did you try one the example given with the package, do you get any output?

shamindras commented 2 years ago

@rougier - many thanks. That worked!

Specifically, I did the following in line with @rougier's great suggestion, in case others have similar issues:

  1. Backup ~/.emacs.d
  2. brew Uninstall existing emacs from macOS

    brew uninstall emacs
  3. brew --cask install existing emacs-mac on macOS. See here for details.

    brew tap railwaycat/emacsmacport
    brew install --cask emacs-mac
  4. Restart emacs
  5. Ensure that init.el (or equivalent file) has the following:

    (use-package svg-lib
      :straight '(svg-lib
          :host github
          :repo "rougier/svg-lib"))
  6. Run M-x all-the-icons-install-fonts as a one-off command to install fonts
  7. Restart emacs, and all should be working

Here is a revised screenshot of the command run above using corfu

Screen Shot 2022-06-22 at 2 09 04 PM

@rougier - is it worthwhile to add some similar (or more basic) macOS guidance in the README? As a new emacs user, I find such basic README guidance very useful. I didn't realize that emacs-mac is what was needed until you kindly flagged it above. I can submit a small PR to this effect if you like.

In either case appreciate your great help and for your cool software tools 👍🏾

rougier commented 2 years ago

Yes, it might be worth to have a paragraph about installation stating that Emaccs svg support is required (with maybe a link to emacs-mac or emacs-plus for OSX users). Since the package is on ELPA, you'll need to sign the copyright assignment (see https://www.gnu.org/software/emacs/manual/html_node/emacs/Copyright-Assignment.html)