3

考虑一个评估名称为字符串的变量的问题:

(defun string-dereference ()
  (interactive)
  (let ((myStr "rst-adjust"))
  ;; (describe-function 'myStr) => Symbol's function definition is void: myStr
  ;; (funcall (format "(describe-function '%s)" myStr) => Invalid function: "(describe-function 'rst-adjust)")
  )

虽然以下工作

(describe-function 'rst-adjust)

rst-adjust给定的存储在字符串中,我该怎么做?

编辑

答案是:

(describe-function (intern myStr))
4

1 回答 1

7

intern是您正在寻找的功能:

(let ((my-str "rst-adjust"))
  (intern my-str))
==> rst-adjust
于 2012-08-20T10:29:36.003 回答