unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Emilio Lopes <eclig@gmx.net>
Subject: Patch to cmuscheme: start file for Scheme processes
Date: Sun, 24 Jul 2005 14:29:21 +0200	[thread overview]
Message-ID: <6hu0ik8k0u.fsf@tiscali.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 805 bytes --]

The package "comint", upon which "cmuscheme" is based, provides a
mechanism for sending commands stored in a file to the underlying
process on start-up.  Cmuscheme does not currently make use of this
mechanism, although this could be useful for Scheme interpreters that
do not provide such a functionality themselves or for providing Emacs
specific customizations.

With the following patch cmuscheme instructs comint to use such a
start file if it's present on the file system.  The name of the start
file depends on the interpreter used, so that interpreter specific
customizations are possible.


2005-06-12  Emilio C. Lopes  <eclig@gmx.net>

        * cmuscheme.el (run-scheme): get start file from `scheme-start-file'
        and pass it to `make-comint'.
        (scheme-start-file): new function.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: cmuscheme-startfile.patch --]
[-- Type: text/x-patch, Size: 1995 bytes --]

--- orig/lisp/cmuscheme.el
+++ mod/lisp/cmuscheme.el
@@ -233,11 +233,15 @@
 
 ;;;###autoload
 (defun run-scheme (cmd)
-  "Run an inferior Scheme process, input and output via buffer *scheme*.
+  "Run an inferior Scheme process, input and output via buffer `*scheme*'.
 If there is a process already running in `*scheme*', switch to that buffer.
 With argument, allows you to edit the command line (default is value
-of `scheme-program-name').  Runs the hooks `inferior-scheme-mode-hook'
-\(after the `comint-mode-hook' is run).
+of `scheme-program-name').
+If a file `~/.emacs_SCHEMENAME' exists, it is given as initial input.
+Note that this may lose due to a timing error if the Scheme processor
+discards input when it starts up.
+Runs the hook `inferior-scheme-mode-hook' \(after the `comint-mode-hook'
+is run).
 \(Type \\[describe-mode] in the process buffer for a list of commands.)"
 
   (interactive (list (if current-prefix-arg
@@ -246,13 +250,24 @@
   (if (not (comint-check-proc "*scheme*"))
       (let ((cmdlist (scheme-args-to-list cmd)))
 	(set-buffer (apply 'make-comint "scheme" (car cmdlist)
-			   nil (cdr cmdlist)))
+			   (scheme-start-file (car cmdlist)) (cdr cmdlist)))
 	(inferior-scheme-mode)))
   (setq scheme-program-name cmd)
   (setq scheme-buffer "*scheme*")
   (pop-to-buffer "*scheme*"))
 ;;;###autoload (add-hook 'same-window-buffer-names "*scheme*")
 
+(defun scheme-start-file (prog)
+  "Return the name of the start file corresponding to PROG.
+Search in the directories \"~\" and \"~/.emacs.d\", in this
+order.  Return nil if no start file found."
+  (let* ((name (concat ".emacs_" (file-name-nondirectory prog)))
+         (start-file (concat "~/" name)))
+    (if (file-exists-p start-file)
+        start-file
+      (let ((start-file (concat user-emacs-directory name)))
+        (and (file-exists-p start-file) start-file)))))
+
 (defun scheme-send-region (start end)
   "Send the current region to the inferior Scheme process."
   (interactive "r")

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

                 reply	other threads:[~2005-07-24 12:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6hu0ik8k0u.fsf@tiscali.de \
    --to=eclig@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).