unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: emacs-devel@gnu.org
Subject: [PATCH] Replace inhibit-startup-buffer-menu
Date: Mon, 6 Oct 2014 20:50:21 +0100	[thread overview]
Message-ID: <20141006195021.GA6395@embecosm.com> (raw)

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,

thanks,
Andrew

lisp/ChangeLog:

2014-10-06  Andrew Burgess  <andrew.burgess@embecosm.com>

	* 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.

etc/NEWS:

  [ 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	other threads:[~2014-10-06 19:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-06 19:50 Andrew Burgess [this message]
2014-10-06 20:29 ` [PATCH] Replace inhibit-startup-buffer-menu Stefan Monnier

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=20141006195021.GA6395@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=emacs-devel@gnu.org \
    /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).