1

I added this function to my ~/.emacs file and run it by entering M-x my-turn-current-window-into-frame RET.

I added the following to my ~/.emacs file after that function:

(global-set-key (kbd "<f12>") 'my-turn-current-window-into-frame)

I copied that line to *scratch* and evaluated it.

When I press F12, Emacs returns:

Symbol's function definition is void: my-turn-current-window-into-frame

How can I configure a hot-key to run this function?

  • 1
    Shouldn't it be (global-set-key (kbd "<f12>") #'my-turn-current-window-into-frame)? – Manuel Uberti Feb 4 '16 at 12:31
  • No... that doesn't work either. – SabreWolfy Feb 5 '16 at 8:35
  • 1
    I assume M-x my-turn-current-window-into-frame still works fine, right? Have you tried starting from emacs -Q, so it's not something weird in your init file? – zck Feb 5 '16 at 22:11
  • 1
    I'm voting to close this question because the problem turned out to be due to a typo. – Gilles 'SO- stop being evil' Feb 25 '16 at 11:59
3

This is what I did:

  • I put this code in my init.el:

    (defun my-turn-current-window-into-frame ()
      (interactive)
      (let ((buffer (current-buffer)))
        (unless (one-window-p)
          (delete-window))
        (display-buffer-pop-up-frame buffer nil)))
    
    (global-set-key (kbd "<f12>") #'my-turn-current-window-into-frame)
    
  • I restarted Emacs.

  • I issued F12.

The current window was turned into a frame.

  • This results in the same error as I experience without the # character, using Emacs 24.3.1. – SabreWolfy Feb 25 '16 at 11:31
  • 1
    Did you try the code with emacs -Q? – Manuel Uberti Feb 25 '16 at 11:45
  • Thanks, I have traced the problem to a typo. It now works with or without the #. – SabreWolfy Feb 25 '16 at 11:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.