[gnu.emacs] different default for insert-buffer

lynn@rave.phx.mcd.mot.com (Lynn D. Newton) (05/17/89)

I'm using GNU Emacs 18.54.

When I execute insert-buffer, the prompt "Insert buffer: (default ...)"
asks me for the current buffer. This seems like a strange
default. Why would I want to duplicate the current buffer?
Usually I want to insert _another_ buffer, frequently the last
one I visited. Is there some variable out there I can set to
change the default, especially one that knows which buffer I was
in last?

--
=================================================================
Lynn D. Newton		  | System Test
Motorola MCD, Tempe, AZ	  | (Department of Heuristic Methodology)
(602) 437-3739		  | "The bug stops here!"
lynn@rave.phx.mcd.mot.com |

jr@bbn.com (John Robinson) (05/19/89)

In article <LYNN.89May17090558@rave.rave.phx.mcd.mot.com>, lynn@rave (Lynn D. Newton) writes:
>I'm using GNU Emacs 18.54.
>
>When I execute insert-buffer, the prompt "Insert buffer: (default ...)"
>asks me for the current buffer. This seems like a strange
>default. Why would I want to duplicate the current buffer?
>Usually I want to insert _another_ buffer, frequently the last
>one I visited. Is there some variable out there I can set to
>change the default, especially one that knows which buffer I was
>in last?

This same thing has been annoying me lately.  Mayne this is motivation
to fix it.

In the definition of insert-buffer (in simple.el), it has the
following:

  (interactive "*bInsert buffer: ")

The b argumnet type says get an emacs buffer, and interactive's
default is the buffer you called the function from.  This is right (I
feel) for kill-buffer, but not insert-buffer.  You have to use the
more elaborate form of interactive:

  (interactive (list (read-buffer "Insert buffer: " (other-buffer) t))

If you prefer a default other than (other-buffer), replace that form.
--
/jr, nee John Robinson	 What a waste it is to lose one's mind--or not
jr@bbn.com or bbn!jr	  to have a mind.  How true that is. -Dan Quayle

mdb@bridge2.3Com.COM (Mark D. Baushke) (05/19/89)

In article <40151@bbn.COM> jr@bbn.com (John Robinson) writes:
>In article <LYNN.89May17090558@rave.rave.phx.mcd.mot.com>,
>lynn@rave (Lynn D. Newton) writes: 
>>When I execute insert-buffer, the prompt "Insert buffer: (default ...)"
>>asks me for the current buffer. This seems like a strange
>>default. Why would I want to duplicate the current buffer?
>
>This same thing has been annoying me lately.  Mayne this is motivation
>to fix it.
>
>In the definition of insert-buffer (in simple.el), it has the
>following:
>
>  (interactive "*bInsert buffer: ")
>
>...  You have to use the more elaborate form of interactive:
>
>  (interactive (list (read-buffer "Insert buffer: " (other-buffer) t))

A simpler alternative to this is to use

  (interactive "*BInsert buffer: ")

which is equivalent to (and more efficient than) the more elaborate form.

The 'B' documentation may not be very clear, but the code does an
(other-buffer) as the default.

Enjoy!
--
Mark D. Baushke
UUCP:	    {3comvax,auspex,sun}!bridge2!mdb
Nameserver: mdb@bridge2.ESD.3Com.COM

J.K.Wight@newcastle.ac.uk (Jim Wight) (05/23/89)

In article <40151@bbn.COM> jr@bbn.com (John Robinson) writes:
>This same thing has been annoying me lately.  Mayne this is motivation
>to fix it.
>
>In the definition of insert-buffer (in simple.el), it has the
>following:
>
>  (interactive "*bInsert buffer: ")
>
>The b argumnet type says get an emacs buffer, and interactive's
>default is the buffer you called the function from.  This is right (I
>feel) for kill-buffer, but not insert-buffer.  You have to use the
>more elaborate form of interactive:
>
>  (interactive (list (read-buffer "Insert buffer: " (other-buffer) t))
>
>If you prefer a default other than (other-buffer), replace that form.

Or, instead of modifying simple.el, how about redefining insert-buffer
in .emacs to use John's suggested prompt and then to pass on the
response to the old insert-buffer's function body, viz.

(make-symbol "ins-buf")
(setq ins-buf (symbol-function 'insert-buffer))
(defun insert-buffer (buffer)
  (interactive (list (read-buffer "Insert buffer: " (other-buffer) t)))
  (funcall ins-buf buffer)
  )

Jim
---
Computing Laboratory	           PHONE : +44 91 222 8238
University of Newcastle upon Tyne  UUCP  : ...!ukc!newcastle.ac.uk!J.K.Wight
Newcastle upon Tyne	           JANET : J.K.Wight@uk.ac.newcastle
UK,  NE1 7RU		           ARPA  : J.K.Wight@newcastle.ac.uk

info-gnu-emacs-request@prep.ai.mit.edu (06/06/89)

From: root@unix.sri.com  (John Robinson)

In article <LYNN.89May17090558@rave.rave.phx.mcd.mot.com>, lynn@rave (Lynn D. Newton) writes:
>I'm using GNU Emacs 18.54.
>
>When I execute insert-buffer, the prompt "Insert buffer: (default ...)"
>asks me for the current buffer. This seems like a strange
>default. Why would I want to duplicate the current buffer?
>Usually I want to insert _another_ buffer, frequently the last
>one I visited. Is there some variable out there I can set to
>change the default, especially one that knows which buffer I was
>in last?

This same thing has been annoying me lately.  Mayne this is motivation
to fix it.

In the definition of insert-buffer (in simple.el), it has the
following:

  (interactive "*bInsert buffer: ")

The b argumnet type says get an emacs buffer, and interactive's
default is the buffer you called the function from.  This is right (I
feel) for kill-buffer, but not insert-buffer.  You have to use the
more elaborate form of interactive:

  (interactive (list (read-buffer "Insert buffer: " (other-buffer) t))

If you prefer a default other than (other-buffer), replace that form.
--
/jr, nee John Robinson	 What a waste it is to lose one's mind--or not
jr@bbn.com or bbn!jr	  to have a mind.  How true that is. -Dan Quayle