1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-05 11:45:45 +00:00
emacs/lisp/vmsproc.el

149 lines
5.1 KiB
EmacsLisp
Raw Normal View History

* progmodes/cperl-mode.el (compilation-error-regexp-alist): Pacify byte compiler. (cperl-mode): Use with-no-warnings for setting vc-header-alist. * progmodes/idlwave.el (idlwave-shell-get-path-info) (idlwave-shell-temp-file, idlwave-shell-is-running) (widget-value, comint-dynamic-complete-filename, Info-goto-node): * progmodes/idlw-help.el (idlwave-prepare-structure-tag-completion) (idlwave-all-method-classes, idlwave-all-method-keyword-classes) (idlwave-beginning-of-statement, idlwave-best-rinfo-assoc) (idlwave-class-found-in, idlwave-class-or-superclass-with-tag) (idlwave-completing-read, idlwave-current-routine) (idlwave-downcase-safe, idlwave-entry-find-keyword) (idlwave-expand-keyword, idlwave-find-class-definition) (idlwave-find-inherited-class, idlwave-find-struct-tag) (idlwave-get-buffer-visiting, idlwave-in-quote) (idlwave-make-full-name, idlwave-members-only) (idlwave-popup-select, idlwave-routine-source-file) (idlwave-routines, idlwave-sintern-class) (idlwave-sintern-keyword, idlwave-sintern-method) (idlwave-sintern-routine-or-method) (idlwave-substitute-link-target, idlwave-sys-dir) (idlwave-this-word, idlwave-what-module-find-class) (idlwave-where): * progmodes/idlw-complete-structtag.el (idlwave-shell-buffer): * mail/uce.el (rmail-msg-is-pruned) (rmail-maybe-set-message-counters, rmail-msgbeg, rmail-msgend) (rmail-toggle-header): * mail/sendmail.el (dired-view-file, dired-get-filename): * mail/rmailkwd.el (rmail-maybe-set-message-counters) (rmail-display-labels, rmail-msgbeg) (rmail-set-message-deleted-p, rmail-message-labels-p) (rmail-show-message, mail-comma-list-regexp) (mail-parse-comma-list): * mail/rmail.el (rmail-spam-filter, rmail-summary-goto-msg) (rmail-summary-mark-undeleted, rmail-summary-mark-deleted) (rfc822-addresses, mail-abbrev-make-syntax-table) (mail-sendmail-delimit-header, mail-header-end): * mail/hashcash.el (message-narrow-to-headers-or-head) (message-fetch-field, message-goto-eoh) (message-narrow-to-headers): * vc.el (view-mode-exit): Declare as functions. * mail/vms-pmail.el: * vmsproc.el: * vms-patch.el: Don't byte compile these files, they don't work. * Makefile.in (SOME_MACHINE_LISP): Remove VMS files, they are not compiled anymore.
2007-11-27 06:57:07 +00:00
;; -*- no-byte-compile: t -*-
1992-07-16 21:47:34 +00:00
;;; vmsproc.el --- run asynchronous VMS subprocesses under Emacs
2006-12-05 07:06:08 +00:00
;; Copyright (C) 1986, 2001, 2002, 2003, 2004, 2005,
2008-01-07 02:45:14 +00:00
;; 2006, 2007, 2008 Free Software Foundation, Inc.
1992-07-22 02:58:48 +00:00
1992-07-16 21:47:34 +00:00
;; Author: Mukesh Prasad
;; Maintainer: FSF
1992-07-17 18:53:44 +00:00
;; Keywords: vms
1992-05-30 19:21:46 +00:00
1989-10-31 15:59:53 +00:00
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
2007-07-25 04:50:21 +00:00
;; the Free Software Foundation; either version 3, or (at your option)
1989-10-31 15:59:53 +00:00
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
1996-01-14 07:34:30 +00:00
;; along with GNU Emacs; see the file COPYING. If not, write to the
2005-07-04 23:32:44 +00:00
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
1989-10-31 15:59:53 +00:00
;;; Commentary:
1992-07-16 21:47:34 +00:00
;;; Code:
1989-10-31 15:59:53 +00:00
(defvar display-subprocess-window nil
1996-01-04 23:53:00 +00:00
"If non-nil, the subprocess window is displayed whenever input is received.")
1989-10-31 15:59:53 +00:00
(defvar command-prefix-string "$ "
"String to insert to distinguish commands entered by user.")
(defvar subprocess-running nil)
(defvar subprocess-buf nil)
2005-07-29 20:14:37 +00:00
(defvar command-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "\C-m" 'command-send-input)
(define-key map "\C-u" 'command-kill-line)
map))
1989-10-31 15:59:53 +00:00
(defun subprocess-input (name str)
"Handle input from a subprocess. Called by Emacs."
1989-10-31 15:59:53 +00:00
(if display-subprocess-window
(display-buffer subprocess-buf))
(with-current-buffer subprocess-buf
1989-10-31 15:59:53 +00:00
(goto-char (point-max))
(insert str ?\n)))
1989-10-31 15:59:53 +00:00
(defun subprocess-exit (name)
"Called by Emacs upon subprocess exit."
(setq subprocess-running nil))
(defun start-subprocess ()
"Spawn an asynchronous subprocess with output redirected to
1989-10-31 15:59:53 +00:00
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."
(if subprocess-running
(return t))
(setq subprocess-buf (get-buffer-create "*COMMAND*"))
2005-07-29 20:14:37 +00:00
(with-current-buffer subprocess-buf
1989-10-31 15:59:53 +00:00
(use-local-map command-mode-map))
(setq subprocess-running (spawn-subprocess 1 'subprocess-input
'subprocess-exit))
;; Initialize subprocess so it doesn't panic and die upon
;; encountering the first error.
(and subprocess-running
(send-command-to-subprocess 1 "ON SEVERE_ERROR THEN CONTINUE")))
(defun subprocess-command-to-buffer (command buffer)
"Execute COMMAND and redirect output into BUFFER."
(let (cmd args)
(setq cmd (substring command 0 (string-match " " command)))
(setq args (substring command (string-match " " command)))
(call-process cmd nil buffer nil "*dcl*" args)))
2005-07-29 20:14:37 +00:00
;; BUGS: only the output up to the end of the first image activation is trapped.
;; (if (not subprocess-running)
;; (start-subprocess))
;; (with-current-buffer buffer
;; (let ((output-filename (concat "SYS$SCRATCH:OUTPUT-FOR-"
;; (getenv "USER") ".LISTING")))
;; (while (file-exists-p output-filename)
;; (delete-file output-filename))
;; (define-logical-name "SYS$OUTPUT" (concat output-filename "-NEW"))
;; (send-command-to-subprocess 1 command)
;; (send-command-to-subprocess 1 (concat
;; "RENAME " output-filename
;; "-NEW " output-filename))
;; (while (not (file-exists-p output-filename))
;; (sleep-for 1))
;; (define-logical-name "SYS$OUTPUT" nil)
;; (insert-file output-filename)
;; (delete-file output-filename))))
1989-10-31 15:59:53 +00:00
(defun subprocess-command ()
"Start asynchronous subprocess if not running and switch to its window."
1989-10-31 15:59:53 +00:00
(interactive)
(if (not subprocess-running)
(start-subprocess))
(and subprocess-running
(progn (pop-to-buffer subprocess-buf) (goto-char (point-max)))))
(defun command-send-input ()
"If at last line of buffer, send the current line to
the spawned subprocess. Otherwise bring back current
1989-10-31 15:59:53 +00:00
line to the last line for resubmission."
(interactive)
(beginning-of-line)
2005-07-29 20:14:37 +00:00
(let ((current-line (buffer-substring (point) (line-end-position))))
1989-10-31 15:59:53 +00:00
(if (eobp)
(progn
(if (not subprocess-running)
(start-subprocess))
(if subprocess-running
(progn
(beginning-of-line)
(send-command-to-subprocess 1 current-line)
(if command-prefix-string
(progn (beginning-of-line) (insert command-prefix-string)))
(forward-line 1))))
1989-10-31 15:59:53 +00:00
;; else -- if not at last line in buffer
2005-07-29 20:14:37 +00:00
(goto-char (point-max))
1989-10-31 15:59:53 +00:00
(backward-char)
(forward-line 1)
2005-07-29 20:14:37 +00:00
(insert
(if (compare-strings command-prefix-string nil nil
current-line 0 (length command-prefix-string))
(substring current-line (length command-prefix-string))
current-line)))))
1989-10-31 15:59:53 +00:00
2005-07-29 20:14:37 +00:00
(defun command-kill-line ()
"Kill the current line. Used in command mode."
1989-10-31 15:59:53 +00:00
(interactive)
(beginning-of-line)
(kill-line))
(define-key esc-map "$" 'subprocess-command)
1992-05-30 20:24:49 +00:00
(provide 'vmsproc)
2005-07-29 20:14:37 +00:00
;; arch-tag: 600b2512-f903-4887-bcd2-e76b306f5b66
1992-05-30 20:24:49 +00:00
;;; vmsproc.el ends here