refactor(dired): use dirvish-preview-environment
- Remove +dired--suppress-hooks-in-previews-a, because Dirvish already does this. - Exploit dirvish-preview-environment instead of hardcoding the enable-local-variables let-binding for the child process. Its defaults are more reasonable.
This commit is contained in:
parent
f3e9920e80
commit
a6c3c6842a
1 changed files with 4 additions and 9 deletions
|
@ -199,18 +199,13 @@ Fixes #3939: unsortable dired entries on Windows."
|
||||||
(if (and (file-directory-p (car args))
|
(if (and (file-directory-p (car args))
|
||||||
(eq (car-safe result) 'dired))
|
(eq (car-safe result) 'dired))
|
||||||
`(dired . (,@(butlast (cdr result))
|
`(dired . (,@(butlast (cdr result))
|
||||||
,(format "(let ((enable-local-variables nil)) %s)"
|
,(format "(let %s %s)"
|
||||||
|
(prin1-to-string
|
||||||
|
(mapcar (lambda (env) `(,(car env) ,(cdr env)))
|
||||||
|
(remove '(inhibit-message . t) dirvish-preview-environment)))
|
||||||
(car (last (cdr result))))))
|
(car (last (cdr result))))))
|
||||||
result)))
|
result)))
|
||||||
|
|
||||||
;; HACK: Suppress mode hooks when previewing files, as they may contain
|
|
||||||
;; expensive or disruptive functionality that isn't needed just for
|
|
||||||
;; previewing them.
|
|
||||||
;; REVIEW: Upstream this later?
|
|
||||||
(defadvice! +dired--suppress-hooks-in-previews-a (fn &rest args)
|
|
||||||
:around #'dirvish--find-file-temporarily
|
|
||||||
(delay-mode-hooks (apply fn args)))
|
|
||||||
|
|
||||||
;; HACK: Dirvish will complain that pdf-tools is required to preview PDFs,
|
;; HACK: Dirvish will complain that pdf-tools is required to preview PDFs,
|
||||||
;; even if the package is installed, so I advise it to try autoloading it
|
;; even if the package is installed, so I advise it to try autoloading it
|
||||||
;; before complaining, otherwise complain if epdfinfo hasn't been built yet.
|
;; before complaining, otherwise complain if epdfinfo hasn't been built yet.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue