rainstormstudio / nerd-icons.el

GNU General Public License v3.0
215 stars 23 forks source link

Unable to use nerd-icons package. #88

Closed apoorv569 closed 2 weeks ago

apoorv569 commented 3 weeks ago

I'm trying to use nerd-icons package along with various recommended package but I can't get it to work. I get this error when I launch emacs,

⛔ Error (use-package): treemacs/:config: all-the-icons isn’t installed
⛔ Error (use-package): nerd-icons-corfu/:config: Symbol’s function definition is void: nerd-icons-corfu-mapping

Not sure why treemacs is trying to load all-the-icons. I have removed all references to all-the-icons (which I was using before nerd-icons).

Here is my nerd-icons and recommended package config,

(use-package nerd-icons
  ;; :custom
  ;; The Nerd Font you want to use in GUI
  ;; "Symbols Nerd Font Mono" is the default and is recommended
  ;; but you can use any other Nerd Font if you want
  ;; (nerd-icons-font-family "Symbols Nerd Font Mono")
  )

(use-package nerd-icons-ibuffer
  :hook (ibuffer-mode . nerd-icons-ibuffer-mode))

;; Whether display the icons.
(setq nerd-icons-ibuffer-icon t)

;; Whether display the colorful icons.
;; It respects `nerd-icons-color-icons'.
(setq nerd-icons-ibuffer-color-icon t)

;; The default icon size in ibuffer.
(setq nerd-icons-ibuffer-icon-size 1.0)

;; Use human readable file size in ibuffer.
(setq  nerd-icons-ibuffer-human-readable-size t)

;; A list of ways to display buffer lines with `nerd-icons'.
;; See `ibuffer-formats' for details.
;; nerd-icons-ibuffer-formats

;; Slow Rendering
;; If you experience a slow down in performance when rendering multiple icons simultaneously,
;; you can try setting the following variable
(setq inhibit-compacting-font-caches t)

(use-package nerd-icons-completion
  :after marginalia
  :config
  (nerd-icons-completion-mode)
  (add-hook 'marginalia-mode-hook #'nerd-icons-completion-marginalia-setup))

(use-package nerd-icons-corfu
  :after corfu
  :config
  (nerd-icons-corfu-mapping
        '((array :style "cod" :icon "symbol_array" :face font-lock-type-face)
          (boolean :style "cod" :icon "symbol_boolean" :face font-lock-builtin-face)
          ;; ...
          (t :style "cod" :icon "code" :face font-lock-warning-face)))
          ;; Remember to add an entry for `t', the library uses that as default.
  (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter))

(use-package nerd-icons-dired
  :after dired
  :hook
  (dired-mode . nerd-icons-dired-mode))

here is my treemacs config,

(use-package treemacs
  :custom
  (treemacs-width 30)
  (doom-themes-treemacs-theme "doom-colors") ;; use the colorful treemacs theme
  :config
  (doom-themes-treemacs-config))

;; (add-hook 'projectile-after-switch-project-hook `treemacs-add-and-display-current-project-exclusively)

(use-package treemacs-icons-dired
  :hook (dired-mode . treemacs-icons-dired-mode))

(use-package treemacs-nerd-icons
  :after treemacs
  :config
  (treemacs-load-theme "nerd-icons"))

Also I use the dashboard package and I have set this for it,

  (setq dashboard-icon-type 'nerd-icons)

but the dashboard always shows up empty and i have this error in *Messages* buffer,

nerd-icons-octicon: Unable to find icon with name ‘file-text’ in icon set ‘octicon’Error during redisplay: (dashboard-resize-on-hook #<frame *dashboard* - GNU Emacs at MachineY 0x158c9638>) signaled (error "Unable to find icon with name ‘file-text’ in icon set ‘octicon’")

I have already tried running nerd-icons-install-fonts and it just installs one file called NFM.ttf under ~/.local/share/fonts/.

seagle0128 commented 3 weeks ago

Should NOT use (doom-themes-treemacs-theme "doom-colors").

nerd-icons-octicon: Unable to find icon with name ‘file-text’ in icon set ‘octicon’Error during redisplay: (dashboard-resize-on-hook #<frame dashboard - GNU Emacs at MachineY 0x158c9638>) signaled (error "Unable to find icon with name ‘file-text’ in icon set ‘octicon’")

Please check you own configurations, and find out if file-text icons was used. In nerd-icons, the oct icons are nf-oct-xxx.

apoorv569 commented 3 weeks ago

Should NOT use (doom-themes-treemacs-theme "doom-colors").

OK, I checked the documentation for this it uses all-the-icons.. What should set this to then? other option is doom-atom.. should I set this to nil then?

Please check you own configurations, and find out if file-text icons was used. In nerd-icons, the oct icons are nf-oct-xxx.

I see.. I looked and dashboard package was using this icon, I browsed the nerd-icons-insert menu and looks like there is no nf-oct-file-text so I used nf-fa-file-text instead also I was using book icon, changed that to nf-fa-bookmark. Now I get this error,

nerd-icons-octicon: Unable to find icon with name ‘nf-fa-file-text’ in icon set ‘octicon’Error during redisplay: (dashboard-resize-on-hook #<frame *dashboard* - GNU Emacs at MachineY 0x36818298>) signaled (error "Unable to find icon with name ‘nf-fa-file-text’ in icon set ‘octicon’")
Error during redisplay: (dashboard-resize-on-hook #<frame *Warnings* - GNU Emacs at MachineY 0x36818298>) signaled (error "Unable to find icon with name ‘nf-fa-file-text’ in icon set ‘octicon’") [2 times]
Error during redisplay: (dashboard-resize-on-hook #<frame *dashboard* - GNU Emacs at MachineY 0x36818298>) signaled (error "Unable to find icon with name ‘nf-fa-file-text’ in icon set ‘octicon’")

Here is my dashboard package configuration,

(use-package dashboard
  :init                                                                      ;; tweak dashboard config before loading it
  (setq dashboard-set-heading-icons t)                                       ;; add icons for headings
  (setq dashboard-set-file-icons t)                                          ;; add icons for files
  (setq dashboard-set-navigator t)
  (setq dashboard-set-init-info t)
  (setq dashboard-set-footer t)
  (setq show-week-agenda-p t)
  (setq dashboard-banner-logo-title "Emacs Is More Than A Text Editor!")     ;; set a title to be displayed under the banner
  (setq dashboard-startup-banner 'logo)                                      ;; use official emacs logo, or text banners -1,2,3
  (setq dashboard-center-content t)                                          ;; set to 't' for centered content
  (setq dashboard-items '((recents . 5)                                      ;; show some items on dashboard
                          (agenda . 5 )
                          (bookmarks . 5)
                          (projects . 5)
                          (registers . 5)))
  (setq dashboard-page-separator "\n\f\n")
  ;; (setq dashboard-icon-type 'all-the-icons)
  (setq dashboard-icon-type 'nerd-icons)
  :config
  (dashboard-setup-startup-hook)
  (dashboard-modify-heading-icons '((recents . "nf-fa-file-text")
                                    (bookmarks . "nf-fa-bookmark")))
  :custom-face
  (dashboard-items-face ((t (:inherit widget-button :weight normal))))
  (dashboard-heading ((t (:inherit font-lock-keyword-face :weight semi-bold)))))
seagle0128 commented 2 weeks ago
  1. You've already used treemacs-nerd-icons, and do nothing with doom-themes-treesmace-theme.
  2. emacs-dashboard DOES ONLY support octicon.