mirror of
https://github.com/correl/dotfiles.git
synced 2024-12-18 03:00:11 +00:00
[emacs] Add automatic open-as-root to ido-mode (from emacsredux.com)
This commit is contained in:
parent
c69b60408f
commit
cbbb0327d6
1 changed files with 6 additions and 0 deletions
|
@ -102,6 +102,12 @@
|
||||||
(set-visited-file-name new-name)
|
(set-visited-file-name new-name)
|
||||||
(set-buffer-modified-p nil)))))))
|
(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
|
||||||
;; custom-set-variables was added by Custom.
|
;; custom-set-variables was added by Custom.
|
||||||
;; If you edit it by hand, you could mess it up, so be careful.
|
;; If you edit it by hand, you could mess it up, so be careful.
|
||||||
|
|
Loading…
Reference in a new issue