Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs hook for new frames

Tags:

emacs

window

I need a command to run whenever a new frame is created in Emacs. So far I've been using after-make-frame-functions, but this hook only gets called on frames created by make-frame. I actually need something that runs whenever the emacsclient -c command creates a new window.

Is there a way to achieve that?

like image 850
Malabarba Avatar asked Apr 23 '12 15:04

Malabarba


1 Answers

I'm having some difficulty understanding your question. The Emacs server calls make-frame when it needs to create a new frame, so after-make-frame-functions should work in that case too. So what's your actual problem?

Is it that you want your function to run even if the Emacs server doesn't create a new frame? If so, try adding your function to server-switch-hook as well as after-make-frame-functions.

server-switch-hook is a variable defined in server.el.

Documentation: Hook run when switching to a buffer for the Emacs server.

like image 131
Gareth Rees Avatar answered Oct 30 '22 10:10

Gareth Rees