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?

4
  • 1
    Shouldn't it be (global-set-key (kbd "<f12>") #'my-turn-current-window-into-frame)? Commented Feb 4, 2016 at 12:31
  • No... that doesn't work either. Commented Feb 5, 2016 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? Commented Feb 5, 2016 at 22:11
  • 1
    I'm voting to close this question because the problem turned out to be due to a typo. Commented Feb 25, 2016 at 11:59

1 Answer 1

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.

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.