Reputation: 13477
Consider a problem of evaluating a variable who's name is a string:
(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)")
)
While the following works
(describe-function 'rst-adjust)
How do I do that given rst-adjust
is stored in a string?
Edit:
The answer is:
(describe-function (intern myStr))
Upvotes: 3
Views: 187
Reputation: 41548
intern
is the function you're looking for:
(let ((my-str "rst-adjust"))
(intern my-str))
==> rst-adjust
Upvotes: 7