In elisp, how do I put a function in a variable?

后端 未结 3 1893
暖寄归人
暖寄归人 2020-12-16 13:28

I want to allow the user to choose their own command in the \"customize\" emacs backend (and generally be able to store an executable form name in a variable) but this does

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-16 14:21

    To run a function stored in a variable you can use funcall

    (defun dumb-f ()
      (message "I'm a function"))
    
    (defvar my-function 'dumb-f)
    
    (funcall my-function)
    ==> "I'm a function"
    

提交回复
热议问题