From: Constantin Kulikov <zxnotdead@gmail.com>
To: martin rudalics <rudalics@gmx.at>
Cc: 13251@debbugs.gnu.org
Subject: bug#13251: Wishlist: Add ability to set initial buffer for new frames.
Date: Sat, 22 Dec 2012 22:51:25 +0300 [thread overview]
Message-ID: <CAFkz2yo+ABdid_hDOas84bb6dkiSAUMw-qZC7Ko97ADUic=yww@mail.gmail.com> (raw)
In-Reply-To: <50D5D4DD.5020905@gmx.at>
[-- Attachment #1.1: Type: text/plain, Size: 1269 bytes --]
Thanks for the tips.
2012/12/22 martin rudalics <rudalics@gmx.at>
> > (defcustom initial-buffer-choice nil
> > "Buffer to show after starting Emacs.
> > If the value is nil and `inhibit-startup-screen' is nil, show the
> > startup screen. If the value is a string, visit the specified file
> > or directory using `find-file'. If t, open the `*scratch*'
> > buffer. If function, switch to a buffer returned by this function.
>
> As for the last sentence I'd prefer "If it is a function, switch to the
> buffer returned by that function."
>
> > A string value also causes emacsclient to open the specified file
> > or directory when no target file is specified."
> > :type '(choice
> > (const :tag "Startup screen" nil)
> > (directory :tag "Directory" :value "~/")
> > (file :tag "File" :value "~/.emacs")
> > (function :tag "Function")
> > (const :tag "Lisp scratch buffer" t))
> > :version "23.1"
>
> Too late for "23.1" use "24.4" instead.
>
> > :group 'initialization)
> >
> > This code allows setting `initial-buffer-choice' to a function returning
> > needed buffer.
>
> Could you please send us a patch based on these remarks (including the
> change you sketched in your second mail)?
>
> Thanks, martin
>
[-- Attachment #1.2: Type: text/html, Size: 1913 bytes --]
[-- Attachment #2: initial-buffer-choice-as-function.patch --]
[-- Type: application/octet-stream, Size: 1918 bytes --]
=== modified file 'lisp/server.el'
--- lisp/server.el 2012-11-09 06:28:27 +0000
+++ lisp/server.el 2012-12-22 19:36:57 +0000
@@ -1256,12 +1256,18 @@
(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)
+ (switch-to-buffer
+ (get-buffer-create
+ (cond
+ ((stringp initial-buffer-choice)
+ (find-file-noselect initial-buffer-choice))
+ ((functionp initial-buffer-choice)
+ (funcall initial-buffer-choice))
+ (t "*scratch*")))
+ 'norecord))
;; Delete the client if necessary.
(cond
=== modified file 'lisp/startup.el'
--- lisp/startup.el 2012-12-01 02:08:30 +0000
+++ lisp/startup.el 2012-12-22 19:35:08 +0000
@@ -43,7 +43,7 @@
If the value is nil and `inhibit-startup-screen' is nil, show the
startup screen. If the value is a string, visit the specified file
or directory using `find-file'. If t, open the `*scratch*'
-buffer.
+buffer. If function, witch to a buffer returned by this function.
A string value also causes emacsclient to open the specified file
or directory when no target file is specified."
@@ -51,8 +51,9 @@
(const :tag "Startup screen" nil)
(directory :tag "Directory" :value "~/")
(file :tag "File" :value "~/.emacs")
+ (function :tag "Function")
(const :tag "Lisp scratch buffer" t))
- :version "23.1"
+ :version "24.4"
:group 'initialization)
(defcustom inhibit-startup-screen nil
next prev parent reply other threads:[~2012-12-22 19:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-21 21:16 bug#13251: Wishlist: Add ability to set initial buffer for new frames Constantin Kulikov
2012-12-21 21:30 ` Constantin Kulikov
2012-12-22 15:42 ` martin rudalics
2012-12-22 19:51 ` Constantin Kulikov [this message]
2012-12-22 20:18 ` Constantin Kulikov
2012-12-23 10:14 ` martin rudalics
[not found] ` <CAFkz2yrdFMbXSCknkhQZTmbMsYBWCAO9uOayun6BZT_LJdhrjw@mail.gmail.com>
2012-12-23 17:04 ` bug#13251: Fwd: " Constantin Kulikov
2012-12-24 18:05 ` martin rudalics
2012-12-24 19:37 ` Constantin Kulikov
2013-01-02 8:03 ` martin rudalics
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFkz2yo+ABdid_hDOas84bb6dkiSAUMw-qZC7Ko97ADUic=yww@mail.gmail.com' \
--to=zxnotdead@gmail.com \
--cc=13251@debbugs.gnu.org \
--cc=rudalics@gmx.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).