Merge pull request #627 from toctan/sudo-tramp
Fix editing remote unwriteable file
This commit is contained in:
commit
237104bbae
1 changed files with 4 additions and 5 deletions
|
@ -303,11 +303,10 @@ buffer is not visiting a file."
|
|||
|
||||
(defadvice ido-find-file (after find-file-sudo activate)
|
||||
"Find file as root if necessary."
|
||||
(unless (or (equal major-mode 'dired-mode)
|
||||
(and (buffer-file-name)
|
||||
(not (file-exists-p (file-name-directory (buffer-file-name)))))
|
||||
(and (buffer-file-name)
|
||||
(file-writable-p buffer-file-name)))
|
||||
(unless (or (tramp-tramp-file-p buffer-file-name)
|
||||
(equal major-mode 'dired-mode)
|
||||
(not (file-exists-p (file-name-directory buffer-file-name)))
|
||||
(file-writable-p buffer-file-name))
|
||||
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
|
||||
|
||||
(defun prelude-start-or-switch-to (function buffer-name)
|
||||
|
|
Loading…
Reference in a new issue