Function: tcl-restart-with-file

tcl-restart-with-file is an interactive and byte-compiled function defined in tcl.el.gz.

Signature

(tcl-restart-with-file FILE &optional AND-GO)

Documentation

Restart inferior Tcl with file.

If an inferior Tcl process exists, it is killed first. Prefix argument means switch to the Tcl buffer afterwards.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/tcl.el.gz
(defun tcl-restart-with-file (file &optional and-go)
  "Restart inferior Tcl with file.
If an inferior Tcl process exists, it is killed first.
Prefix argument means switch to the Tcl buffer afterwards."
  (interactive
   (list
    (car (comint-get-source "Restart with Tcl file"
			    (or (and
				 (derived-mode-p 'tcl-mode)
				 (buffer-file-name))
				tcl-previous-dir/file)
			    '(tcl-mode) t))
    current-prefix-arg))
  (let* ((buf (if (derived-mode-p 'inferior-tcl-mode)
		  (current-buffer)
		inferior-tcl-buffer))
	 (proc (and buf (get-process buf))))
    (cond
     ((not (and buf (get-buffer buf)))
      ;; I think this will be ok.
      (inferior-tcl tcl-application)
      (tcl-load-file file and-go))
     ((or
       (not (comint-check-proc buf))
       (yes-or-no-p
	"A Tcl process is running, are you sure you want to reset it? "))
      (save-excursion
	(comint-check-source file)
	(setq tcl-previous-dir/file (cons (file-name-directory file)
					  (file-name-nondirectory file)))
	(comint-exec (get-buffer-create buf)
		     (if proc
			 (process-name proc)
		       "inferior-tcl")
		     tcl-application file tcl-command-switches)
	(if and-go (switch-to-tcl t)))))))