completion/ivy: decouple ivy-rich advice from nullable doom--project-root
This commit is contained in:
parent
a6cc5a219b
commit
2925f5657b
1 changed files with 2 additions and 5 deletions
|
@ -1,7 +1,5 @@
|
||||||
;;; completion/ivy/autoload/ivy.el -*- lexical-binding: t; -*-
|
;;; completion/ivy/autoload/ivy.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(defvar doom--project-root nil)
|
|
||||||
|
|
||||||
(defun +ivy--is-workspace-or-other-buffer-p (buffer)
|
(defun +ivy--is-workspace-or-other-buffer-p (buffer)
|
||||||
(let ((buffer (car buffer)))
|
(let ((buffer (car buffer)))
|
||||||
(when (stringp buffer)
|
(when (stringp buffer)
|
||||||
|
@ -15,7 +13,7 @@
|
||||||
'face (cond ((string-match-p "^ *\\*" str)
|
'face (cond ((string-match-p "^ *\\*" str)
|
||||||
'font-lock-comment-face)
|
'font-lock-comment-face)
|
||||||
((and buffer-file-truename
|
((and buffer-file-truename
|
||||||
(not (file-in-directory-p buffer-file-truename doom--project-root)))
|
(not (file-in-directory-p buffer-file-truename (doom-project-root))))
|
||||||
'font-lock-doc-face)
|
'font-lock-doc-face)
|
||||||
(t nil))))
|
(t nil))))
|
||||||
(advice-add 'ivy-rich-switch-buffer-buffer-name :override #'+ivy*rich-switch-buffer-buffer-name)
|
(advice-add 'ivy-rich-switch-buffer-buffer-name :override #'+ivy*rich-switch-buffer-buffer-name)
|
||||||
|
@ -46,8 +44,7 @@ started `counsel-recentf' from. Also uses `abbreviate-file-name'."
|
||||||
(defun +ivy-buffer-transformer (str)
|
(defun +ivy-buffer-transformer (str)
|
||||||
"Dim special buffers, buffers whose file aren't in the current buffer, and
|
"Dim special buffers, buffers whose file aren't in the current buffer, and
|
||||||
virtual buffers. Uses `ivy-rich' under the hood."
|
virtual buffers. Uses `ivy-rich' under the hood."
|
||||||
(let ((buf (get-buffer str))
|
(let ((buf (get-buffer str)))
|
||||||
(doom--project-root (doom-project-root)))
|
|
||||||
(require 'ivy-rich)
|
(require 'ivy-rich)
|
||||||
(cond (buf (ivy-rich-switch-buffer-transformer str))
|
(cond (buf (ivy-rich-switch-buffer-transformer str))
|
||||||
((and (eq ivy-virtual-abbreviate 'full)
|
((and (eq ivy-virtual-abbreviate 'full)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue