Mercurial > emacs
annotate lisp/net/rcompile.el @ 46438:fd2419f6c4d9
(help-key-description): Show the untranslated keys
when they start with ESC and the ESC was not translated.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 16 Jul 2002 16:08:44 +0000 |
parents | be541feb06cc |
children | 0d8b17d428b5 |
rev | line source |
---|---|
28210 | 1 ;;; rcompile.el --- run a compilation on a remote machine |
2 | |
3 ;; Copyright (C) 1993, 1994 Free Software Foundation, Inc. | |
4 | |
5 ;; Author: Albert <alon@milcse.rtsg.mot.com> | |
6 ;; Maintainer: FSF | |
7 ;; Created: 1993 Oct 6 | |
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 the | |
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
25 ;; Boston, MA 02111-1307, USA. | |
26 | |
27 ;;; Commentary: | |
28 | |
29 ;; This package is for running a remote compilation and using emacs to parse | |
30 ;; the error messages. It works by rsh'ing the compilation to a remote host | |
31 ;; and parsing the output. If the file visited at the time remote-compile was | |
32 ;; called was loaded remotely (ange-ftp), the host and user name are obtained | |
33 ;; by the calling ange-ftp-ftp-name on the current directory. In this case the | |
34 ;; next-error command will also ange-ftp the files over. This is achieved | |
35 ;; automatically because the compilation-parse-errors function uses | |
36 ;; default-directory to build its file names. If however the file visited was | |
37 ;; loaded locally, remote-compile prompts for a host and user and assumes the | |
38 ;; files mounted locally (otherwise, how was the visited file loaded). | |
39 | |
40 ;; See the user defined variables section for more info. | |
41 | |
42 ;; I was contemplating redefining "compile" to "remote-compile" automatically | |
43 ;; if the file visited was ange-ftp'ed but decided against it for now. If you | |
44 ;; feel this is a good idea, let me know and I'll consider it again. | |
45 | |
46 ;; Installation: | |
47 | |
48 ;; To use rcompile, you also need to give yourself permission to connect to | |
49 ;; the remote host. You do this by putting lines like: | |
50 | |
51 ;; monopoly alon | |
52 ;; vme33 | |
53 ;; | |
54 ;; in a file named .rhosts in the home directory (of the remote machine). | |
55 ;; Be careful what you put in this file. A line like: | |
56 ;; | |
57 ;; + | |
58 ;; | |
59 ;; Will allow anyone access to your account without a password. I suggest you | |
60 ;; read the rhosts(5) manual page before you edit this file (if you are not | |
61 ;; familiar with it already) | |
62 | |
63 ;;; Code: | |
64 | |
65 (provide 'rcompile) | |
66 (require 'compile) | |
67 ;;; The following should not be needed. | |
68 ;;; (eval-when-compile (require 'ange-ftp)) | |
69 | |
70 ;;;; user defined variables | |
71 | |
72 (defgroup remote-compile nil | |
73 "Run a compilation on a remote machine" | |
74 :group 'processes | |
75 :group 'tools) | |
76 | |
77 | |
78 (defcustom remote-compile-host nil | |
79 "*Host for remote compilations." | |
80 :type '(choice string (const nil)) | |
81 :group 'remote-compile) | |
82 | |
83 (defcustom remote-compile-user nil | |
84 "User for remote compilations. | |
85 nil means use the value returned by \\[user-login-name]." | |
86 :type '(choice string (const nil)) | |
87 :group 'remote-compile) | |
88 | |
89 (defcustom remote-compile-run-before nil | |
90 "*Command to run before compilation. | |
91 This can be used for setting up environment variables, | |
92 since rsh does not invoke the shell as a login shell and files like .login | |
93 \(tcsh\) and .bash_profile \(bash\) are not run. | |
94 nil means run no commands." | |
95 :type '(choice string (const nil)) | |
96 :group 'remote-compile) | |
97 | |
98 (defcustom remote-compile-prompt-for-host nil | |
99 "*Non-nil means prompt for host if not available from filename." | |
100 :type 'boolean | |
101 :group 'remote-compile) | |
102 | |
103 (defcustom remote-compile-prompt-for-user nil | |
104 "*Non-nil means prompt for user if not available from filename." | |
105 :type 'boolean | |
106 :group 'remote-compile) | |
107 | |
108 ;;;; internal variables | |
109 | |
110 ;; History of remote compile hosts and users | |
111 (defvar remote-compile-host-history nil) | |
112 (defvar remote-compile-user-history nil) | |
113 | |
114 | |
115 ;;;; entry point | |
116 | |
117 ;;;###autoload | |
118 (defun remote-compile (host user command) | |
42706 | 119 "Compile the current buffer's directory on HOST. Log in as USER. |
28210 | 120 See \\[compile]." |
121 (interactive | |
122 (let ((parsed (or (and (featurep 'ange-ftp) | |
123 (ange-ftp-ftp-name default-directory)))) | |
124 host user command prompt) | |
125 (if parsed | |
126 (setq host (nth 0 parsed) | |
127 user (nth 1 parsed)) | |
128 (setq prompt (if (stringp remote-compile-host) | |
129 (format "Compile on host (default %s): " | |
130 remote-compile-host) | |
131 "Compile on host: ") | |
132 host (if (or remote-compile-prompt-for-host | |
133 (null remote-compile-host)) | |
134 (read-from-minibuffer prompt | |
135 "" nil nil | |
136 'remote-compile-host-history) | |
137 remote-compile-host) | |
138 user (if remote-compile-prompt-for-user | |
139 (read-from-minibuffer (format | |
140 "Compile by user (default %s)" | |
141 (or remote-compile-user | |
142 (user-login-name))) | |
143 "" nil nil | |
144 'remote-compile-user-history) | |
145 remote-compile-user))) | |
146 (setq command (read-from-minibuffer "Compile command: " | |
147 compile-command nil nil | |
148 '(compile-history . 1))) | |
149 (list (if (string= host "") remote-compile-host host) | |
150 (if (string= user "") remote-compile-user user) | |
151 command))) | |
152 (setq compile-command command) | |
153 (cond (user | |
154 (setq remote-compile-user user)) | |
155 ((null remote-compile-user) | |
156 (setq remote-compile-user (user-login-name)))) | |
157 (let* ((parsed (and (featurep 'ange-ftp) | |
158 (ange-ftp-ftp-name default-directory))) | |
159 (compile-command | |
160 (format "%s %s -l %s \"(%scd %s; %s)\"" | |
161 remote-shell-program | |
162 host | |
163 remote-compile-user | |
164 (if remote-compile-run-before | |
165 (concat remote-compile-run-before "; ") | |
166 "") | |
167 (if parsed (nth 2 parsed) default-directory) | |
168 compile-command))) | |
169 (setq remote-compile-host host) | |
170 (save-some-buffers nil nil) | |
171 (compile-internal compile-command "No more errors") | |
172 ;; Set comint-file-name-prefix in the compilation buffer so | |
173 ;; compilation-parse-errors will find referenced files by ange-ftp. | |
38420
0a4a44975e06
(remote-compile): Use make-local-variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28210
diff
changeset
|
174 (with-current-buffer compilation-last-buffer |
0a4a44975e06
(remote-compile): Use make-local-variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28210
diff
changeset
|
175 (set (make-local-variable 'comint-file-name-prefix) |
0a4a44975e06
(remote-compile): Use make-local-variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28210
diff
changeset
|
176 (concat "/" host ":"))))) |
28210 | 177 |
178 ;;; rcompile.el ends here |