Mercurial > emacs
annotate lisp/rcompile.el @ 13876:16decb4ae75f
Put date on top of other-calendars menu.
author | Edward M. Reingold <reingold@emr.cs.iit.edu> |
---|---|
date | Wed, 27 Dec 1995 17:33:27 +0000 |
parents | 84acc3adcd63 |
children | be4f869af091 |
rev | line source |
---|---|
13337 | 1 ;;; rcompile.el --- run a compilation on a remote machine |
5813 | 2 |
5827
982503548902
(remote-compile): Set comint-file-name-prefix in the compilation buffer.
Roland McGrath <roland@gnu.org>
parents:
5814
diff
changeset
|
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 | |
24 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
25 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, 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 it's 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 (defvar remote-compile-host nil | |
73 "*Host for remote compilations.") | |
74 | |
75 (defvar remote-compile-user nil | |
76 "User for remote compilations. | |
77 nil means use the value returned by \\[user-login-name].") | |
78 | |
79 (defvar remote-compile-run-before nil | |
80 "*Command to run before compilation. | |
81 This can be used for setting up enviroment variables, | |
82 since rsh does not invoke the shell as a login shell and files like .login | |
83 \(tcsh\) and .bash_profile \(bash\) are not run. | |
84 nil means run no commands.") | |
85 | |
86 (defvar remote-compile-prompt-for-host nil | |
87 "*Non-nil means prompt for host if not available from filename.") | |
88 | |
89 (defvar remote-compile-prompt-for-user nil | |
90 "*Non-nil means prompt for user if not available from filename.") | |
91 | |
92 ;;;; internal variables | |
93 | |
94 ;; History of remote compile hosts and users | |
95 (defvar remote-compile-host-history nil) | |
96 (defvar remote-compile-user-history nil) | |
97 | |
98 | |
99 ;;;; entry point | |
100 | |
101 ;;;###autoload | |
102 (defun remote-compile (host user command) | |
103 "Compile the the current buffer's directory on HOST. Log in as USER. | |
104 See \\[compile]." | |
105 (interactive | |
106 (let ((parsed (or (and (featurep 'ange-ftp) | |
107 (ange-ftp-ftp-name default-directory)))) | |
108 host user command prompt) | |
109 (if parsed | |
110 (setq host (nth 0 parsed) | |
111 user (nth 1 parsed)) | |
112 (setq prompt (if (stringp remote-compile-host) | |
113 (format "Compile on host (default %s): " | |
114 remote-compile-host) | |
115 "Compile on host: ") | |
116 host (if (or remote-compile-prompt-for-host | |
117 (null remote-compile-host)) | |
118 (read-from-minibuffer prompt | |
119 "" nil nil | |
120 'remote-compile-host-history) | |
121 remote-compile-host) | |
122 user (if remote-compile-prompt-for-user | |
123 (read-from-minibuffer (format | |
124 "Compile by user (default %s)" | |
125 (or remote-compile-user | |
126 (user-login-name))) | |
127 "" nil nil | |
128 'remote-compile-user-history) | |
129 remote-compile-user))) | |
130 (setq command (read-from-minibuffer "Compile command: " | |
131 compile-command nil nil | |
132 '(compile-history . 1))) | |
133 (list (if (string= host "") remote-compile-host host) | |
134 (if (string= user "") remote-compile-user user) | |
135 command))) | |
136 (setq compile-command command) | |
137 (cond (user | |
138 (setq remote-compile-user user)) | |
139 ((null remote-compile-user) | |
140 (setq remote-compile-user (user-login-name)))) | |
141 (let* ((parsed (and (featurep 'ange-ftp) | |
142 (ange-ftp-ftp-name default-directory))) | |
143 (compile-command | |
144 (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
|
145 remote-shell-program |
5813 | 146 host |
147 remote-compile-user | |
148 (if remote-compile-run-before | |
149 (concat remote-compile-run-before "; ") | |
150 "") | |
151 (if parsed (nth 2 parsed) default-directory) | |
152 compile-command))) | |
153 (setq remote-compile-host host) | |
154 (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
|
155 (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
|
156 ;; 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
|
157 ;; 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
|
158 (save-excursion |
982503548902
(remote-compile): Set comint-file-name-prefix in the compilation buffer.
Roland McGrath <roland@gnu.org>
parents:
5814
diff
changeset
|
159 (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
|
160 (setq comint-file-name-prefix (concat "/" host ":"))))) |
5813 | 161 |
162 ;;; rcompile.el ends here |