[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Newbie major-mode and elisp question
From: |
rgb |
Subject: |
Re: Newbie major-mode and elisp question |
Date: |
8 Sep 2005 09:21:55 -0700 |
User-agent: |
G2/0.2 |
sj wrote:
> I'm writing my first major mode to run Nyquist in a buffer. Nyquist is an
> extension of XLISP for audio synthesis and composition. Nyquist-mode is a
> derivative of inferior-lisp mode, its working pretty well except for one
> annoying side effect. Whenever I issue (nyquist-mode) to start a new
> Nyquist process, whatever buffer I'm currently in gets switched to
> fundamental-mode. I have isolated the problem to the
> kill-all-local-variables statement. Is there some other way I should be
> doing this?
>
>
>
> (defun nyquist-mode ()
> (interactive)
> (if (nyquist-has-process-p)
> ;; If we are already live just switch to the nyquist buffer
> (switch-to-buffer nyquist-buffer)
> ;; Else start a new Nyquist process.
a progn isn't necessary here but doesn't hurt anything
> (progn
> ;; Clean up any old nyquist process buffers
> (if (get-buffer nyquist-buffer)
> (kill-buffer nyquist-buffer))
Simply delete this line. It's purpose is to allow a buffer's
mode to be changed without lingering artifacts from the old mode.
Since you are creating a derived mode, the mode from which
nyquist-mode derives is already doing the kill appropriately.
> (kill-all-local-variables)