Created
August 25, 2016 09:29
-
-
Save hyOzd/dfd6b201cd43fabcb40018a05cc73f2a to your computer and use it in GitHub Desktop.
emacs open this file as sudo
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
;; open this file in sudo | |
(defun sudo-this () | |
"Open currently visited file as sudo!" | |
(interactive) | |
(if buffer-file-name | |
(let ((to-close (current-buffer))) | |
(find-file (s-concat "/sudo:root@localhost:" buffer-file-name)) | |
(kill-buffer to-close)) | |
(message "No file!"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment