Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…has it.
  • Loading branch information...
commit 2665b17c131edde4bc94777d33db62ddb9c9a950 1 parent 1bf7b67
@winfred-lu authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 winfred-buffer.el
View
6 winfred-buffer.el
@@ -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)))))
;;;;;;
Please sign in to comment.
Something went wrong with that request. Please try again.