Created
May 26, 2017 08:20
-
-
Save sideshowcoder/d1553b660a223f21c1701d03a1e382ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; automatically open a file as sudo unless we have permission to write it | |
;; already, after all this is my machine and I can do what I want! | |
(defadvice ido-find-file (after find-file-sudo activate) | |
"Find file as root if necessary." | |
(unless (and buffer-file-name | |
(file-writable-p buffer-file-name)) | |
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment