Hot answers tagged


You could use, for example C-x C-f /sudo::/path/to/file


Backup and auto-save are different operations, controlled by different variables. If you want to discard auto-save for files opened as root, you might change the buffer-local variable auto-save-file-name-transforms. Something like this (untested): (add-hook 'find-file-hook (lambda () (when (and (stringp buffer-file-name) (string-equal (file-...


Based on the advice of politza and wvxvw: (defun my-edit-file-as-root () "Find file as root" (interactive) (let* ((sudo (/= (call-process "sudo" nil nil "-n true") 0)) (file-name (if (tramp-tramp-file-p buffer-file-name) (with-parsed-tramp-file-name buffer-file-name parsed (tramp-make-tramp-file-name ...

Only top voted, non community-wiki answers of a minimum length are eligible