I have defined the following function with Emacs, I defined the "username" for a website and the associated "password". But, how could I make this function show a dired view of the ftp like it does when you login with the regular method ( /username@ftp.site.com:/ )
(defun myftp_login()
"Login to a ftp"
( ange-ftp-set-user "ftp.site.com" "username" )
( ange-ftp-set-passwd "ftp.site.com" "username" "password" )
;; command to open dired view to a folder in ftp.site.com
)
I already searched for similar questions but I couldn't find one that solves my problem, thank you.
solution: As Tobias and Michael Albinus pointed out, the code should look like this and the passwords should be stored in ~/.netrc for safer storage:
(defun ftplogin_site()
"Login to the ftp.site.com"
(interactive)
( ange-ftp-set-user "ftp.site.com" "username" )
( find-file "/username@ftp.site.com:/folder/folder/")
)
Thank you everyone for your help.
You don't need to touch ange-ftp variables. Open a file like Cx Cf /ftp:username@ftp.site.com:/
You can use (find-file "/username@ftp.site.com:/")
.
The best first place to dig is often the key-binding. The key combination Ch k Cx Cf reveals find-file
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.