Skip to content

Instantly share code, notes, and snippets.

@bodhi
Created May 24, 2012 11:32
Show Gist options
  • Save bodhi/2780922 to your computer and use it in GitHub Desktop.
Save bodhi/2780922 to your computer and use it in GitHub Desktop.
revert-buffer-with-sudo
(defun revert-buffer-with-sudo ()
"reopen file in current buffer with sudo"
(interactive)
(let* ((filename (buffer-file-name (current-buffer)))
(sudo-filename (concat "/sudo::" filename)))
(kill-buffer)
(find-file sudo-filename)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment