[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: renewable scratch pad
From: |
Kevin Rodgers |
Subject: |
Re: renewable scratch pad |
Date: |
Mon, 21 Jun 2004 14:39:26 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 |
Joe Corneli wrote:
> This would make the function behave more like M-x shell: the scratch
> buffer would always have lisp interaction mode enforced. A more
> advanced version might allow the user to change the mode in the
> scratch buffer, and have that mode preserved when accessing the
> buffer using this function. Not sure about how best to do that, so
> this is where I'll leave it for now.
Simple, just don't call the mode function if the buffer already exists;
also, you should respect initial-major-mode:
(defun scratch ()
"Select the `*scratch*' buffer."
(interactive)
(let ((buffer (get-buffer "*scratch*")))
(pop-to-buffer (or buffer (generate-new-buffer "*scratch*")))
(or buffer (funcall initial-major-mode))
buffer))
--
Kevin Rodgers