Permalink
Browse files

Fix sudo-find-file not to add the redudant /sudo: when the file name …

…has it.
  • Loading branch information...
winfred-lu committed Jul 28, 2013
1 parent 1bf7b67 commit 2665b17c131edde4bc94777d33db62ddb9c9a950
Showing with 4 additions and 2 deletions.
  1. +4 −2 winfred-buffer.el
View
@@ -45,8 +45,10 @@
(defun wf-sudo-find-file ()
"Ido find file as root."
(interactive)
- (find-file
- (concat "/sudo:root@localhost:" (ido-read-file-name "Sudo find file: "))))
+ (let ((sudo-file-name (ido-read-file-name "Sudo find file: ")))
+ (if (string-equal (subseq sudo-file-name 0 6) "/sudo:")
+ (find-file sudo-file-name)
+ (find-file (concat "/sudo:root@localhost:" sudo-file-name)))))
;;;;;;

0 comments on commit 2665b17

Please sign in to comment.