From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Emilio Lopes Newsgroups: gmane.emacs.devel Subject: user-friendly improvements to the cmuscheme library Date: Thu, 06 Jan 2005 19:54:43 +0100 Organization: private Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1105037697 20800 80.91.229.6 (6 Jan 2005 18:54:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 6 Jan 2005 18:54:57 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 06 19:54:43 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CmcmR-0001Xm-00 for ; Thu, 06 Jan 2005 19:54:43 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Cmcxk-0000ku-79 for ged-emacs-devel@m.gmane.org; Thu, 06 Jan 2005 14:06:24 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1Cmcxb-0000k8-HT for emacs-devel@gnu.org; Thu, 06 Jan 2005 14:06:15 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1Cmcxa-0000jW-CF for emacs-devel@gnu.org; Thu, 06 Jan 2005 14:06:14 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Cmcxa-0000jE-6C for emacs-devel@gnu.org; Thu, 06 Jan 2005 14:06:14 -0500 Original-Received: from [62.26.116.129] (helo=webmail.tiscali.de) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Cmclq-0007Pp-Qe for emacs-devel@gnu.org; Thu, 06 Jan 2005 13:54:07 -0500 Original-Received: from jumeirah.tiscali.de (62.246.15.245) by webmail.tiscali.de (7.0.036.1) id 41B8BE350010645D for emacs-devel@gnu.org; Thu, 6 Jan 2005 19:54:04 +0100 Original-To: emacs-devel@gnu.org Mail-Followup-To: emacs-devel@gnu.org, eclig@gmx.net User-Agent: Emacs Gnus 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: main.gmane.org gmane.emacs.devel:31963 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:31963 --=-=-= The attached patch to "cmuscheme.el" makes editing of Scheme files, as I see, more user friendly. The first change introduces an user option to control whether the Scheme process buffer should be automatically displayed upon evaluation of Scheme code by the user, thus making the results of the evaluation visible. The default value of this option is `nil', so that the current behavior is preserved. The second set of changes offers the user to start a Scheme interpreter if she tries to evaluates Scheme code without having started an interpreter before. Right now Emacs just raises an error in this case. 2005-01-06 Emilio C. Lopes * cmuscheme.el (scheme-display-buffer-on-eval): new user option. (scheme-send-region): display process buffer, if desired. (scheme-display-process-buffer): new function. (switch-to-scheme): start new scheme process, if none found. (scheme-proc): dito. (scheme-get-process): new function. (scheme-interactively-start-process): new function. --=-=-= Content-Disposition: attachment; filename=cmuscheme.diff Content-Description: diffs to cmuscheme Index: lisp/cmuscheme.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/cmuscheme.el,v retrieving revision 1.36 diff -u -c -r1.36 cmuscheme.el *** lisp/cmuscheme.el 19 Sep 2004 02:14:14 -0000 1.36 --- lisp/cmuscheme.el 6 Jan 2005 17:58:23 -0000 *************** *** 109,114 **** --- 109,118 ---- :type 'hook :group 'cmuscheme) + (defcustom scheme-display-buffer-on-eval nil + "*Non nil means display the Scheme process buffer when evaluating code." + :group 'scheme :type 'boolean) + (defvar inferior-scheme-mode-map (let ((m (make-sparse-keymap))) (define-key m "\M-\C-x" 'scheme-send-definition) ;gnu convention *************** *** 257,263 **** "Send the current region to the inferior Scheme process." (interactive "r") (comint-send-region (scheme-proc) start end) ! (comint-send-string (scheme-proc) "\n")) (defun scheme-send-definition () "Send the current definition to the inferior Scheme process." --- 261,277 ---- "Send the current region to the inferior Scheme process." (interactive "r") (comint-send-region (scheme-proc) start end) ! (comint-send-string (scheme-proc) "\n") ! (when scheme-display-buffer-on-eval ! (scheme-display-process-buffer))) ! ! (defun scheme-display-process-buffer () ! "Display the Scheme process buffer. ! This function ignores `same-window-buffer-names'." ! (let ((same-window-buffer-names nil)) ! (display-buffer scheme-buffer) ! (set-window-point (get-buffer-window scheme-buffer) ! (process-mark (scheme-proc))))) (defun scheme-send-definition () "Send the current definition to the inferior Scheme process." *************** *** 300,311 **** "Switch to the scheme process buffer. With argument, position cursor at end of buffer." (interactive "P") ! (if (get-buffer scheme-buffer) (pop-to-buffer scheme-buffer) ! (error "No current process buffer. See variable `scheme-buffer'")) ! (cond (eob-p ! (push-mark) ! (goto-char (point-max))))) (defun scheme-send-region-and-go (start end) "Send the current region to the inferior Scheme process. --- 314,326 ---- "Switch to the scheme process buffer. With argument, position cursor at end of buffer." (interactive "P") ! (if (or (get-buffer scheme-buffer) ! (scheme-interactively-start-process)) (pop-to-buffer scheme-buffer) ! (error "No current process buffer. See variable `scheme-buffer'")) ! (when eob-p ! (push-mark) ! (goto-char (point-max)))) (defun scheme-send-region-and-go (start end) "Send the current region to the inferior Scheme process. *************** *** 417,429 **** for a minimal, simple implementation. Feel free to extend it.") (defun scheme-proc () ! "Return the current scheme process. See variable `scheme-buffer'." ! (let ((proc (get-buffer-process (if (eq major-mode 'inferior-scheme-mode) ! (current-buffer) ! scheme-buffer)))) ! (or proc ! (error "No current process. See variable `scheme-buffer'")))) ! ;;; Do the user's customisation... --- 432,456 ---- for a minimal, simple implementation. Feel free to extend it.") (defun scheme-proc () ! "Return the current Scheme process, starting one if necessary. ! See the variable `scheme-buffer' for details." ! (or (scheme-get-process) ! (scheme-interactively-start-process) ! (error "No current process. See variable `scheme-buffer'"))) ! ! (defun scheme-get-process () ! "Return the current Scheme process or nil if none is running." ! (get-buffer-process (if (eq major-mode 'inferior-scheme-mode) ! (current-buffer) ! scheme-buffer))) ! ! (defun scheme-interactively-start-process (&optional cmd) ! "Start an inferior Scheme process. Return the process started. ! Since this command is run implicitly, always ask the user for the ! command to run." ! (save-window-excursion ! (run-scheme (read-string "Run Scheme: " scheme-program-name))) ! (scheme-get-process)) ;;; Do the user's customisation... --=-=-= 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 --=-=-=--