find-file-sudo is very broken

This commit is contained in:
MitchMarq42 2023-04-14 13:53:54 -08:00
parent a0fc35c2c7
commit 1b87d2ac9d

View File

@ -50,13 +50,13 @@
:custom (tramp-persistency-file-name
(expand-file-name "tramp-history" backup-directory))
:config
(defun find-file-sudo (&rest throwaway)
(interactive)
(defun find-current-file-sudo (&rest throwaway)
;; (interactive)
(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))
(advice-add #'find-file :after #'find-current-file-sudo))
;; Visualize whitespace. In a very chill and invisible way.
(use-package image-mode