From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emilio Lopes Newsgroups: gmane.emacs.devel Subject: Patch to cmuscheme: start file for Scheme processes Date: Sun, 24 Jul 2005 14:29:21 +0200 Organization: private Message-ID: <6hu0ik8k0u.fsf@tiscali.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1122215674 17844 80.91.229.2 (24 Jul 2005 14:34:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 24 Jul 2005 14:34:34 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 24 16:34:34 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DwhYY-0007YE-Tf for ged-emacs-devel@m.gmane.org; Sun, 24 Jul 2005 16:34:19 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dwhan-0006gO-RG for ged-emacs-devel@m.gmane.org; Sun, 24 Jul 2005 10:36:37 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DwhZW-0006EA-B4 for emacs-devel@gnu.org; Sun, 24 Jul 2005 10:35:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DwhWE-0005Pp-Le for emacs-devel@gnu.org; Sun, 24 Jul 2005 10:32:06 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DwhWA-0005Fe-SW for emacs-devel@gnu.org; Sun, 24 Jul 2005 10:31:50 -0400 Original-Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.34) id 1DwhMy-0007p6-7s for emacs-devel@gnu.org; Sun, 24 Jul 2005 10:22:20 -0400 Original-Received: (qmail invoked by alias); 24 Jul 2005 14:11:38 -0000 Original-Received: from p62.246.22.81.tisdip.tiscali.de (EHLO jumeirah.tiscali.de) [62.246.22.81] by mail.gmx.net (mp027) with SMTP; 24 Jul 2005 16:11:38 +0200 X-Authenticated: #3737989 Original-To: emacs-devel@gnu.org User-Agent: Emacs Gnus X-Y-GMX-Trusted: 0 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:41181 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:41181 --=-=-= 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 * cmuscheme.el (run-scheme): get start file from `scheme-start-file' and pass it to `make-comint'. (scheme-start-file): new function. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=cmuscheme-startfile.patch --- 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") --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --=-=-=--