Last active
December 24, 2015 15:38
-
-
Save fasheng/6821432 to your computer and use it in GitHub Desktop.
Revert buffer as root.
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
(defun fsh-revert-buffer-as-root () | |
"Revert buffer as root." | |
(interactive) | |
(let ((buf (current-buffer)) | |
(filename) (sudo-filename)) | |
(setq filename (buffer-file-name buf)) | |
(setq sudo-filename (concat "/sudo::" filename)) | |
(kill-buffer buf) | |
(find-file sudo-filename) | |
(message sudo-filename) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment