LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-30-2005, 11:22 PM   #1
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Rep: Reputation: 30
.emacs file and Scheme buffers


I'm taking a class that assumes you have emacs set up to have a Scheme interpreter running in a buffer in the background, so I have the following in my .emacs file:

Code:
(require 'cmuscheme)
(load "cmuscheme")
(setq scheme-program-name "stk")

(define-key scheme-mode-map "\r" 'newline-and-indent)

(defun run-stk () "
     Remove the *scheme* buffer unless it is running Stk.  If there is no
     *scheme* buffer running Stk, create one.  Switch to the *scheme* buffer."
     (interactive)
     (set-buffer (get-buffer-create "*scheme*"))
     (let ((proc (get-buffer-process "*scheme*")))
       (if (and proc (not (string-match
                           "stk$" (car (process-command proc)))))
           (progn
             (set-process-buffer proc nil)
             (kill-process proc))))
    (run-scheme "stk-simply"))

(defun run-half-scheme () "
     Run Scheme in half a window."
     (interactive)
     (split-window-vertically nil)
     (other-window 1)
     (call-interactively 'run-scheme))
(run-stk)

(global-set-key "\M-s"  'run-half-scheme)

(defun scheme-load-file-and-go (file-name)
  "Load Scheme file FILE-NAME into the inferior Scheme process and then go to Scheme buffer."
  (interactive (comint-get-source "Load Scheme file: " scheme-prev-l/c-dir/file scheme-source-modes t))
  (scheme-load-file file-name)
  (split-window-vertically nil)
  (other-window 1)
  (switch-to-scheme t))

(define-key (lookup-key scheme-mode-map [menu-bar scheme])
            [scheme-load-file-and-go] '("Send Scheme File & Go" . scheme-load-file-and-go))
(global-unset-key "\C-r")
(define-key scheme-mode-map "\C-r" 'scheme-load-file-and-go)
This is probably excessively messy and redundant, but it does almost what I want it to and I don't really understand Lisp well enough at this point to see how everything works. There's a couple of things that would be handy to change, so I thought I'd ask here and see if anyone has any ideas.

1. With it set up as it currently is, I can work on a file, hit Ctrl-r, a half-window will pop up with the interpreter. However, if I then switch back to my original buffer without closing the other, fix something, and do Ctrl-r again, I get a quarter-window with another interpreter. Is there a way to check and see what the current status is and only open an additional window if none is already open? (In other words, if you are working on a file taking up the whole screen, it will open an interpreter in a half-window, but if you're working on a file with a half-interpreter already open, then it will simply load that file into the already running and open buffer). If this is too specific of a question to ask in a general forum like this, does anyone know where I could look to figure out how to do this?

2. With the interpreter running in the background, every time I close emacs, I get the message:

Code:
Active processes exist; kill them and exit anyway? (yes or no)
Is there a way to either automatically answer yes to this and not display the message or have Ctrl-x c switch to the Scheme buffer and run "(exit)" (killing it the right way) before closing emacs?

Thanks in advance.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Emacs, scheme, syntax highlighting, indenting jrdioko Linux - Software 0 07-16-2005 04:13 PM
emacs not responding to .emacs file in Mandriva 2005 LE. Please help LaptopLinux Mandriva 1 06-08-2005 08:36 AM
scheme in emacs dimsun Linux - Newbie 1 11-06-2004 09:00 AM
running scheme through emacs phoeniks Linux - Software 5 10-18-2004 12:12 AM
edb (emacs database) won't open file - emacs 20 & 21 tip184 Linux - Software 0 04-03-2004 07:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration