I have the following code in my .emacs
file. It's supposed to move the input focus to any newly created frame.
(defun foo-focus-new-frame (frame)
(select-frame-set-input-focus (frame)))
(add-hook 'after-make-frame-functions 'foo-focus-new-frame t)
This works fine when I run emacs directly from the command line. However, if emacs is not started and I try and run the following:
emacsclient -c -a '' test.txt
I get the following error:
*ERROR*: Symbol's function definition is void: frame
Why is this? According to the documentation the after-make-frame-functions
hook should only be run after a frame is newly created, so why can't my function find it?
The frame
function doesn't exist, perhaps you intended to access the parameter instead of calling a function, i.e. you have extraneous parentheses in foo-focus-new-frame
:
(defun foo-focus-new-frame (frame)
(select-frame-set-input-focus frame))