unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Replace inhibit-startup-buffer-menu
@ 2014-10-06 19:50 Andrew Burgess
  2014-10-06 20:29 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Burgess @ 2014-10-06 19:50 UTC (permalink / raw)
  To: emacs-devel

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.
  




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Replace inhibit-startup-buffer-menu
  2014-10-06 19:50 [PATCH] Replace inhibit-startup-buffer-menu Andrew Burgess
@ 2014-10-06 20:29 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2014-10-06 20:29 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: emacs-devel

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

I'm OK with your suggestion, so if someone wants to commit it, he should
go right ahead.  I'll note, tho, that if you just never use
list-buffers, you might as well do (defalias 'list-buffer
'my-list-buffer), in which case your patch is not needed.


        Stefan



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-06 20:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-06 19:50 [PATCH] Replace inhibit-startup-buffer-menu Andrew Burgess
2014-10-06 20:29 ` Stefan Monnier

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