feat(editor): replace nearly all use of all-the-icons with nerd-icons

This also lets us unpin doom-modeline, which was previous pinned to the
latest commit that supported all-the-icons.
This commit is contained in:
2023-05-11 01:49:40 +01:00
parent 4654ea5e80
commit 0b63d3607d
6 changed files with 93 additions and 108 deletions

View File

@@ -18,63 +18,5 @@
(all-the-icons-scale-factor 1.0)
(all-the-icons-default-adjust -0.2))
(use-package all-the-icons-ibuffer
:after all-the-icons
:if window-system
:hook
(ibuffer-mode . all-the-icons-ibuffer-mode))
(use-package all-the-icons-dired
:after all-the-icons
:if window-system
:hook
(dired-mode . all-the-icons-dired-mode)
:custom
(all-the-icons-dired-monochrome nil)
(all-the-icons-dired-v-adjust -0.05))
(use-package treemacs-all-the-icons
:after (all-the-icons treemacs)
:if window-system
:config
(treemacs-load-theme "all-the-icons"))
(use-package all-the-icons-completion
:after (all-the-icons marginalia)
:if window-system
:demand t
:hook
(marginalia-mode . all-the-icons-completion-marginalia-setup)
:config
(all-the-icons-completion-mode)
;; Using original all-the-icons-completion package.
(when (fboundp 'all-the-icons-completion-get-file-icon)
;; Override default category lookup function to add support for
;; project-buffer and project-file.
(defun all-the-icons-completion-get-icon (cand cat)
"Return the icon for the candidate CAND of completion category CAT."
(cl-case cat
(file (all-the-icons-completion-get-file-icon cand))
(project-file (all-the-icons-completion-get-file-icon cand))
(buffer (all-the-icons-completion-get-buffer-icon cand))
(project-buffer (all-the-icons-completion-get-buffer-icon cand))
(t ""))))
;; Using MintSoup's fork of all-the-icons-completion.
(when (not (fboundp 'all-the-icons-completion-get-file-icon))
(require 'cl-generic)
;; Add support for 'project-buffer category by treating it same as 'buffer.
(cl-defmethod all-the-icons-completion-get-icon ((cand string) (cat (eql 'project-buffer)))
(all-the-icons-completion-get-icon cand 'buffer))))
;; (defun siren-all-icons-complete-wrap (orig-fun &rest args)
;; "Wrap `all-the-icons-completion' to use `siren-all-icons-complete' instead."
;; (message "args: %s" args)
;; (apply orig-fun args))
;; (advice-add 'all-the-icons-completion-get-icon :around #'siren-all-icons-complete-wrap)
(provide 'siren-all-the-icons)
;;; siren-all-the-icons.el ends here

View File

@@ -6,30 +6,25 @@
;;; Code:
(let ((straight-current-profile 'pinned))
;; Pin doom-modeline to before they switched to nerd-icons, and I'm having a
;; number of bugs how nerd icons are rendered.
(straight-x-pin-package "doom-modeline"
"918730eff72e155cfb31b012493a7f425bc48ff8")
(use-package doom-modeline
:custom
(doom-modeline-bar-width 3)
(doom-modeline-buffer-encoding nil)
(doom-modeline-buffer-file-name-style 'auto)
(doom-modeline-buffer-modification-icon t)
(doom-modeline-buffer-state-icon t)
(doom-modeline-checker-simple-format t)
(doom-modeline-enable-word-count t)
(doom-modeline-height 25)
(doom-modeline-indent-info nil)
(doom-modeline-minor-modes t)
(doom-modeline-hud t)
(doom-modeline-persp-name nil)
(doom-modeline-vcs-max-length 24)
(doom-modeline-workspace-name nil)
(use-package doom-modeline
:custom
(doom-modeline-bar-width 3)
(doom-modeline-buffer-encoding nil)
(doom-modeline-buffer-file-name-style 'auto)
(doom-modeline-buffer-modification-icon t)
(doom-modeline-buffer-state-icon t)
(doom-modeline-checker-simple-format t)
(doom-modeline-enable-word-count t)
(doom-modeline-height 25)
(doom-modeline-indent-info nil)
(doom-modeline-minor-modes t)
(doom-modeline-persp-name nil)
(doom-modeline-vcs-max-length 24)
(doom-modeline-workspace-name nil)
:config
(doom-modeline-mode)))
:config
(doom-modeline-mode))
(provide 'siren-doom-modeline)
;;; siren-doom-modeline.el ends here

View File

@@ -11,38 +11,92 @@
(nerd-icons-scale-factor 1.0)
(nerd-icons-default-adjust 0.0)
:config
(let ((font "Menlo Nerd Font"))
(if (member font (font-family-list))
(setq nerd-nerd-icons-font-family font))))
(when (and (display-graphic-p nil)
(not (member "Symbols Nerd Font Mono" (font-family-list))))
(nerd-icons-install-fonts)))
(use-package nerd-icons-completion
:straight
(nerd-icons-completion :type git :host github
:repo "rainstormstudio/nerd-icons-completion")
:if (not window-system)
:demand t
:hook
(marginalia-mode . nerd-icons-completion-marginalia-setup)
:config
(cl-defmethod nerd-icons-completion-get-icon (cand (_cat (eql project-buffer)))
"Return the icon for the candidate CAND of completion category project-buffer."
(nerd-icons-completion-get-icon cand 'buffer))
(cl-defmethod nerd-icons-completion-get-icon (cand (_cat (eql tab)))
"Display tab icon for nerd-icons-completion."
(concat (nerd-icons-mdicon "nf-md-tab" :face 'nerd-icons-blue) " "))
(cl-defmethod nerd-icons-completion-get-icon (cand (_cat (eql command)))
"Display command icon for nerd-icons-completion."
(concat (nerd-icons-mdicon "nf-md-cog" :face 'nerd-icons-blue) " "))
(cl-defmethod nerd-icons-completion-get-icon (cand (_cat (eql mode)))
"Display mode icon for nerd-icons-completion."
(concat (nerd-icons-octicon "nf-oct-package" :face 'nerd-icons-blue) " "))
(cl-defmethod nerd-icons-completion-get-icon (cand (_cat (eql function)))
"Display function icon for nerd-icons-completion."
(if (commandp (intern cand))
(concat (nerd-icons-octicon "nf-oct-gear" :face 'nerd-icons-blue) " ")
(concat (nerd-icons-octicon "nf-oct-package" :face 'nerd-icons-purple) " ")))
(cl-defmethod nerd-icons-completion-get-icon (cand (_cat (eql variable)))
"Display function icon for nerd-icons-completion."
(if (custom-variable-p (intern cand))
(concat (nerd-icons-octicon "nf-oct-tag" :face 'nerd-icons-lblue) " ")
(concat (nerd-icons-mdicon "nf-md-tag" :face 'nerd-icons-lblue) " ")))
(cl-defmethod nerd-icons-completion-get-icon (cand (_cat (eql face)))
"Display face icon for nerd-icons-completion."
(concat (nerd-icons-mdicon "nf-md-palette" :face 'nerd-icons-blue) " "))
(cl-defmethod nerd-icons-completion-get-icon (cand (_cat (eql history)))
"Display history icon for nerd-icons-completion."
(concat (nerd-icons-octicon "nf-oct-history" :face 'nerd-icons-blue) " "))
(cl-defmethod nerd-icons-completion-get-icon (cand (_cat (eql theme)))
"Display theme icon for nerd-icons-completion."
(concat (nerd-icons-mdicon "nf-md-palette" :face 'nerd-icons-lcyan) " "))
(defun nerd-icons-completion--counsel-imenu-symbol (cand)
"Return imenu symbol from CAND."
(let ((str (split-string cand ": ")))
(or (cadr str) (car str))))
(cl-defmethod nerd-icons-completion-get-icon (cand (_cat (eql symbol)))
"Display the symbol icon all-the-icons-completion."
(let ((sym (intern (nerd-icons-completion--counsel-imenu-symbol cand))))
(cond
((string-match-p "Packages?[:)]" cand)
(all-the-icons-octicon "nf-oct-archive" :face 'nerd-icons-silver))
((or (functionp sym) (macrop sym))
(nerd-icons-completion-get-icon cand 'function))
((facep sym)
(nerd-icons-completion-get-icon cand 'face))
((symbolp sym)
(nerd-icons-completion-get-icon cand 'variable))
(t (nerd-icons-octicon "nf-oct-gear" :face 'all-the-icons-silver)))))
(nerd-icons-completion-mode))
(use-package nerd-icons-dired
:straight (nerd-icons-dired :type git :host github
:repo "rainstormstudio/nerd-icons-dired")
:if (not window-system)
:hook
(dired-mode . nerd-icons-dired-mode))
;; Disable for now, as having it enabled causes dired to not reliably select the
;; current buffer when opening dired for directory of current buffer.
;; (use-package nerd-icons-dired
;; :straight (nerd-icons-dired :type git :host github
;; :repo "rainstormstudio/nerd-icons-dired")
;; :hook
;; (dired-mode . nerd-icons-dired-mode)
;; :custom
;; (nerd-icons-dired-v-adjust 0.01))
(use-package nerd-icons-ibuffer
:if (not window-system)
:hook
(ibuffer-mode . nerd-icons-ibuffer-mode))
(use-package treemacs-nerd-icons
:straight (treemacs-nerd-icons :type git :host github
:repo "rainstormstudio/treemacs-nerd-icons")
:if (not window-system)
:config
(with-eval-after-load 'treemacs
(treemacs-load-theme "nerd-icons")))

View File

@@ -40,9 +40,6 @@
;; Enable flashing mode-line on errors
(doom-themes-visual-bell-config)
;; Configure treemacs styling
(doom-themes-treemacs-config)
;; Corrects (and improves) org-mode's native fontification.
(doom-themes-org-config)
@@ -50,7 +47,7 @@
(defun siren-ns-system-appearance()
"Return the system appearance, either `dark', `light', or `nil'.
A return value of `nil' means that the system appearance is could
A return value of `nil' means that the system appearance could
not be determined. This happens on non-macOS systems, or on macOS
if running Emacs in a terminal."
(if (boundp 'ns-system-appearance)

View File

@@ -1,8 +1,5 @@
(("a.el" . "93e5ed8c495794d1ba3c04b43041b95ce01079b1")
("ace-window" . "77115afc1b0b9f633084cf7479c767988106c196")
("all-the-icons-completion" . "e09e65bf05b247ea0e2bdc5d36ea5a58fc2ed69b")
("all-the-icons-dired" . "4564bec6bd3fd02dd870e6d2cfed37fe38bbc93a")
("all-the-icons-ibuffer" . "400860b2990529bd3a915e4d0a55fbc6d128a3ba")
("all-the-icons.el" . "f75c1130b72c718bfaf18b56c445c4b58efc714f")
("anzu" . "5abb37455ea44fa401d5f4c1bdc58adb2448db67")
("applescript-mode" . "3022d8103d8f8e47239503969348407c00ef1d0b")
@@ -40,6 +37,7 @@
("dired-plus" . "90fc0d5a110063278e3fe320dd903ec07be5dba7")
("dirvish" . "4b63cd2e5ba994f8e674388db7035de1a8f0343f")
("docker.el" . "4a308e6b2184a1b7745df5a8b8adafb29b3f7157")
("doom-modeline" . "af3274ae5f31947370bbc57661c0f19b5c06ccfc")
("dumb-jump" . "0a783d1db610ff1dc4e1b7869589cff16ff92f7a")
("edit-indirect" . "f80f63822ffae78de38dbe72cacaeb1aaa96c732")
("editorconfig-emacs" . "a8b31c925e5cdee4b26b10a43094787937fe441e")
@@ -152,7 +150,6 @@
("multiple-cursors.el" . "6956e8e12ee191d7c80d042ae8ff495286fcbe38")
("mwim.el" . "b4f3edb4c0fb8f8b71cecbf8095c2c25a8ffbf85")
("nerd-icons-completion" . "d88fec04a9169a746a306ecd24f0877d1a95080d")
("nerd-icons-dired" . "5abd8f6d9f395f91d3e67afadbea6c638dee7e6e")
("nerd-icons-ibuffer" . "18c00c03a0d7193bab5e3374ec02c5428db057fd")
("nerd-icons.el" . "6fdb423eabb1c14161cb59af8fd74ee8b572e303")
("nginx-mode" . "6e9d96f58eddd69f62f7fd443d9b9753e16e0e96")
@@ -202,6 +199,7 @@
("seeing-is-believing" . "fbbe246c0fda87bb26227bb826eebadb418a220f")
("shell-pop-el" . "4b4394037940a890a313d715d203d9ead2d156a6")
("shift-number.el" . "cd099a5582fc996b800ac7607f6c38a004ce9740")
("shrink-path.el" . "c14882c8599aec79a6e8ef2d06454254bb3e1e41")
("smart-shift" . "a26ab2b240137e62ec4bce1698ed9c5f7b6d13ae")
("smartparens" . "1d5cd5e8d46e182b935f8cd3cf29c8c4410aab0a")
("snap-indent" . "0c50c2bcc65d902b937db8a4ad5466bd48c66320")

View File

@@ -1,3 +1,2 @@
(("copilot" . "40cc5ef071f52ef9bc8545325a0e0fab44d6180d")
("doom-modeline" . "918730eff72e155cfb31b012493a7f425bc48ff8"))
(("copilot" . "40cc5ef071f52ef9bc8545325a0e0fab44d6180d"))
:gamma