[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: 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."
  (let ((buffer (get-buffer "*scratch*")))
    (pop-to-buffer (or buffer (generate-new-buffer "*scratch*")))
    (or buffer (funcall initial-major-mode))

Kevin Rodgers

reply via email to

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