;;; vmsproc.el --- run asynchronous VMS subprocesses under Emacs
-;; Copyright (C) 1986, 2005 Free Software Foundation, Inc.
+;; Copyright (C) 1986, 2001, 2002, 2003, 2004, 2005,
+;; 2006, 2007 Free Software Foundation, Inc.
;; Author: Mukesh Prasad
;; Maintainer: FSF
"String to insert to distinguish commands entered by user.")
(defvar subprocess-running nil)
+(defvar subprocess-buf nil)
+
(defvar command-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "\C-m" 'command-send-input)
map))
(defun subprocess-input (name str)
- "Handles input from a subprocess. Called by Emacs."
+ "Handle input from a subprocess. Called by Emacs."
(if display-subprocess-window
(display-buffer subprocess-buf))
- (let ((old-buffer (current-buffer)))
- (set-buffer subprocess-buf)
+ (with-current-buffer subprocess-buf
(goto-char (point-max))
- (insert str)
- (insert ?\n)
- (set-buffer old-buffer)))
+ (insert str ?\n)))
(defun subprocess-exit (name)
"Called by Emacs upon subprocess exit."
(setq subprocess-running nil))
(defun start-subprocess ()
- "Spawns an asynchronous subprocess with output redirected to
+ "Spawn an asynchronous subprocess with output redirected to
the buffer *COMMAND*. Within this buffer, use C-m to send
the last line to the subprocess or to bring another line to
the end."
;; (delete-file output-filename))))
(defun subprocess-command ()
- "Starts asynchronous subprocess if not running and switches to its window."
+ "Start asynchronous subprocess if not running and switch to its window."
(interactive)
(if (not subprocess-running)
(start-subprocess))
(progn (pop-to-buffer subprocess-buf) (goto-char (point-max)))))
(defun command-send-input ()
- "If at last line of buffer, sends the current line to
-the spawned subprocess. Otherwise brings back current
+ "If at last line of buffer, send the current line to
+the spawned subprocess. Otherwise bring back current
line to the last line for resubmission."
(interactive)
(beginning-of-line)
current-line)))))
(defun command-kill-line ()
- "Kills the current line. Used in command mode."
+ "Kill the current line. Used in command mode."
(interactive)
(beginning-of-line)
(kill-line))