One of the things I really liked most about emacs23 was it's daemon. In earlier incarnations of emacs I used emacs-server, which was nice, but didnt really do it all. Among other things, if I started one session in X, then I couldn't reach it when I started a client using the -nw flag.
All that changed with emacs23. I could leave my emacs session running at my work computer, with all these buffers, then when I got home I could just ssh in to the machine and start emacs client in a terminal and pick up where I left off in the same buffers.
The problem, I noticed, was that some of my old modifications in my .emacs tree failed to run when I started emacs in the terminal- the gtk toolbar killer for one.
I like my emacs as minimal as possible, so no menu bar, no scroll bars, and definitely no gtk buttons at the top of the screen. Earlier, in pre-emacs23 days, I rarely started emacs in a terminal- I would VNC in instead, to get to my buffers. Now, I found that some configs failed and blocked emacs from running if I started it in the terminal.
So I decided to look around, and found a nice hook which fit the bill- after-make-frame-functions. This variable contains a list of functions which will all be run after a new emacs frame is shown. The functions must take one param- the frame itself. Very nice.
Some of the settings in the hook below don't necessarily have to be in this hook, but I felt that since they all have to do with the new frame, they would fit nicely together there...
(defun setup-frame-hook (frame)
"This function will be applied to all new emacs frames."
(set-frame-parameter frame 'alpha '(95 95)) ; translucency
(mouse-avoidance-mode 'cat-and-mouse) ; avoid mouse
(fringe-mode 5) ; make fringes smaller
(tool-bar-mode 0) ; no toolbar
(menu-bar-mode 0) ; no menubar
(scroll-bar-mode 0) ; no scrollbar
(set-frame-parameter (selected-frame) 'alpha '(95 95)) ; translucency
)
(add-hook 'after-make-frame-functions 'setup-frame-hook)
The last function (add-hook) prepends the function setup-frame-hook to the list.