From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "rgb" Newsgroups: gmane.emacs.help Subject: Re: Newbie major-mode and elisp question Date: 8 Sep 2005 09:21:55 -0700 Organization: http://groups.google.com Message-ID: <1126196515.790157.238520@g49g2000cwa.googlegroups.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1126197045 11019 80.91.229.2 (8 Sep 2005 16:30:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 8 Sep 2005 16:30:45 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Sep 08 18:30:40 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EDPEi-0003Eg-GM for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Sep 2005 18:26:52 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EDPEh-00018n-Oy for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Sep 2005 12:26:51 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!g49g2000cwa.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 33 Original-NNTP-Posting-Host: 198.74.20.73 Original-X-Trace: posting.google.com 1126196520 29984 127.0.0.1 (8 Sep 2005 16:22:00 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 8 Sep 2005 16:22:00 +0000 (UTC) User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: g49g2000cwa.googlegroups.com; posting-host=198.74.20.73; posting-account=C7LM4w0AAAD23IRuMuUUJVCLQTuHhTK8 Original-Xref: shelby.stanford.edu gnu.emacs.help:133787 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:29334 Archived-At: 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)