Skip to content

Instantly share code, notes, and snippets.

@fasheng
Last active December 24, 2015 15:38
Show Gist options
  • Save fasheng/6821432 to your computer and use it in GitHub Desktop.
Save fasheng/6821432 to your computer and use it in GitHub Desktop.
Revert buffer as root.
(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