completion/ivy: refactor transformers
- Mode icons will now fall back to fundamental-mode icon, rather than the blank file icon (whose irregular width ruins ivy's formatting) - Fixes project-based buffer name highlighting in switch-to-buffer - Fixes a void-variable ivy-rich--ivy-switch-buffer-transformer error Relevant to #1159
This commit is contained in:
parent
fa95984427
commit
2514b7476e
2 changed files with 57 additions and 72 deletions
|
@ -19,16 +19,27 @@
|
|||
|
||||
Displays buffers in other projects in `font-lock-doc-face', and
|
||||
temporary/special buffers in `font-lock-comment-face'."
|
||||
(with-current-buffer (get-buffer candidate)
|
||||
(propertize candidate
|
||||
'face (cond ((string-match-p "^ *\\*" candidate)
|
||||
'font-lock-comment-face)
|
||||
((not buffer-file-name) nil)
|
||||
((not (file-in-directory-p
|
||||
buffer-file-name
|
||||
(or (doom-project-root)
|
||||
default-directory)))
|
||||
'font-lock-doc-face)))))
|
||||
(propertize
|
||||
candidate
|
||||
'face (cond ((string-match-p "^ *\\*" candidate)
|
||||
'font-lock-comment-face)
|
||||
((not (buffer-file-name (get-buffer candidate)))
|
||||
nil)
|
||||
((not (projectile-project-buffer-p
|
||||
(get-buffer candidate)
|
||||
(doom-project-root)))
|
||||
'font-lock-doc-face))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +ivy-rich-buffer-icon (candidate)
|
||||
"Display the icon for CANDIDATE buffer.
|
||||
|
||||
Otherwise show the fundamental-mode icon."
|
||||
(with-current-buffer candidate
|
||||
(let ((icon (all-the-icons-icon-for-mode major-mode)))
|
||||
(if (symbolp icon)
|
||||
(all-the-icons-icon-for-mode 'fundamental-mode)
|
||||
icon))))
|
||||
|
||||
|
||||
;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue