> 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,
If so, it should look somewhat similar to inferior-lisp-mode. Or probably even use define-derived-mode directly. > (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. > (progn > ;; Clean up any old nyquist process buffers > (if (get-buffer nyquist-buffer) > (kill-buffer nyquist-buffer)) > (kill-all-local-variables) > (run-lisp nyquist-program) > (switch-to-buffer "*inferior-lisp*") > (rename-buffer nyquist-buffer) > (setq major-mode 'nyquist-mode) > (setq mode-name "Nyquist") > (setq inferior-lisp-buffer nyquist-buffer) > (lisp-load-file nyquist-start-file) > (use-local-map nyquist-map) > (run-hooks 'nyquist-hook) > ))) Go read the Elisp manual, especially the part that talks about the coding conventions to use for a major mode. A major mode should *not* start a process or do a switch-to-buffer. You want to define another function, like `run-nyquist' which may do things like `run-lisp' or `switch-to-buffer' (though I'd recommend against using that and advise to use pop-to-buffer instead) and which will use `nyquist-mode', defined with define-derived-mode. Stefan _______________________________________________ Help-gnu-emacs mailing list Help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs