[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r111321: Allow function as value of i
From: |
martin rudalics |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r111321: Allow function as value of initial-buffer-choice (Bug#13251). |
Date: |
Mon, 24 Dec 2012 18:49:19 +0100 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111321
author: =Constantin Kulikov <address@hidden>
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Mon 2012-12-24 18:49:19 +0100
message:
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.
modified:
etc/NEWS
lisp/ChangeLog
lisp/server.el
lisp/startup.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS 2012-12-20 14:03:34 +0000
+++ b/etc/NEWS 2012-12-24 17:49:19 +0000
@@ -39,6 +39,9 @@
This unfinished feature was introduced by accident in Emacs 23.1;
simply disabling Transient Mark mode does the same thing.
+** `initial-buffer-choice' can now specify a function to set up the
+initial buffer.
+
** ACL support has been added.
+++
*** Emacs preserves the ACL entries of files when backing up.
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-12-24 12:14:04 +0000
+++ b/lisp/ChangeLog 2012-12-24 17:49:19 +0000
@@ -1,3 +1,12 @@
+2012-12-24 Constantin Kulikov <address@hidden> (tiny change)
+
+ * 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.
+
2012-12-24 Lars Ingebrigtsen <address@hidden>
* mail/smtpmail.el (smtpmail-try-auth-method): Refactored out into
=== modified file 'lisp/server.el'
--- a/lisp/server.el 2012-11-09 06:28:27 +0000
+++ b/lisp/server.el 2012-12-24 17:49:19 +0000
@@ -1256,12 +1256,17 @@
(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
=== modified file 'lisp/startup.el'
--- a/lisp/startup.el 2012-12-01 02:08:30 +0000
+++ b/lisp/startup.el 2012-12-24 17:49:19 +0000
@@ -41,9 +41,10 @@
(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.
+startup screen. If the value is a string, switch to a buffer
+visiting the file or directory specified by that string. If the
+value is a function, switch to the buffer returned by that
+function. If t, open the `*scratch*' buffer.
A string value also causes emacsclient to open the specified file
or directory when no target file is specified."
@@ -51,8 +52,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
@@ -2323,10 +2325,14 @@
(set-buffer-modified-p nil))))
(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))))
+ (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)))
(if (or inhibit-startup-screen
initial-buffer-choice
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r111321: Allow function as value of initial-buffer-choice (Bug#13251).,
martin rudalics <=