Mercurial > emacs
annotate lisp/rcompile.el @ 15286:66a70f0f8ebe libc-960525 libc-960526 libc-960527 libc-960528 libc-960529 libc-960530 libc-960531 libc-960601 libc-960602 libc-960603
(AViiON:dgux:*:*): Fix typo in recognizing mc88110.
author | Roland McGrath <roland@gnu.org> |
---|---|
date | Fri, 24 May 1996 22:34:49 +0000 |
parents | 83f275dcd93a |
children | 3b9f64eb097b |
rev | line source |
---|---|
13337 | 1 ;;; rcompile.el --- run a compilation on a remote machine |
5813 | 2 |
14169 | 3 ;; Copyright (C) 1993, 1994 Free Software Foundation, Inc. |
5813 | 4 |
5814 | 5 ;; Author: Albert <alon@milcse.rtsg.mot.com> |
6 ;; Maintainer: FSF | |
7 ;; Created: 1993 Oct 6 | |
8 ;; Version: 1.1 | |
9 ;; Keywords: tools, processes | |
5813 | 10 |
11 ;; This file is part of GNU Emacs. | |
12 | |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
14 ;; it under the terms of the GNU General Public License as published by | |
15 ;; the Free Software Foundation; either version 2, or (at your option) | |
16 ;; any later version. | |
17 | |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; You should have received a copy of the GNU General Public License | |
14169 | 24 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
26 ;; Boston, MA 02111-1307, USA. | |
5813 | 27 |
28 ;;; Commentary: | |
29 | |
14169 | 30 ;; This package is for running a remote compilation and using emacs to parse |
31 ;; the error messages. It works by rsh'ing the compilation to a remote host | |
32 ;; and parsing the output. If the file visited at the time remote-compile was | |
33 ;; called was loaded remotely (ange-ftp), the host and user name are obtained | |
34 ;; by the calling ange-ftp-ftp-name on the current directory. In this case the | |
35 ;; next-error command will also ange-ftp the files over. This is achieved | |
36 ;; automatically because the compilation-parse-errors function uses | |
37 ;; default-directory to build it's file names. If however the file visited was | |
38 ;; loaded locally, remote-compile prompts for a host and user and assumes the | |
39 ;; files mounted locally (otherwise, how was the visited file loaded). | |
5813 | 40 |
14169 | 41 ;; See the user defined variables section for more info. |
5813 | 42 |
14169 | 43 ;; I was contemplating redefining "compile" to "remote-compile" automatically |
44 ;; if the file visited was ange-ftp'ed but decided against it for now. If you | |
45 ;; feel this is a good idea, let me know and I'll consider it again. | |
5813 | 46 |
14169 | 47 ;; Installation: |
5813 | 48 |
14169 | 49 ;; To use rcompile, you also need to give yourself permission to connect to |
50 ;; the remote host. You do this by putting lines like: | |
5813 | 51 |
14169 | 52 ;; monopoly alon |
53 ;; vme33 | |
54 ;; | |
55 ;; in a file named .rhosts in the home directory (of the remote machine). | |
56 ;; Be careful what you put in this file. A line like: | |
57 ;; | |
58 ;; + | |
59 ;; | |
60 ;; Will allow anyone access to your account without a password. I suggest you | |
61 ;; read the rhosts(5) manual page before you edit this file (if you are not | |
62 ;; familiar with it already) | |
5813 | 63 |
64 ;;; Code: | |
65 | |
66 (provide 'rcompile) | |
67 (require 'compile) | |
68 ;;; The following should not be needed. | |
69 ;;; (eval-when-compile (require 'ange-ftp)) | |
70 | |
71 ;;;; user defined variables | |
72 | |
73 (defvar remote-compile-host nil | |
74 "*Host for remote compilations.") | |
75 | |
76 (defvar remote-compile-user nil | |
77 "User for remote compilations. | |
78 nil means use the value returned by \\[user-login-name].") | |
79 | |
80 (defvar remote-compile-run-before nil | |
81 "*Command to run before compilation. | |
14001
be4f869af091
(remote-compile-run-before): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
13337
diff
changeset
|
82 This can be used for setting up environment variables, |
5813 | 83 since rsh does not invoke the shell as a login shell and files like .login |
84 \(tcsh\) and .bash_profile \(bash\) are not run. | |
85 nil means run no commands.") | |
86 | |
87 (defvar remote-compile-prompt-for-host nil | |
88 "*Non-nil means prompt for host if not available from filename.") | |
89 | |
90 (defvar remote-compile-prompt-for-user nil | |
91 "*Non-nil means prompt for user if not available from filename.") | |
92 | |
93 ;;;; internal variables | |
94 | |
95 ;; History of remote compile hosts and users | |
96 (defvar remote-compile-host-history nil) | |
97 (defvar remote-compile-user-history nil) | |
98 | |
99 | |
100 ;;;; entry point | |
101 | |
102 ;;;###autoload | |
103 (defun remote-compile (host user command) | |
104 "Compile the the current buffer's directory on HOST. Log in as USER. | |
105 See \\[compile]." | |
106 (interactive | |
107 (let ((parsed (or (and (featurep 'ange-ftp) | |
108 (ange-ftp-ftp-name default-directory)))) | |
109 host user command prompt) | |
110 (if parsed | |
111 (setq host (nth 0 parsed) | |
112 user (nth 1 parsed)) | |
113 (setq prompt (if (stringp remote-compile-host) | |
114 (format "Compile on host (default %s): " | |
115 remote-compile-host) | |
116 "Compile on host: ") | |
117 host (if (or remote-compile-prompt-for-host | |
118 (null remote-compile-host)) | |
119 (read-from-minibuffer prompt | |
120 "" nil nil | |
121 'remote-compile-host-history) | |
122 remote-compile-host) | |
123 user (if remote-compile-prompt-for-user | |
124 (read-from-minibuffer (format | |
125 "Compile by user (default %s)" | |
126 (or remote-compile-user | |
127 (user-login-name))) | |
128 "" nil nil | |
129 'remote-compile-user-history) | |
130 remote-compile-user))) | |
131 (setq command (read-from-minibuffer "Compile command: " | |
132 compile-command nil nil | |
133 '(compile-history . 1))) | |
134 (list (if (string= host "") remote-compile-host host) | |
135 (if (string= user "") remote-compile-user user) | |
136 command))) | |
137 (setq compile-command command) | |
138 (cond (user | |
139 (setq remote-compile-user user)) | |
140 ((null remote-compile-user) | |
141 (setq remote-compile-user (user-login-name)))) | |
142 (let* ((parsed (and (featurep 'ange-ftp) | |
143 (ange-ftp-ftp-name default-directory))) | |
144 (compile-command | |
145 (format "%s %s -l %s \"(%scd %s; %s)\"" | |
10453
05e7543bbb96
(remote-compile): Use new global remote-shell-program.
Karl Heuer <kwzh@gnu.org>
parents:
5828
diff
changeset
|
146 remote-shell-program |
5813 | 147 host |
148 remote-compile-user | |
149 (if remote-compile-run-before | |
150 (concat remote-compile-run-before "; ") | |
151 "") | |
152 (if parsed (nth 2 parsed) default-directory) | |
153 compile-command))) | |
154 (setq remote-compile-host host) | |
155 (save-some-buffers nil nil) | |
5827
982503548902
(remote-compile): Set comint-file-name-prefix in the compilation buffer.
Roland McGrath <roland@gnu.org>
parents:
5814
diff
changeset
|
156 (compile-internal compile-command "No more errors") |
982503548902
(remote-compile): Set comint-file-name-prefix in the compilation buffer.
Roland McGrath <roland@gnu.org>
parents:
5814
diff
changeset
|
157 ;; Set comint-file-name-prefix in the compilation buffer so |
982503548902
(remote-compile): Set comint-file-name-prefix in the compilation buffer.
Roland McGrath <roland@gnu.org>
parents:
5814
diff
changeset
|
158 ;; compilation-parse-errors will find referenced files by ange-ftp. |
982503548902
(remote-compile): Set comint-file-name-prefix in the compilation buffer.
Roland McGrath <roland@gnu.org>
parents:
5814
diff
changeset
|
159 (save-excursion |
982503548902
(remote-compile): Set comint-file-name-prefix in the compilation buffer.
Roland McGrath <roland@gnu.org>
parents:
5814
diff
changeset
|
160 (set-buffer compilation-last-buffer) |
982503548902
(remote-compile): Set comint-file-name-prefix in the compilation buffer.
Roland McGrath <roland@gnu.org>
parents:
5814
diff
changeset
|
161 (setq comint-file-name-prefix (concat "/" host ":"))))) |
5813 | 162 |
163 ;;; rcompile.el ends here |