fix: opening tramp paths from command line args
Eventually, Emacs will process any files passed to it via the command line, and will do so *really* early in the startup process. These might contain special file paths like TRAMP paths (e.g. /sudo://etc/ssh/ssh_config), so restore `file-name-handler-alist' just for this small portion of startup.
This commit is contained in:
parent
c0a1b9efc9
commit
9913acbdc4
1 changed files with 7 additions and 0 deletions
|
@ -382,6 +382,13 @@ users).")
|
||||||
(set-default-toplevel-value 'file-name-handler-alist file-name-handler-alist)
|
(set-default-toplevel-value 'file-name-handler-alist file-name-handler-alist)
|
||||||
;; Remember it so it can be reset where needed.
|
;; Remember it so it can be reset where needed.
|
||||||
(put 'file-name-handler-alist 'initial-value old-value)
|
(put 'file-name-handler-alist 'initial-value old-value)
|
||||||
|
;; COMPAT: Eventually, Emacs will process any files passed to it via the
|
||||||
|
;; command line, and will do so *really* early in the startup process.
|
||||||
|
;; These might contain special file paths like TRAMP paths, so restore
|
||||||
|
;; `file-name-handler-alist' just for this portion of startup.
|
||||||
|
(define-advice command-line-1 (:around (fn args-left) respect-file-handlers)
|
||||||
|
(let ((file-name-handler-alist (if args-left old-value file-name-handler-alist)))
|
||||||
|
(funcall fn args-left)))
|
||||||
;; COMPAT: ...but restore `file-name-handler-alist' later, because it is
|
;; COMPAT: ...but restore `file-name-handler-alist' later, because it is
|
||||||
;; needed for handling encrypted or compressed files, among other things.
|
;; needed for handling encrypted or compressed files, among other things.
|
||||||
(add-hook! 'emacs-startup-hook :depth 101
|
(add-hook! 'emacs-startup-hook :depth 101
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue