changeset 70093:da16308f67d1

(tcl-send-string, tcl-send-region): Use forward-line so as to get to BOL even in the presence of fields. (tcl-eval-region): Strip surrounding space to avoid multiple prompts in return. (inferior-tcl): Tell tclsh to work in interactive mode.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 18 Apr 2006 21:16:50 +0000
parents e08e964839f4
children d893c3bf4c3b
files lisp/ChangeLog lisp/progmodes/tcl.el
diffstat 2 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Apr 18 21:16:50 2006 +0000
+++ b/lisp/ChangeLog	Tue Apr 18 21:16:50 2006 +0000
@@ -1,5 +1,11 @@
 2006-04-18  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* progmodes/tcl.el (tcl-send-string, tcl-send-region):
+	Use forward-line so as to get to BOL even in the presence of fields.
+	(tcl-eval-region): Strip surrounding space to avoid multiple prompts
+	in return.
+	(inferior-tcl): Tell tclsh to work in interactive mode.
+
 	* complete.el (partial-completion-mode):
 	Use 'choose-completion-string-functions to make sure that
 	choose-completion fills the minibuffer properly.
--- a/lisp/progmodes/tcl.el	Tue Apr 18 21:16:50 2006 +0000
+++ b/lisp/progmodes/tcl.el	Tue Apr 18 21:16:50 2006 +0000
@@ -1042,7 +1042,7 @@
 (defun tcl-send-string (proc string)
   (with-current-buffer (process-buffer proc)
     (goto-char (process-mark proc))
-    (beginning-of-line)
+    (forward-line 0)             ;Not (beginning-of-line) because of fields.
     (if (looking-at comint-prompt-regexp)
 	(set-marker inferior-tcl-delete-prompt-marker (point))))
   (comint-send-string proc string))
@@ -1050,7 +1050,7 @@
 (defun tcl-send-region (proc start end)
   (with-current-buffer (process-buffer proc)
     (goto-char (process-mark proc))
-    (beginning-of-line)
+    (forward-line 0)             ;Not (beginning-of-line) because of fields.
     (if (looking-at comint-prompt-regexp)
 	(set-marker inferior-tcl-delete-prompt-marker (point))))
   (comint-send-region proc start end))
@@ -1080,7 +1080,11 @@
 Prefix argument means switch to the Tcl buffer afterwards."
   (interactive "r\nP")
   (let ((proc (inferior-tcl-proc)))
-    (tcl-send-region proc start end)
+    (tcl-send-region
+     proc
+     ;; Strip leading and trailing whitespace.
+     (save-excursion (goto-char start) (skip-chars-forward " \t\n") (point))
+     (save-excursion (goto-char end) (skip-chars-backward " \t\n") (point)))
     (tcl-send-string proc "\n")
     (if and-go (switch-to-tcl t))))
 
@@ -1149,7 +1153,12 @@
   (unless (comint-check-proc "*inferior-tcl*")
     (set-buffer (apply (function make-comint) "inferior-tcl" cmd nil
 		       tcl-command-switches))
-    (inferior-tcl-mode))
+    (inferior-tcl-mode)
+    ;; Make tclsh display a prompt on ms-windows (or under Unix, when a tty
+    ;; wasn't used).  Doesn't affect wish, unfortunately.
+    (unless (process-tty-name (inferior-tcl-proc))
+      (tcl-send-string (inferior-tcl-proc)
+                       "set ::tcl_interactive 1; concat\n")))
   (set (make-local-variable 'tcl-application) cmd)
   (setq inferior-tcl-buffer "*inferior-tcl*")
   (pop-to-buffer "*inferior-tcl*"))