aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-02-07 05:01:13 +0000
committerRichard M. Stallman1994-02-07 05:01:13 +0000
commit9ea3deb50068a69295a575cc119a071e918b095c (patch)
tree4e2736cae13df96e4d7403c6619555bf9a7b8063
parentf1382a3d0d1e7985bfcba34a2032f0ced0abf7d7 (diff)
downloademacs-9ea3deb50068a69295a575cc119a071e918b095c.tar.gz
emacs-9ea3deb50068a69295a575cc119a071e918b095c.zip
Initial revision
-rw-r--r--lisp/rcompile.el167
1 files changed, 167 insertions, 0 deletions
diff --git a/lisp/rcompile.el b/lisp/rcompile.el
new file mode 100644
index 00000000000..df415ebed57
--- /dev/null
+++ b/lisp/rcompile.el
@@ -0,0 +1,167 @@
1;;; rcompile.el Run a compilation on a remote machine (requires emacs-19)
2
3;;; Copyright (C) 1993 Free Software Foundation, Inc.
4
5;;; Author: Albert <alon@milcse.rtsg.mot.com>
6;;; Created: 1993 Oct 6
7;;; Version: 1.0
8;;; Keywords: tools, processes
9
10;; This file is part of GNU Emacs.
11
12;; GNU Emacs is free software; you can redistribute it and/or modify
13;; it under the terms of the GNU General Public License as published by
14;; the Free Software Foundation; either version 2, or (at your option)
15;; any later version.
16
17;; GNU Emacs is distributed in the hope that it will be useful,
18;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;; GNU General Public License for more details.
21
22;; You should have received a copy of the GNU General Public License
23;; along with GNU Emacs; see the file COPYING. If not, write to
24;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
25
26;;; Commentary:
27
28;;; This package is for running a remote compilation and using emacs to parse
29;;; the error messages. It works by rsh'ing the compilation to a remote host
30;;; and parsing the output. If the file visited at the time remote-compile was
31;;; called was loaded remotely (ange-ftp), the host and user name are obtained
32;;; by the calling ange-ftp-ftp-name on the current directory. In this case the
33;;; next-error command will also ange-ftp the files over. This is achieved
34;;; automatically because the compilation-parse-errors function uses
35;;; default-directory to build it's file names. If however the file visited was
36;;; loaded locally, remote-compile prompts for a host and user and assumes the
37;;; files mounted locally (otherwise, how was the visited file loaded).
38
39;;; See the user defined variables section for more info.
40
41;;; I was contemplating redefining "compile" to "remote-compile" automatically
42;;; if the file visited was ange-ftp'ed but decided against it for now. If you
43;;; feel this is a good idea, let me know and I'll consider it again.
44
45;;; Installation:
46
47;;; To use rcompile, you also need to give yourself permission to connect to
48;;; the remote host. You do this by putting lines like:
49
50;;; monopoly alon
51;;; vme33
52;;;
53;;; in a file named .rhosts in the home directory (of the remote machine).
54;;; Be careful what you put in this file. A line like:
55;;;
56;;; +
57;;;
58;;; Will allow anyone access to your account without a password. I suggest you
59;;; read the rhosts(5) manual page before you edit this file (if you are not
60;;; familiar with it already)
61
62;;; History:
63;;; V1.1 Oct 13 1993 Alon Albert
64;;; SYSV support by Jay Finger <finger@mikey.convex.com>
65;;; V1.0 Oct 6 1993 Alon Albert
66;;; Initial cut.
67
68
69;;; Code:
70
71(provide 'rcompile)
72(require 'compile)
73;;; The following should not be needed.
74;;; (eval-when-compile (require 'ange-ftp))
75
76;;;; user defined variables
77
78(defvar remote-compile-rsh-command
79 (if (eq system-type 'usg-unix-v) "remsh" "rsh")
80 "*Name of remote shell command: `rsh' for BSD or `remsh' for SYSV.")
81
82(defvar remote-compile-host nil
83 "*Host for remote compilations.")
84
85(defvar remote-compile-user nil
86 "User for remote compilations.
87nil means use the value returned by \\[user-login-name].")
88
89(defvar remote-compile-run-before nil
90 "*Command to run before compilation.
91This can be used for setting up enviroment variables,
92since rsh does not invoke the shell as a login shell and files like .login
93\(tcsh\) and .bash_profile \(bash\) are not run.
94nil means run no commands.")
95
96(defvar remote-compile-prompt-for-host nil
97 "*Non-nil means prompt for host if not available from filename.")
98
99(defvar remote-compile-prompt-for-user nil
100 "*Non-nil means prompt for user if not available from filename.")
101
102;;;; internal variables
103
104;; History of remote compile hosts and users
105(defvar remote-compile-host-history nil)
106(defvar remote-compile-user-history nil)
107
108
109;;;; entry point
110
111;;;###autoload
112(defun remote-compile (host user command)
113 "Compile the the current buffer's directory on HOST. Log in as USER.
114See \\[compile]."
115 (interactive
116 (let ((parsed (or (and (featurep 'ange-ftp)
117 (ange-ftp-ftp-name default-directory))))
118 host user command prompt)
119 (if parsed
120 (setq host (nth 0 parsed)
121 user (nth 1 parsed))
122 (setq prompt (if (stringp remote-compile-host)
123 (format "Compile on host (default %s): "
124 remote-compile-host)
125 "Compile on host: ")
126 host (if (or remote-compile-prompt-for-host
127 (null remote-compile-host))
128 (read-from-minibuffer prompt
129 "" nil nil
130 'remote-compile-host-history)
131 remote-compile-host)
132 user (if remote-compile-prompt-for-user
133 (read-from-minibuffer (format
134 "Compile by user (default %s)"
135 (or remote-compile-user
136 (user-login-name)))
137 "" nil nil
138 'remote-compile-user-history)
139 remote-compile-user)))
140 (setq command (read-from-minibuffer "Compile command: "
141 compile-command nil nil
142 '(compile-history . 1)))
143 (list (if (string= host "") remote-compile-host host)
144 (if (string= user "") remote-compile-user user)
145 command)))
146 (setq compile-command command)
147 (cond (user
148 (setq remote-compile-user user))
149 ((null remote-compile-user)
150 (setq remote-compile-user (user-login-name))))
151 (let* ((parsed (and (featurep 'ange-ftp)
152 (ange-ftp-ftp-name default-directory)))
153 (compile-command
154 (format "%s %s -l %s \"(%scd %s; %s)\""
155 remote-compile-rsh-command
156 host
157 remote-compile-user
158 (if remote-compile-run-before
159 (concat remote-compile-run-before "; ")
160 "")
161 (if parsed (nth 2 parsed) default-directory)
162 compile-command)))
163 (setq remote-compile-host host)
164 (save-some-buffers nil nil)
165 (compile-internal compile-command "No more errors")))
166
167;;; rcompile.el ends here