I discribed my problem here: http://comments.gmane.org/gmane.emacs.help/88218 .short:
> when you run 'emacsclient -c' the new frame created and window in that frame is switched to
> *scratch* buffer or file with name that is set in `initial-buffer-choice'.So, I can set `initial-buffer-choice' in the `after-make-frame-functions' to switch to buffer other than *scratch* on frame creation, but can't set somehow to buffer without underlying file.
I found place where this behaviour handled(server.el:1258):
;; If we were told only to open a new client, obey
;; `initial-buffer-choice' if it specifies a file.
(unless (or files commands)
(if (stringp initial-buffer-choice)
(find-file initial-buffer-choice)
(switch-to-buffer (get-buffer-create "*scratch*")
'norecord)))Changed it to this:
(unless (or files commands)
(typecase initial-buffer-choice
(string (find-file initial-buffer-choice))
(buffer (switch-to-buffer initial-buffer-choice 'norecord))
(t (switch-to-buffer (get-buffer-create "*scratch*")
'norecord)))then emacsclient -c it create frame and after short time destroys it with error:
"*ERROR*: Wrong type argument: stringp, #<buffer *scratch*>"ok. I grepped sources, find startup.el:2325 :
(when initial-buffer-choice
(cond ((eq initial-buffer-choice t)
(switch-to-buffer (get-buffer-create "*scratch*")))
((stringp initial-buffer-choice)
(find-file initial-buffer-choice))))replaced it to:
(when initial-buffer-choice
(typecase initial-buffer-choice
(symbol (when (eq initial-buffer-choice t)
(switch-to-buffer (get-buffer-create "*scratch*"))))
(string (find-file initial-buffer-choice))
(buffer (switch-to-buffer initial-buffer-choice))))But still get same error:
"*ERROR*: Wrong type argument: stringp, #<buffer *scratch*>"Any suggestions?