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))
|
||||
:config
|
||||
(defun find-file-sudo (&rest throwaway)
|
||||
(unless (and buffer-file-name
|
||||
(file-writable-p buffer-file-name))
|
||||
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
|
||||
(if buffer-file-name
|
||||
(unless (or (file-writable-p 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))
|
||||
;; Visualize whitespace. In a very chill and invisible way.
|
||||
(use-package image-mode
|
||||
|
Loading…
Reference in New Issue
Block a user