annotate lisp/net/tramp-vc.el @ 47056:1afff47013bb

(FRAME_BLINK_OFF_CURSOR, FRAME_BLINK_OFF_CURSOR_WIDTH): New macros. (struct x_output): New fields blink_off_cursor, blink_off_cursor_width.
author Richard M. Stallman <rms@gnu.org>
date Tue, 27 Aug 2002 18:41:51 +0000
parents 7b663a89ef2a
children 09acf3f65bb5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1 ;;; tramp-vc.el --- Version control integration for TRAMP.el
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3 ;; Copyright (C) 2000 by Free Software Foundation, Inc.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5 ;; Author: Daniel Pittman <daniel@danann.net>
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6 ;; Keywords: comm, processes
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
9
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
13 ;; any later version.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
14
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
18 ;; GNU General Public License for more details.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
19
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
23 ;; Boston, MA 02111-1307, USA.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
24
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
25 ;;; Commentary:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
26
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
27 ;; See the main module, 'tramp.el' for discussion of the purpose of TRAMP.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
28 ;; This module provides integration between remote files accessed by TRAMP and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
29 ;; the Emacs version control system.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
30
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
31 ;;; Code:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
32
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
33 (eval-when-compile
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
34 (require 'cl))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
35 (require 'vc)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
36 ;; Old VC defines vc-rcs-release in vc.el, new VC requires extra module.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
37 (unless (boundp 'vc-rcs-release)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
38 (require 'vc-rcs))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
39 (require 'tramp)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
40
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
41 ;; -- vc --
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
42
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
43 ;; This used to blow away the file-name-handler-alist and reinstall
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
44 ;; TRAMP into it. This was intended to let VC work remotely. It didn't,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
45 ;; at least not in my XEmacs 21.2 install.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
46 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
47 ;; In any case, tramp-run-real-handler now deals correctly with disabling
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
48 ;; the things that should be, making this a no-op.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
49 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
50 ;; I have removed it from the tramp-file-name-handler-alist because the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
51 ;; shortened version does nothing. This is for reference only now.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
52 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
53 ;; Daniel Pittman <daniel@danann.net>
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
54 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
55 ;; (defun tramp-handle-vc-registered (file)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
56 ;; "Like `vc-registered' for tramp files."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
57 ;; (tramp-run-real-handler 'vc-registered (list file)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
58
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
59 ;; `vc-do-command'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
60 ;; This function does not deal well with remote files, so we define
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
61 ;; our own version and make a backup of the original function and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
62 ;; call our version for tramp files and the original version for
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
63 ;; normal files.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
64
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
65 ;; The following function is pretty much copied from vc.el, but
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
66 ;; the part that actually executes a command is changed.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
67 ;; CCC: this probably works for Emacs 21, too.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
68 (defun tramp-vc-do-command (buffer okstatus command file last &rest flags)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
69 "Like `vc-do-command' but invoked for tramp files.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
70 See `vc-do-command' for more information."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
71 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
72 (and file (setq file (tramp-handle-expand-file-name file)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
73 (if (not buffer) (setq buffer "*vc*"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
74 (if vc-command-messages
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
75 (message "Running `%s' on `%s'..." command file))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
76 (let ((obuf (current-buffer)) (camefrom (current-buffer))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
77 (squeezed nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
78 (olddir default-directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
79 vc-file status)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
80 (let* ((v (tramp-dissect-file-name (tramp-handle-expand-file-name file)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
81 (multi-method (tramp-file-name-multi-method v))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
82 (method (tramp-file-name-method v))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
83 (user (tramp-file-name-user v))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
84 (host (tramp-file-name-host v))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
85 (path (tramp-file-name-path v)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
86 (set-buffer (get-buffer-create buffer))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
87 (set (make-local-variable 'vc-parent-buffer) camefrom)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
88 (set (make-local-variable 'vc-parent-buffer-name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
89 (concat " from " (buffer-name camefrom)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
90 (setq default-directory olddir)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
91
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
92 (erase-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
93
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
94 (mapcar
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
95 (function
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
96 (lambda (s) (and s (setq squeezed (append squeezed (list s))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
97 flags)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
98 (if (and (eq last 'MASTER) file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
99 (setq vc-file (vc-name file)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
100 (setq squeezed
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
101 (append squeezed
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
102 (list (tramp-file-name-path
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
103 (tramp-dissect-file-name vc-file))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
104 (if (and file (eq last 'WORKFILE))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
105 (progn
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
106 (let* ((pwd (expand-file-name default-directory))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
107 (preflen (length pwd)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
108 (if (string= (substring file 0 preflen) pwd)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
109 (setq file (substring file preflen))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
110 (setq squeezed (append squeezed (list file)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
111 ;; Unless we (save-window-excursion) the layout of windows in
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
112 ;; the current frame changes. This is painful, at best.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
113 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
114 ;; As a point of note, (save-excursion) is still here only because
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
115 ;; it preserves (point) in the current buffer. (save-window-excursion)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
116 ;; does not, at least under XEmacs 21.2.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
117 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
118 ;; I trust that the FSF support this as well. I can't find useful
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
119 ;; documentation to check :(
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
120 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
121 ;; Daniel Pittman <daniel@danann.net>
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
122 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
123 (save-window-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
124 ;; Actually execute remote command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
125 (tramp-handle-shell-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
126 (mapconcat 'tramp-shell-quote-argument
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
127 (cons command squeezed) " ") t)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
128 ;;(tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
129 ;; Get status from command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
130 (tramp-send-command multi-method method user host "echo $?")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
131 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
132 ;; Make sure to get status from last line of output.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
133 (goto-char (point-max)) (forward-line -1)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
134 (setq status (read (current-buffer)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
135 (message "Command %s returned status %d." command status)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
136 (goto-char (point-max))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
137 (set-buffer-modified-p nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
138 (forward-line -1)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
139 (if (or (not (integerp status)) (and okstatus (< okstatus status)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
140 (progn
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
141 (pop-to-buffer buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
142 (goto-char (point-min))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
143 (shrink-window-if-larger-than-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
144 (error "Running `%s'...FAILED (%s)" command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
145 (if (integerp status)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
146 (format "status %d" status)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
147 status))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
148 )
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
149 (if vc-command-messages
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
150 (message "Running %s...OK" command))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
151 )
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
152 (set-buffer obuf)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
153 status))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
154 ))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
155
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
156 ;; Following code snarfed from Emacs 21 vc.el and slightly tweaked.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
157 (defun tramp-vc-do-command-new (buffer okstatus command file &rest flags)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
158 "Like `vc-do-command' but for TRAMP files.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
159 This function is for the new VC which comes with Emacs 21.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
160 Since TRAMP doesn't do async commands yet, this function doesn't, either."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
161 (and file (setq file (expand-file-name file)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
162 (if vc-command-messages
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
163 (message "Running %s on %s..." command file))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
164 (save-current-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
165 (unless (eq buffer t) (vc-setup-buffer buffer))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
166 (let ((squeezed nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
167 (inhibit-read-only t)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
168 (status 0))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
169 (let* ((v (when file (tramp-dissect-file-name file)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
170 (multi-method (when file (tramp-file-name-multi-method v)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
171 (method (when file (tramp-file-name-method v)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
172 (user (when file (tramp-file-name-user v)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
173 (host (when file (tramp-file-name-host v)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
174 (path (when file (tramp-file-name-path v))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
175 (setq squeezed (delq nil (copy-sequence flags)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
176 (when file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
177 (setq squeezed (append squeezed (list path))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
178 (let ((w32-quote-process-args t))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
179 (when (eq okstatus 'async)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
180 (message "Tramp doesn't do async commands, running synchronously."))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
181 (setq status (tramp-handle-shell-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
182 (mapconcat 'tramp-shell-quote-argument
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
183 (cons command squeezed) " ") t))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
184 (when (or (not (integerp status)) (and okstatus (< okstatus status)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
185 (pop-to-buffer (current-buffer))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
186 (goto-char (point-min))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
187 (shrink-window-if-larger-than-buffer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
188 (error "Running %s...FAILED (%s)" command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
189 (if (integerp status) (format "status %d" status) status))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
190 (if vc-command-messages
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
191 (message "Running %s...OK" command))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
192 (vc-exec-after
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
193 `(run-hook-with-args
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
194 'vc-post-command-functions ',command ',path ',flags))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
195 status))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
196
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
197
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
198 ;; The context for a VC command is the current buffer.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
199 ;; That makes a test on the buffers file more reliable than a test on the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
200 ;; arguments.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
201 ;; This is needed to handle remote VC correctly - else we test against the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
202 ;; local VC system and get things wrong...
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
203 ;; Daniel Pittman <daniel@danann.net>
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
204 ;;-(if (fboundp 'vc-call-backend)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
205 ;;- () ;; This is the new VC for which we don't have an appropriate advice yet
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
206 (if (fboundp 'vc-call-backend)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
207 (defadvice vc-do-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
208 (around tramp-advice-vc-do-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
209 (buffer okstatus command file &rest flags)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
210 activate)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
211 "Invoke tramp-vc-do-command for tramp files."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
212 (let ((file (symbol-value 'file))) ;pacify byte-compiler
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
213 (if (or (and (stringp file) (tramp-tramp-file-p file))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
214 (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
215 (setq ad-return-value
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
216 (apply 'tramp-vc-do-command-new buffer okstatus command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
217 file ;(or file (buffer-file-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
218 flags))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
219 ad-do-it)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
220 (defadvice vc-do-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
221 (around tramp-advice-vc-do-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
222 (buffer okstatus command file last &rest flags)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
223 activate)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
224 "Invoke tramp-vc-do-command for tramp files."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
225 (let ((file (symbol-value 'file))) ;pacify byte-compiler
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
226 (if (or (and (stringp file) (tramp-tramp-file-p file))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
227 (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
228 (setq ad-return-value
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
229 (apply 'tramp-vc-do-command buffer okstatus command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
230 (or file (buffer-file-name)) last flags))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
231 ad-do-it))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
232 ;;-)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
233
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
234
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
235 ;; XEmacs uses this to do some of its work. Like vc-do-command, we
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
236 ;; need to enhance it to make VC work via TRAMP-mode.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
237 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
238 ;; Like the previous function, this is a cut-and-paste job from the VC
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
239 ;; file. It's based on the vc-do-command code.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
240 ;; CCC: this isn't used in Emacs 21, so do as before.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
241 (defun tramp-vc-simple-command (okstatus command file &rest args)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
242 ;; Simple version of vc-do-command, for use in vc-hooks only.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
243 ;; Don't switch to the *vc-info* buffer before running the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
244 ;; command, because that would change its default directory
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
245 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
246 (let* ((v (tramp-dissect-file-name (tramp-handle-expand-file-name file)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
247 (multi-method (tramp-file-name-multi-method v))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
248 (method (tramp-file-name-method v))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
249 (user (tramp-file-name-user v))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
250 (host (tramp-file-name-host v))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
251 (path (tramp-file-name-path v)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
252 (save-excursion (set-buffer (get-buffer-create "*vc-info*"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
253 (erase-buffer))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
254 (let ((exec-path (append vc-path exec-path)) exec-status
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
255 ;; Add vc-path to PATH for the execution of this command.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
256 (process-environment
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
257 (cons (concat "PATH=" (getenv "PATH")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
258 path-separator
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
259 (mapconcat 'identity vc-path path-separator))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
260 process-environment)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
261 ;; Call the actual process. See tramp-vc-do-command for discussion of
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
262 ;; why this does both (save-window-excursion) and (save-excursion).
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
263 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
264 ;; As a note, I don't think that the process-environment stuff above
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
265 ;; has any effect on the remote system. This is a hard one though as
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
266 ;; there is no real reason to expect local and remote paths to be
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
267 ;; identical...
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
268 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
269 ;; Daniel Pittman <daniel@danann.net>
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
270 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
271 (save-window-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
272 ;; Actually execute remote command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
273 (tramp-handle-shell-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
274 (mapconcat 'tramp-shell-quote-argument
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
275 (append (list command) args (list path)) " ")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
276 (get-buffer-create"*vc-info*"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
277 ;(tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
278 ;; Get status from command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
279 (tramp-send-command multi-method method user host "echo $?")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
280 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
281 (setq exec-status (read (current-buffer)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
282 (message "Command %s returned status %d." command exec-status)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
283
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
284 (cond ((> exec-status okstatus)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
285 (switch-to-buffer (get-file-buffer file))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
286 (shrink-window-if-larger-than-buffer
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
287 (display-buffer "*vc-info*"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
288 (error "Couldn't find version control information")))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
289 exec-status))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
290
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
291 ;; This function does not exist any more in Emacs-21's VC
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
292 (defadvice vc-simple-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
293 (around tramp-advice-vc-simple-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
294 (okstatus command file &rest args)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
295 activate)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
296 "Invoke tramp-vc-simple-command for tramp files."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
297 (let ((file (symbol-value 'file))) ;pacify byte-compiler
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
298 (if (or (and (stringp file) (tramp-tramp-file-p file))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
299 (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
300 (setq ad-return-value
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
301 (apply 'tramp-vc-simple-command okstatus command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
302 (or file (buffer-file-name)) args))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
303 ad-do-it)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
304
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
305
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
306 ;; `vc-workfile-unchanged-p'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
307 ;; This function does not deal well with remote files, so we do the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
308 ;; same as for `vc-do-command'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
309
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
310 ;; `vc-workfile-unchanged-p' checks the modification time, we cannot
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
311 ;; do that for remote files, so here's a version which relies on diff.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
312 ;; CCC: this one probably works for Emacs 21, too.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
313 (defun tramp-vc-workfile-unchanged-p
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
314 (filename &optional want-differences-if-changed)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
315 (if (fboundp 'vc-backend-diff)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
316 ;; Old VC. Call `vc-backend-diff'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
317 (let ((status (funcall (symbol-function 'vc-backend-diff)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
318 filename nil nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
319 (not want-differences-if-changed))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
320 (zerop status))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
321 ;; New VC. Call `vc-default-workfile-unchanged-p'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
322 (vc-default-workfile-unchanged-p (vc-backend file) filename)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
323
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
324 (defadvice vc-workfile-unchanged-p
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
325 (around tramp-advice-vc-workfile-unchanged-p
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
326 (filename &optional want-differences-if-changed)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
327 activate)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
328 "Invoke tramp-vc-workfile-unchanged-p for tramp files."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
329 (if (and (stringp filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
330 (tramp-tramp-file-p filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
331 (not
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
332 (let ((v (tramp-dissect-file-name filename)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
333 (tramp-get-remote-perl (tramp-file-name-multi-method v)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
334 (tramp-file-name-method v)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
335 (tramp-file-name-user v)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
336 (tramp-file-name-host v)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
337 (setq ad-return-value
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
338 (tramp-vc-workfile-unchanged-p filename want-differences-if-changed))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
339 ad-do-it))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
340
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
341
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
342 ;; Redefine a function from vc.el -- allow tramp files.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
343 ;; `save-match-data' seems not to be required -- it isn't in
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
344 ;; the original version, either.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
345 ;; CCC: this might need some work -- how does the Emacs 21 version
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
346 ;; work, anyway? Does it work over ange-ftp? Hm.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
347 (if (not (fboundp 'vc-backend-checkout))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
348 () ;; our replacement won't work and is unnecessary anyway
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
349 (defun vc-checkout (filename &optional writable rev)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
350 "Retrieve a copy of the latest version of the given file."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
351 ;; If ftp is on this system and the name matches the ange-ftp format
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
352 ;; for a remote file, the user is trying something that won't work.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
353 (funcall (symbol-function 'vc-backend-checkout) filename writable rev)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
354 (vc-resynch-buffer filename t t))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
355 )
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
356
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
357
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
358 ;; Do we need to advise the vc-user-login-name function anyway?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
359 ;; This will return the correct login name for the owner of a
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
360 ;; file. It does not deal with the default remote user name...
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
361 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
362 ;; That is, when vc calls (vc-user-login-name), we return the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
363 ;; local login name, something that may be different to the remote
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
364 ;; default.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
365 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
366 ;; The remote VC operations will occur as the user that we logged
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
367 ;; in with however - not always the same as the local user.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
368 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
369 ;; In the end, I did advise the function. This is because, well,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
370 ;; the thing didn't work right otherwise ;)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
371 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
372 ;; Daniel Pittman <daniel@danann.net>
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
373
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
374 (defun tramp-handle-vc-user-login-name (&optional uid)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
375 "Return the default user name on the remote machine.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
376 Whenever VC calls this function, `file' is bound to the file name
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
377 in question. If no uid is provided or the uid is equal to the uid
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
378 owning the file, then we return the user name given in the file name.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
379
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
380 This should only be called when `file' is bound to the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
381 filename we are thinking about..."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
382 ;; Pacify byte-compiler; this symbol is bound in the calling
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
383 ;; function. CCC: Maybe it would be better to move the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
384 ;; boundness-checking into this function?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
385 (let ((file (symbol-value 'file)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
386 (if (and uid (/= uid (nth 2 (file-attributes file))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
387 (error "tramp-handle-vc-user-login-name cannot map a uid to a name")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
388 (let* ((v (tramp-dissect-file-name (tramp-handle-expand-file-name file)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
389 (u (tramp-file-name-user v)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
390 (cond ((stringp u) u)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
391 ((vectorp u) (elt u (1- (length u))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
392 ((null u) (user-login-name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
393 (t (error "tramp-handle-vc-user-login-name cannot cope!")))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
394
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
395
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
396 (defadvice vc-user-login-name
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
397 (around tramp-vc-user-login-name activate)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
398 "Support for files on remote machines accessed by TRAMP."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
399 ;; We rely on the fact that `file' is bound when this is called.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
400 ;; This appears to be the case everywhere in vc.el and vc-hooks.el
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
401 ;; as of Emacs 20.5.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
402 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
403 ;; CCC TODO there should be a real solution! Talk to Andre Spiegel
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
404 ;; about this.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
405 (let ((file (when (boundp 'file)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
406 (symbol-value 'file)))) ;pacify byte-compiler
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
407 (or (and (stringp file)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
408 (tramp-tramp-file-p file) ; tramp file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
409 (setq ad-return-value
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
410 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
411 (tramp-handle-vc-user-login-name uid)))) ; get the owner name
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
412 ad-do-it))) ; else call the original
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
413
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
414
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
415 ;; Determine the name of the user owning a file.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
416 (defun tramp-file-owner (filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
417 "Return who owns FILE (user name, as a string)."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
418 (let ((v (tramp-dissect-file-name
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
419 (tramp-handle-expand-file-name filename))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
420 (if (not (tramp-handle-file-exists-p filename))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
421 nil ; file cannot be opened
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
422 ;; file exists, find out stuff
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
423 (save-excursion
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
424 (tramp-send-command
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
425 (tramp-file-name-multi-method v) (tramp-file-name-method v)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
426 (tramp-file-name-user v) (tramp-file-name-host v)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
427 (format "%s -Lld %s"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
428 (tramp-get-ls-command (tramp-file-name-multi-method v)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
429 (tramp-file-name-method v)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
430 (tramp-file-name-user v)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
431 (tramp-file-name-host v))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
432 (tramp-shell-quote-argument (tramp-file-name-path v))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
433 (tramp-wait-for-output)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
434 ;; parse `ls -l' output ...
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
435 ;; ... file mode flags
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
436 (read (current-buffer))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
437 ;; ... number links
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
438 (read (current-buffer))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
439 ;; ... uid (as a string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
440 (symbol-name (read (current-buffer)))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
441
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
442 ;; Wire ourselves into the VC infrastructure...
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
443 ;; This function does not exist any more in Emacs-21's VC
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
444 ;; CCC: it appears that no substitute is needed for Emacs 21.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
445 (defadvice vc-file-owner
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
446 (around tramp-vc-file-owner activate)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
447 "Support for files on remote machines accessed by TRAMP."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
448 (let ((filename (ad-get-arg 0)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
449 (or (and (tramp-file-name-p filename) ; tramp file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
450 (setq ad-return-value
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
451 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
452 (tramp-file-owner filename)))) ; get the owner name
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
453 ad-do-it))) ; else call the original
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
454
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
455
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
456 ;; We need to make the version control software backend version
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
457 ;; information local to the current buffer. This is because each TRAMP
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
458 ;; buffer can (theoretically) have a different VC version and I am
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
459 ;; *way* too lazy to try and push the correct value into each new
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
460 ;; buffer.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
461 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
462 ;; Remote VC costs will just have to be paid, at least for the moment.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
463 ;; Well, at least, they will right until I feel guilty about doing a
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
464 ;; botch job here and fix it. :/
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
465 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
466 ;; Daniel Pittman <daniel@danann.net>
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
467 ;; CCC: this is probably still needed for Emacs 21.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
468 (defun tramp-vc-setup-for-remote ()
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
469 "Make the backend release variables buffer local.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
470 This makes remote VC work correctly at the cost of some processing time."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
471 (when (and (buffer-file-name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
472 (tramp-tramp-file-p (buffer-file-name)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
473 (make-local-variable 'vc-rcs-release)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
474 (setq vc-rcs-release nil)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
475 (add-hook 'find-file-hooks 'tramp-vc-setup-for-remote t)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
476
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
477 ;; No need to load this again if anyone asks.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
478 (provide 'tramp-vc)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
479
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
480 ;;; tramp-vc.el ends here