Fix counsel-projectile-find-file from occur buffers #2268

counsel-projectile-find-file-action would open the candidate from wrong
buffer.

This is an experimental fix.
This commit is contained in:
Henrik Lissner 2019-12-31 00:02:20 -05:00
parent fb261a9c65
commit d7d873e11b
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -200,6 +200,14 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
:config :config
(set-popup-rule! "^\\*ivy-occur" :size 0.35 :ttl 0 :quit nil) (set-popup-rule! "^\\*ivy-occur" :size 0.35 :ttl 0 :quit nil)
;; HACK Fix an issue where `counsel-projectile-find-file-action' would try to
;; open a candidate in an occur buffer relative to the wrong buffer,
;; causing it to fail to find the file we want.
(defadvice! +ivy--run-from-ivy-directory-a (orig-fn &rest args)
:around #'counsel-projectile-find-file-action
(let ((default-directory (ivy-state-directory ivy-last)))
(apply orig-fn args)))
;; Don't use ^ as initial input. Set this here because `counsel' defines more ;; Don't use ^ as initial input. Set this here because `counsel' defines more
;; of its own, on top of the defaults. ;; of its own, on top of the defaults.
(setq ivy-initial-inputs-alist nil) (setq ivy-initial-inputs-alist nil)