comparison lisp/net/rcompile.el @ 88094:21873b86ecb7

(remote-compile): Remove broken code.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 31 Jan 2008 15:09:19 +0000
parents 107ccd98fa12
children 924fe8b4e375 91e5880a36c1
comparison
equal deleted inserted replaced
88093:fa454b3c5b7b 88094:21873b86ecb7
113 (defvar remote-compile-user-history nil) 113 (defvar remote-compile-user-history nil)
114 114
115 115
116 ;;;; entry point 116 ;;;; entry point
117 117
118 ;; We use the Tramp internal functions `with-parsed-tramp-file-name' 118 ;; We use the Tramp internal function`tramp-make-tramp-file-name'.
119 ;; and `tramp-make-tramp-file-name'. Better would be, if there are 119 ;; Better would be, if there are functions to provide user, host and
120 ;; functions to provide user, host and localname of a remote filename, 120 ;; localname of a remote filename, independent of Tramp's implementation.
121 ;; independent of Tramp's implementation. The function calls are 121 ;; The function calls are wrapped by `funcall' in order to pacify the byte
122 ;; wrapped by `funcall' in order to pacify the byte compiler. 122 ;; compiler. ange-ftp check removed, because it is handled also by Tramp.
123 ;; ange-ftp check removed, because it is handled also by Tramp.
124 ;;;###autoload 123 ;;;###autoload
125 (defun remote-compile (host user command) 124 (defun remote-compile (host user command)
126 "Compile the current buffer's directory on HOST. Log in as USER. 125 "Compile the current buffer's directory on HOST. Log in as USER.
127 See \\[compile]." 126 See \\[compile]."
128 (interactive 127 (interactive
129 (let ((parsed (and (featurep 'tramp) 128 (let (host user command prompt l l-host l-user)
130 (file-remote-p default-directory))) 129 (setq prompt (if (stringp remote-compile-host)
131 host user command prompt l l-host l-user) 130 (format "Compile on host (default %s): "
132 (if parsed 131 remote-compile-host)
133 (funcall (symbol-function 'with-parsed-tramp-file-name) 132 "Compile on host: ")
134 default-directory l 133 host (if (or remote-compile-prompt-for-host
135 (setq host l-host 134 (null remote-compile-host))
136 user l-user)) 135 (read-from-minibuffer prompt
137 (setq prompt (if (stringp remote-compile-host) 136 "" nil nil
138 (format "Compile on host (default %s): " 137 'remote-compile-host-history)
139 remote-compile-host) 138 remote-compile-host)
140 "Compile on host: ") 139 user (if remote-compile-prompt-for-user
141 host (if (or remote-compile-prompt-for-host 140 (read-from-minibuffer (format
142 (null remote-compile-host)) 141 "Compile by user (default %s): "
143 (read-from-minibuffer prompt 142 (or remote-compile-user
144 "" nil nil 143 (user-login-name)))
145 'remote-compile-host-history) 144 "" nil nil
146 remote-compile-host) 145 'remote-compile-user-history)
147 user (if remote-compile-prompt-for-user 146 remote-compile-user))
148 (read-from-minibuffer (format
149 "Compile by user (default %s): "
150 (or remote-compile-user
151 (user-login-name)))
152 "" nil nil
153 'remote-compile-user-history)
154 remote-compile-user)))
155 (setq command (read-from-minibuffer "Compile command: " 147 (setq command (read-from-minibuffer "Compile command: "
156 compile-command nil nil 148 compile-command nil nil
157 '(compile-history . 1))) 149 '(compile-history . 1)))
158 (list (if (string= host "") remote-compile-host host) 150 (list (if (string= host "") remote-compile-host host)
159 (if (string= user "") remote-compile-user user) 151 (if (string= user "") remote-compile-user user)
162 (cond (user 154 (cond (user
163 (setq remote-compile-user user)) 155 (setq remote-compile-user user))
164 ((null remote-compile-user) 156 ((null remote-compile-user)
165 (setq remote-compile-user (user-login-name)))) 157 (setq remote-compile-user (user-login-name))))
166 (let* (localname ;; Pacify byte-compiler. 158 (let* (localname ;; Pacify byte-compiler.
167 (parsed (and (featurep 'tramp)
168 (file-remote-p default-directory)))
169 (compile-command 159 (compile-command
170 (format "%s %s -l %s \"(%scd %s; %s)\"" 160 (format "%s %s -l %s \"(%scd %s; %s)\""
171 remote-shell-program 161 remote-shell-program
172 host 162 host
173 remote-compile-user 163 remote-compile-user
174 (if remote-compile-run-before 164 (if remote-compile-run-before
175 (concat remote-compile-run-before "; ") 165 (concat remote-compile-run-before "; ")
176 "") 166 "")
177 (if parsed 167 ""
178 (funcall (symbol-function 'with-parsed-tramp-file-name)
179 default-directory nil localname)
180 "")
181 compile-command))) 168 compile-command)))
182 (setq remote-compile-host host) 169 (setq remote-compile-host host)
183 (save-some-buffers nil nil) 170 (save-some-buffers nil nil)
184 (compilation-start compile-command) 171 (compilation-start compile-command)
185 ;; Set comint-file-name-prefix in the compilation buffer so 172 ;; Set comint-file-name-prefix in the compilation buffer so
186 ;; compilation-parse-errors will find referenced files by Tramp. 173 ;; compilation-parse-errors will find referenced files by Tramp.
187 (with-current-buffer compilation-last-buffer 174 (with-current-buffer compilation-last-buffer
188 (when (featurep 'tramp) 175 (when (fboundp 'tramp-make-tramp-file-name)
189 (set (make-local-variable 'comint-file-name-prefix) 176 (set (make-local-variable 'comint-file-name-prefix)
190 (funcall (symbol-function 'tramp-make-tramp-file-name) 177 (tramp-make-tramp-file-name
191 nil ;; method. 178 nil ;; method.
192 remote-compile-user 179 remote-compile-user
193 remote-compile-host 180 remote-compile-host
194 "")))))) 181 ""))))))
195 182
196 ;;; arch-tag: 2866a132-ece4-4ce9-9f91-ec147f803f73 183 ;; arch-tag: 2866a132-ece4-4ce9-9f91-ec147f803f73
197 ;;; rcompile.el ends here 184 ;;; rcompile.el ends here