函数运行时出现错误“符号的变量值为void:ftp_site_connect”

时间:2015-04-10 19:48:15

标签: emacs

我在函数运行时收到错误“Symbol的值为变量为void:ftp_site_connect”。我一直在Stackoverflow上用类似的错误“Symbol的值作为变量是无效的”来检查其他问题,但它们似乎都没有解决问题。

(defun ftp_site_connect()
  (interactive)
  ( ange-ftp-set-passwd "ftp.site.com" "username" "password" )
  ( find-file "/username@ftp.site.com:/" )
  )

(eval 'ftp_site_connect)

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

非常感谢@npostavs,我似乎找到了问题。

修改代码后,@ npostavs给我的链接上的信息(代码中的'函数错误,'格式用于不用于函数的列表),以下更改的代码似乎可以工作但是它产生了另一个错误。

(defun ftp_site_connect()
  (interactive)
  ( ange-ftp-set-passwd "ftp.site.com" "username" "password" )
  ( find-file "/username@ftp.site.com:/" )
  )

(ftp_site_connect)

所以,我发现ange-ftp-set-passwd函数并不存在于我的服务器上,我必须通过.netrc文件设置密码而不是内联。再次更改后,代码现在似乎完美无缺。

;; Add first the user and password to the .netrc file like this:
;; machine HOST login NAME password PASSWD
;; and change the permissions on that file to chmod 600
;; -------------------------------------------------------------
(defun ftp_site_connect()
      (interactive)
      ( find-file "/username@ftp.site.com:/" )
      )

    (ftp_site_connect)

谢谢大家的帮助。