diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-05-03 18:08:14 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2022-05-03 18:09:01 -0700 |
commit | f2d2fe6fc8ef0b6087c4a8a69d05a4e521b23047 (patch) | |
tree | 3e9fdb9da8fa36ccde6f739de3427a87a90c645f /lisp/server.el | |
parent | 185c2f1904c457ad043fe28cca915f508569c54a (diff) | |
download | emacs-f2d2fe6fc8ef0b6087c4a8a69d05a4e521b23047.tar.gz |
server-execute: Initialize the *scratch* buffer
* lisp/server.el: Require subr-x when compiling.
(server-execute): Initialize the *scratch* buffer in the same way that
the scratch-buffer command does, for consistency.
Diffstat (limited to 'lisp/server.el')
-rw-r--r-- | lisp/server.el | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lisp/server.el b/lisp/server.el index 763cf27f7ac..fc6991df5f1 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -82,7 +82,9 @@ ;;; Code: -(eval-when-compile (require 'cl-lib)) +(eval-when-compile + (require 'cl-lib) + (require 'subr-x)) (defgroup server nil "Emacs running as a server process." @@ -1366,9 +1368,14 @@ The following commands are accepted by the client: (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))) + (if (buffer-live-p buf) + (switch-to-buffer buf 'norecord) + (if-let ((scratch (get-buffer "*scratch*"))) + (switch-to-buffer scratch 'norecord) + (switch-to-buffer (get-buffer-create "*scratch*") 'norecord) + (when initial-scratch-message + (insert initial-scratch-message)) + (funcall initial-major-mode))))) ;; Delete the client if necessary. (cond |