Restore file-name-handler-alist non-destructively

And in reverse order, so new rules correctly shadow old ones.
This commit is contained in:
Henrik Lissner 2020-04-16 18:16:49 -04:00
parent 2a93ff6ad4
commit f532019b1f
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -31,6 +31,10 @@
;; Restore `file-name-handler-alist', because it is needed for handling
;; encrypted or compressed files, among other things.
(defun doom-reset-file-handler-alist-h ()
;; Re-add rather than `setq', because file-name-handler-alist may have
;; changed since startup, and we want to preserve those.
(dolist (handler file-name-handler-alist)
(add-to-list 'doom--initial-file-name-handler-alist handler))
(setq file-name-handler-alist doom--initial-file-name-handler-alist))
(add-hook 'emacs-startup-hook #'doom-reset-file-handler-alist-h))