X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/d8fb8cce84b923a3289b69549e30958710ac3ebb..0877d0dc24ee792b9b14592869ea1aa0934aee58:/lisp/server.el diff --git a/lisp/server.el b/lisp/server.el index 4a87157609..03d4bfc33d 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1257,12 +1257,17 @@ The following commands are accepted by the client: (mapc 'funcall (nreverse commands)) ;; 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))) + ;; `initial-buffer-choice' if it specifies a file + ;; or a function. + (unless (or files commands) + (let ((buf + (cond ((stringp initial-buffer-choice) + (find-file-noselect initial-buffer-choice)) + ((functionp initial-buffer-choice) + (funcall initial-buffer-choice))))) + (switch-to-buffer + (if (buffer-live-p buf) buf (get-buffer-create "*scratch*")) + 'norecord))) ;; Delete the client if necessary. (cond