diff options
| author | Constantin Kulikov <zxnotdead@gmail.com> | 2012-12-24 18:49:19 +0100 |
|---|---|---|
| committer | Martin Rudalics <rudalics@gmx.at> | 2012-12-24 18:49:19 +0100 |
| commit | dc646358274fbfdab6ef3dfb7717bc4a52f607f3 (patch) | |
| tree | 71e4f0d5881561ae18ee4a856ba8a2dd9d84f3a0 /lisp/server.el | |
| parent | c1860cdc02404d84e7f29d206b799031190a794e (diff) | |
| download | emacs-dc646358274fbfdab6ef3dfb7717bc4a52f607f3.tar.gz | |
Allow function as value of initial-buffer-choice (Bug#13251).
* startup.el (initial-buffer-choice): Allow function as value
(Bug#13251).
(command-line-1): Handle case where initial-buffer-choice
specifies a function.
* server.el (server-execute): Handle case where
initial-buffer-choice specifies a function.
Diffstat (limited to 'lisp/server.el')
| -rw-r--r-- | lisp/server.el | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/server.el b/lisp/server.el index c78e3e376aa..59f75722ccb 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1256,12 +1256,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 |
