aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/tcl.el
diff options
context:
space:
mode:
authorStefan Monnier <[email protected]>2006-04-18 21:16:50 +0000
committerStefan Monnier <[email protected]>2006-04-18 21:16:50 +0000
commit75669e022315b9480b979b795416a87b006bdeac (patch)
tree37956c1f91aa15006cc4942822d73f3ed42761de /lisp/progmodes/tcl.el
parent7cf8b3fcac2e5b4f7264b5b4c4c1defda9918b50 (diff)
(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.
Diffstat (limited to 'lisp/progmodes/tcl.el')
-rw-r--r--lisp/progmodes/tcl.el17
1 files changed, 13 insertions, 4 deletions
diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el
index 5c8477ac33..b194bb5672 100644
--- a/lisp/progmodes/tcl.el
+++ b/lisp/progmodes/tcl.el
@@ -1042,7 +1042,7 @@ Returns nil if line starts inside a string, t if in a comment."
(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 @@ Returns nil if line starts inside a string, t if in a comment."
(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 @@ See variable `inferior-tcl-buffer'."
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 @@ See documentation for function `inferior-tcl-mode' for more information."
(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*"))