Whenever I use emacsclient
, I tend to use it without a file argument. This is because my emacs file finder is generally better than my shell file finder.
Unfortunately, when emacsclient
is not given a file argument, neither server-visit-hook
nor server-switch-hook
are fired, and I'm left without crucial bits of server setup.
How can I work around this limitation?
EDIT: Added example code.
(let ((my/evil-mode-line-face-cookies nil))
(defun my/evil-set-mode-line-face (&rest args)
(cl-destructuring-bind (bg-color fg-color)
(pcase evil-state
(`normal '("white" "blue"))
(`emacs '("white" "green"))
(`insert '("black" "grey"))
(`visual '("white" "cyan"))
(`replace '("white" "red"))
(other '("grey" "black")))
(mapc #'face-remap-remove-relative my/evil-mode-line-face-cookies)
(setq my/evil-mode-line-face-cookies
(list (face-remap-add-relative
'mode-line
mode-line
`((:foreground ,fg-color :background ,bg-color)
mode-line))
(face-remap-add-relative
'mode-line-buffer-id
mode-line-buffer-id
`((:foreground ,fg-color)
mode-line-buffer-id)))))))
(add-hook 'post-command-hook #'my/evil-set-mode-line-face)
(add-hook 'after-make-frame-functions #'my/evil-set-mode-line-face)
dired
as your file finder, then you could simply pass the directory as your argument. – suvayu Sep 9 '15 at 8:50xterm-mouse-mode
, which are specific to the current frame. I also set some faces depending on the current display's color capabilities. – PythonNut Sep 9 '15 at 17:36before-make-frame-hook
orafter-make-frame-functions
. Then you would have the advantage of your customisations working also in a normal session. – suvayu Sep 9 '15 at 19:51