TransWikia.com

Symbol’s function definition is void

Emacs Asked by 546756ryd on November 20, 2021

I am trying to make an interactive toggle in emacs 27.0.90

When I eval-region no warnings or errors are shown.

However, when I do (helm/toggle-frame) in ielm it throws
Symbol’s function definition is void: helm-in-frame-p

Here is the code,

(let ((helm-in-frame-p t))
  (defun helm/toggle-frame ()
    "Toggle helm in frame or in buffer.
    Default is buffer because it is faster on Xforwarding."
    (interactive)
    (setq helm-in-frame-p (not helm-in-frame-p))
    (if (helm-in-frame-p)
        (progn
          (global-set-key (kbd "M-x") 'helm-M-x-in-frame))
      (progn
        (global-set-key (kbd "M-x") 'helm-M-x)))
    (message "Helm in frame is now %s"
             (if helm-in-frame-p "Enabled" "Disabled"))))

Here is the ielm output

ELISP> helm/toggle-frame
*** Eval error ***  Symbol’s value as variable is void: helm/toggle-frame
ELISP> (helm/toggle-frame)
*** Eval error ***  Symbol’s function definition is void: helm-in-frame-p

One Answer

You define a local variable, then later call a non-existent function with the same name in the if:

(if (helm-in-frame-p)

Drop the surrounding parentheses and it should work again.

Answered by wasamasa on November 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP