diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 2162c58..6d0c91a 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -102,6 +102,12 @@ (set-visited-file-name new-name) (set-buffer-modified-p nil))))))) +(defadvice ido-find-file (after find-file-sudo activate) + "Find file as root if necessary." + (unless (and buffer-file-name + (file-writable-p buffer-file-name)) + (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) + (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful.