[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Replace inhibit-startup-buffer-menu

From: Andrew Burgess
Subject: [PATCH] Replace inhibit-startup-buffer-menu
Date: Mon, 6 Oct 2014 20:50:21 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

When opening multiple file from the command line emacs uses
`list-buffers' to display a list of buffers.  This is fine, except
that I normally use an alternative package for displaying a buffer
list, it would be nice if I could use something other than
`list-buffers' for this initial buffer list.

The patch below makes inhibit-startup-buffer-menu obsolete, and
introduces startup-buffer-menu-function.  This new variable is by
default `list-buffers', and so the current behaviour is maintained.

Setting startup-buffer-menu-function to nil turns off the buffer list,
or it can be set to a function, the intention being that the function
should display the buffer list.

I'm could probably achieve the same result by using
inhibit-startup-buffer-menu and emacs-startup-hook, but this felt like
a neater, more obvious solution.

All feedback welcome,



2014-10-06  Andrew Burgess  <address@hidden>

        * startup.el (inhibit-startup-buffer-menu): Make obsolete.
        (startup-buffer-menu-function): New user-option.
        (command-line-1): When startup-buffer-menu-function is a function
        call it to display the buffer list.


  [ In the section "* Startup Changes in Emacs 24.4" ]

** The user option `inhibit-startup-buffer-menu' is now obsolete,
instead use the new `startup-buffer-menu-function'.

** New user option `startup-buffer-menu-function', setting this to nil
turns off the initial buffer menu, alternatively, set this to a
function that will display the buffer list.

=== modified file 'lisp/startup.el'
*** lisp/startup.el     2014-08-29 22:13:43 +0000
--- lisp/startup.el     2014-10-06 19:16:18 +0000
*************** startup message unless he personally act
*** 99,104 ****
--- 99,117 ----
    :type 'boolean
    :group 'initialization)
+ (defcustom startup-buffer-menu-function 'list-buffers
+   "Function to display buffer list when more than 2 files are loaded.
+ Setting this to nil will turn off the buffer list when 2 or more
+ files are loaded, otherwise set this to a function that will
+ display the buffer list."
+   :type '(choice
+           (const    :tag "No buffer list" nil)
+           (function :tag "List function"))
+   :group 'initialization)
+ (make-obsolete-variable 'inhibit-startup-buffer-menu
+                         'startup-buffer-menu-function "24.3")
  (defvar command-switch-alist nil
    "Alist of command-line switches.
  Elements look like (SWITCH-STRING . HANDLER-FUNCTION).
*************** A fancy display is used on graphic displ
*** 2433,2440 ****
        (and (> file-count 2)
             (not noninteractive)
             (not inhibit-startup-buffer-menu)
             (or (get-buffer-window first-file-buffer)
!                (list-buffers)))
        ;; Display a startup screen, after some preparations.
--- 2446,2455 ----
        (and (> file-count 2)
             (not noninteractive)
             (not inhibit-startup-buffer-menu)
+            startup-buffer-menu-function
+            (functionp startup-buffer-menu-function)
             (or (get-buffer-window first-file-buffer)
!                (funcall startup-buffer-menu-function)))
        ;; Display a startup screen, after some preparations.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]