rewrite find-file-sudo to fix opening some directories etc
This commit is contained in:
parent
e338ec34af
commit
150c49903b
@ -43,9 +43,10 @@
|
|||||||
(expand-file-name "tramp-history" backup-directory))
|
(expand-file-name "tramp-history" backup-directory))
|
||||||
:config
|
:config
|
||||||
(defun find-file-sudo (&rest throwaway)
|
(defun find-file-sudo (&rest throwaway)
|
||||||
(unless (and buffer-file-name
|
(if buffer-file-name
|
||||||
(file-writable-p buffer-file-name))
|
(unless (or (file-writable-p buffer-file-name)
|
||||||
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
|
(file-directory-p buffer-file-name))
|
||||||
|
(find-alternate-file (format "/sudo::%s" buffer-file-name)))))
|
||||||
(advice-add #'find-file :after #'find-file-sudo))
|
(advice-add #'find-file :after #'find-file-sudo))
|
||||||
;; Visualize whitespace. In a very chill and invisible way.
|
;; Visualize whitespace. In a very chill and invisible way.
|
||||||
(use-package image-mode
|
(use-package image-mode
|
||||||
|
Loading…
Reference in New Issue
Block a user