Mercurial > emacs
comparison lisp/net/rcompile.el @ 71485:5b1bf37e044d
* net/rcompile.el (remote-compile): Replace ange-ftp based
implementation by Tramp functions. Based on a patch published by
Marc Abramowitz <msabramo@gmail.com>.
* net/tramp.el (tramp-unload-tramp): Provide a doc string.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Sun, 25 Jun 2006 21:05:03 +0000 |
parents | 067115a6e738 |
children | f7702c5f335d 138ce2701550 |
comparison
equal
deleted
inserted
replaced
71484:dbe1bcee0357 | 71485:5b1bf37e044d |
---|---|
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' | |
119 ;; and `tramp-make-tramp-file-name'. Better would be, if there are | |
120 ;; functions to provide user, host and localname of a remote filename, | |
121 ;; independent of Tramp's implementation. The function calls are | |
122 ;; wrapped by `funcall' in order to pacify the byte compiler. | |
123 ;; ange-ftp check removed, because it is handled also by Tramp. | |
118 ;;;###autoload | 124 ;;;###autoload |
119 (defun remote-compile (host user command) | 125 (defun remote-compile (host user command) |
120 "Compile the current buffer's directory on HOST. Log in as USER. | 126 "Compile the current buffer's directory on HOST. Log in as USER. |
121 See \\[compile]." | 127 See \\[compile]." |
122 (interactive | 128 (interactive |
123 (let ((parsed (or (and (featurep 'ange-ftp) | 129 (let ((parsed (and (featurep 'tramp) |
124 (ange-ftp-ftp-name default-directory)))) | 130 (file-remote-p default-directory))) |
125 host user command prompt) | 131 host user command prompt l l-host l-user) |
126 (if parsed | 132 (if parsed |
127 (setq host (nth 0 parsed) | 133 (funcall (symbol-function 'with-parsed-tramp-file-name) |
128 user (nth 1 parsed)) | 134 default-directory l |
135 (setq host l-host | |
136 user l-user)) | |
129 (setq prompt (if (stringp remote-compile-host) | 137 (setq prompt (if (stringp remote-compile-host) |
130 (format "Compile on host (default %s): " | 138 (format "Compile on host (default %s): " |
131 remote-compile-host) | 139 remote-compile-host) |
132 "Compile on host: ") | 140 "Compile on host: ") |
133 host (if (or remote-compile-prompt-for-host | 141 host (if (or remote-compile-prompt-for-host |
153 (setq compile-command command) | 161 (setq compile-command command) |
154 (cond (user | 162 (cond (user |
155 (setq remote-compile-user user)) | 163 (setq remote-compile-user user)) |
156 ((null remote-compile-user) | 164 ((null remote-compile-user) |
157 (setq remote-compile-user (user-login-name)))) | 165 (setq remote-compile-user (user-login-name)))) |
158 (let* ((parsed (and (featurep 'ange-ftp) | 166 (let* (localname ;; Pacify byte-compiler. |
159 (ange-ftp-ftp-name default-directory))) | 167 (parsed (and (featurep 'tramp) |
168 (file-remote-p default-directory))) | |
160 (compile-command | 169 (compile-command |
161 (format "%s %s -l %s \"(%scd %s; %s)\"" | 170 (format "%s %s -l %s \"(%scd %s; %s)\"" |
162 remote-shell-program | 171 remote-shell-program |
163 host | 172 host |
164 remote-compile-user | 173 remote-compile-user |
165 (if remote-compile-run-before | 174 (if remote-compile-run-before |
166 (concat remote-compile-run-before "; ") | 175 (concat remote-compile-run-before "; ") |
167 "") | 176 "") |
168 (if parsed (nth 2 parsed) default-directory) | 177 (if parsed |
178 (funcall (symbol-function 'with-parsed-tramp-file-name) | |
179 default-directory nil localname) | |
180 "") | |
169 compile-command))) | 181 compile-command))) |
170 (setq remote-compile-host host) | 182 (setq remote-compile-host host) |
171 (save-some-buffers nil nil) | 183 (save-some-buffers nil nil) |
172 (compilation-start compile-command) | 184 (compilation-start compile-command) |
173 ;; Set comint-file-name-prefix in the compilation buffer so | 185 ;; Set comint-file-name-prefix in the compilation buffer so |
174 ;; compilation-parse-errors will find referenced files by ange-ftp. | 186 ;; compilation-parse-errors will find referenced files by Tramp. |
175 (with-current-buffer compilation-last-buffer | 187 (with-current-buffer compilation-last-buffer |
176 (set (make-local-variable 'comint-file-name-prefix) | 188 (when (featurep 'tramp) |
177 (concat "/" host ":"))))) | 189 (set (make-local-variable 'comint-file-name-prefix) |
190 (funcall (symbol-function 'tramp-make-tramp-file-name) | |
191 nil ;; multi-method. To be removed with Tramp 2.1. | |
192 nil | |
193 remote-compile-user | |
194 remote-compile-host | |
195 "")))))) | |
178 | 196 |
179 ;;; arch-tag: 2866a132-ece4-4ce9-9f91-ec147f803f73 | 197 ;;; arch-tag: 2866a132-ece4-4ce9-9f91-ec147f803f73 |
180 ;;; rcompile.el ends here | 198 ;;; rcompile.el ends here |