find-current-buffer-as-root.el

#358
Raw
Author
winny
Created
April 23, 2021, 4:49 p.m.
Expires
Never
Size
311 bytes
Hits
274
Syntax
EmacsLisp
Private
No
(defun winny/find-current-buffer-as-root ()
  "Find the current buffer as root using TRAMP sudo."
  (interactive)
  (when (file-remote-p default-directory)
    (error "Already a TRAMP buffer.  Giving up"))
  (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))