Hot answers tagged

3

You could use https://stackoverflow.com/questions/95631/open-a-file-with-su-sudo-inside-emacs, for example C-x C-f /sudo::/path/to/file


2

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-...


1

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