Sync to HEAD
[bpt/emacs.git] / lisp / net / tramp-util.el
1 ;;; -*- coding: iso-2022-7bit; -*-
2 ;;; tramp-util.el --- Misc utility functions to use with Tramp
3
4 ;; Copyright (C) 2001 Free Software Foundation, Inc.
5
6 ;; Author: Kai Gro\e,A_\e(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
7 ;; Keywords: comm, extensions, processes
8
9 ;; This file is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; any later version.
13
14 ;; This file is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to
21 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
23
24 ;;; Commentary:
25
26 ;; Some misc. utility functions that might go nicely with Tramp.
27 ;; Mostly, these are kluges awaiting real solutions later on.
28
29 ;;; Code:
30
31 (eval-when-compile (require 'cl))
32 (require 'compile)
33 (require 'tramp)
34
35 (defun tramp-compile (command)
36 "Compile on remote host."
37 (interactive
38 (if (or compilation-read-command current-prefix-arg)
39 (list (read-from-minibuffer "Compile command: "
40 compile-command nil nil
41 '(compile-history . 1)))
42 (list compile-command)))
43 (setq compile-command command)
44 (save-some-buffers (not compilation-ask-about-save) nil)
45 (let ((d default-directory))
46 (save-excursion
47 (pop-to-buffer (get-buffer-create "*Compilation*") t)
48 (erase-buffer)
49 (setq default-directory d)))
50 (tramp-handle-shell-command command (get-buffer "*Compilation*"))
51 (pop-to-buffer (get-buffer "*Compilation*"))
52 (compilation-minor-mode 1))
53
54 (provide 'tramp-util)
55
56 ;;; arch-tag: 500f9992-a44e-46d0-83a7-980799251808
57 ;;; tramp-util.el ends here