Fix #1311: remove project check in ivy transformer

Also: minor refactor of `cond` fallback blocks
This commit is contained in:
Henrik Lissner 2019-04-07 15:10:22 -04:00
parent 1fab389d9e
commit e60b44d255
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -17,18 +17,11 @@
(defun +ivy-rich-buffer-name (candidate) (defun +ivy-rich-buffer-name (candidate)
"Display the buffer name. "Display the buffer name.
Displays buffers in other projects in `font-lock-doc-face', and Buffers that are considered unreal (see `doom-real-buffer-p') are dimmed with
temporary/special buffers in `font-lock-comment-face'." `font-lock-comment-face'."
(propertize (if (doom-real-buffer-p (get-buffer candidate))
candidate candidate
'face (cond ((string-match-p "^ *\\*" candidate) (propertize candidate 'face 'font-lock-comment-face)))
'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 ;;;###autoload
(defun +ivy-rich-buffer-icon (candidate) (defun +ivy-rich-buffer-icon (candidate)
@ -66,16 +59,14 @@ Otherwise show the fundamental-mode icon."
(current (current
(setq prompt "Switch to buffer: " (setq prompt "Switch to buffer: "
action #'ivy--switch-buffer-action)) action #'ivy--switch-buffer-action))
(t ((setq prompt "Switch to buffer in other window: "
(setq prompt "Switch to buffer in other window: "
action #'ivy--switch-buffer-other-window-action))) action #'ivy--switch-buffer-other-window-action)))
(when +ivy-buffer-preview (when +ivy-buffer-preview
(cond ((not (and ivy-use-virtual-buffers (cond ((not (and ivy-use-virtual-buffers
(eq +ivy-buffer-preview 'everything))) (eq +ivy-buffer-preview 'everything)))
(setq update #'+ivy--switch-buffer-preview (setq update #'+ivy--switch-buffer-preview
unwind #'+ivy--switch-buffer-unwind)) unwind #'+ivy--switch-buffer-unwind))
(t ((setq update #'+ivy--switch-buffer-preview-all
(setq update #'+ivy--switch-buffer-preview-all
unwind #'+ivy--switch-buffer-unwind)))) unwind #'+ivy--switch-buffer-unwind))))
(ivy-read prompt 'internal-complete-buffer (ivy-read prompt 'internal-complete-buffer
:action action :action action