feat(editor): switch to fork of all-the-icons-completion

This commit is contained in:
2022-10-19 00:38:37 +01:00
parent d498f20336
commit dfe7250218
3 changed files with 31 additions and 10 deletions

View File

@@ -8,6 +8,9 @@
(setq straight-recipe-overrides
'((nil . (
;; Use fork with more features until PR is merged: https://github.com/iyefrat/all-the-icons-completion/pull/19
(all-the-icons-completion :type git :flavor melpa :host github :repo "iyefrat/all-the-icons-completion"
:fork (:host github :repo "MintSoup/all-the-icons-completion"))
;; Override go-playground to use my fork, which has a fix for
;; uploading to go.dev/play.
(go-playground :type git :host github :repo "grafov/go-playground"

View File

@@ -6,6 +6,8 @@
;;; Code:
(require 'siren-marginalia)
;; Required by all-the-icons
(use-package memoize)
@@ -27,15 +29,31 @@
(all-the-icons-completion-mode)
:config
;; Override default category lookup function.
(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 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)
(cl-defmethod all-the-icons-completion-get-icon ((cand string) (cat (eql 'project-buffer)))
"Display project-buffer icon for CAND all-the-icons-completion."
(all-the-icons-completion-get-icon cand 'buffer))
;; Add support for 'project-file category by treating it same as 'file.
(cl-defmethod all-the-icons-completion-get-icon ((cand string) (cat (eql 'project-file)))
"Display project-file icon for CAND all-the-icons-completion."
(all-the-icons-completion-get-icon cand 'file))))
(provide 'siren-all-the-icons)
;;; siren-all-the-icons.el ends here

View File

@@ -1,6 +1,6 @@
(("a.el" . "93e5ed8c495794d1ba3c04b43041b95ce01079b1")
("ace-window" . "77115afc1b0b9f633084cf7479c767988106c196")
("all-the-icons-completion" . "286e2c064a1298be0d8d4100dc91d7a7a554d04a")
("all-the-icons-completion" . "b8e3c4ceb862a3cbb771884c1e6b5d884356f141")
("all-the-icons-ibuffer" . "54c99aeb17989f684eb7bf3aa88b12adf7dd2d34")
("all-the-icons.el" . "51bf77da1ebc3c199dfc11f54c0dce67559f5f40")
("anzu" . "5abb37455ea44fa401d5f4c1bdc58adb2448db67")