Mercurial > emacs
annotate lisp/net/tramp-compat.el @ 110594:76b6c21279ec
Don¸«£t give write_mask to select for W32.
process.c (wait_reading_process_output): Don't pass write_mask to select
if SELECT_CANT_DO_WRITE_MASK is defined.
(SELECT_CANT_DO_WRITE_MASK): Define if SELECT_CANT_DO_WRITE_MASK.
author | Jan D <jan.h.d@swipnet.se> |
---|---|
date | Sun, 26 Sep 2010 22:48:13 +0200 |
parents | 670fe38909f5 |
children | 4e901a2d3669 |
rev | line source |
---|---|
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
1 ;;; tramp-compat.el --- Tramp compatibility functions |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2 |
106815 | 3 ;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4 |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5 ;; Author: Michael Albinus <michael.albinus@gmx.de> |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
6 ;; Keywords: comm, processes |
110015
280c8ae2476d
Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents:
108975
diff
changeset
|
7 ;; Package: tramp |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
8 |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
10 |
94677
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94402
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
94677
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94402
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94402
diff
changeset
|
14 ;; (at your option) any later version. |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
15 |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
20 |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
94677
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94402
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
23 |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
24 ;;; Commentary: |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
25 |
107820
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
26 ;; Tramp's main Emacs version for development is GNU Emacs 24. This |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
27 ;; package provides compatibility functions for GNU Emacs 22, GNU |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
28 ;; Emacs 23 and XEmacs 21.4+. |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
29 |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
30 ;;; Code: |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
31 |
110319
f52a8c72912b
Revert revno 101418 by Bob Chassel.
Eli Zaretskii <eliz@gnu.org>
parents:
110317
diff
changeset
|
32 (require 'tramp-loaddefs) |
110264
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
33 |
87322
e99e230d7eb3
* files.el (cd-absolute): Set `list-buffers-directory' in order to
Michael Albinus <michael.albinus@gmx.de>
parents:
85067
diff
changeset
|
34 (eval-when-compile |
e99e230d7eb3
* files.el (cd-absolute): Set `list-buffers-directory' in order to
Michael Albinus <michael.albinus@gmx.de>
parents:
85067
diff
changeset
|
35 |
e99e230d7eb3
* files.el (cd-absolute): Set `list-buffers-directory' in order to
Michael Albinus <michael.albinus@gmx.de>
parents:
85067
diff
changeset
|
36 ;; Pacify byte-compiler. |
e99e230d7eb3
* files.el (cd-absolute): Set `list-buffers-directory' in order to
Michael Albinus <michael.albinus@gmx.de>
parents:
85067
diff
changeset
|
37 (require 'cl)) |
e99e230d7eb3
* files.el (cd-absolute): Set `list-buffers-directory' in order to
Michael Albinus <michael.albinus@gmx.de>
parents:
85067
diff
changeset
|
38 |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
39 (eval-and-compile |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
40 |
110321
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
110319
diff
changeset
|
41 (require 'advice) |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
42 (require 'custom) |
110321
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
110319
diff
changeset
|
43 (require 'format-spec) |
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
110319
diff
changeset
|
44 |
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
110319
diff
changeset
|
45 ;; As long as password.el is not part of (X)Emacs, it shouldn't be |
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
110319
diff
changeset
|
46 ;; mandatory. |
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
110319
diff
changeset
|
47 (if (featurep 'xemacs) |
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
110319
diff
changeset
|
48 (load "password" 'noerror) |
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
110319
diff
changeset
|
49 (or (require 'password-cache nil 'noerror) |
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
110319
diff
changeset
|
50 (require 'password nil 'noerror))) ; Part of contrib. |
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
110319
diff
changeset
|
51 |
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
110319
diff
changeset
|
52 ;; auth-source is relatively new. |
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
110319
diff
changeset
|
53 (if (featurep 'xemacs) |
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
110319
diff
changeset
|
54 (load "auth-source" 'noerror) |
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
110319
diff
changeset
|
55 (require 'auth-source nil 'noerror)) |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
56 |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
57 ;; Load the appropriate timer package. |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
58 (if (featurep 'xemacs) |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
59 (require 'timer-funcs) |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
60 (require 'timer)) |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
61 |
108975
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
62 ;; We check whether `start-file-process' is bound. |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
63 (unless (fboundp 'start-file-process) |
104808
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
64 |
108975
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
65 ;; tramp-util offers integration into other (X)Emacs packages like |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
66 ;; compile.el, gud.el etc. Not necessary in Emacs 23. |
85067
4636000015c5
* net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
67 (eval-after-load "tramp" |
110264
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
68 '(require 'tramp-util)) |
108975
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
69 |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
70 ;; Make sure that we get integration with the VC package. When it |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
71 ;; is loaded, we need to pull in the integration module. Not |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
72 ;; necessary in Emacs 23. |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
73 (eval-after-load "vc" |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
74 (eval-after-load "tramp" |
110264
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
75 '(require 'tramp-vc)))) |
85067
4636000015c5
* net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
76 |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
77 ;; Avoid byte-compiler warnings if the byte-compiler supports this. |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
78 ;; Currently, XEmacs supports this. |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
79 (when (featurep 'xemacs) |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
80 (unless (boundp 'byte-compile-default-warnings) |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
81 (defvar byte-compile-default-warnings nil)) |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
82 (delq 'unused-vars byte-compile-default-warnings)) |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
83 |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
84 ;; `last-coding-system-used' is unknown in XEmacs. |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
85 (unless (boundp 'last-coding-system-used) |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
86 (defvar last-coding-system-used nil)) |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
87 |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
88 ;; `directory-sep-char' is an obsolete variable in Emacs. But it is |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
89 ;; used in XEmacs, so we set it here and there. The following is |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
90 ;; needed to pacify Emacs byte-compiler. |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
91 (unless (boundp 'byte-compile-not-obsolete-var) |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
92 (defvar byte-compile-not-obsolete-var nil)) |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
93 (setq byte-compile-not-obsolete-var 'directory-sep-char) |
108377
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
94 ;; Emacs 23.2. |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
95 (unless (boundp 'byte-compile-not-obsolete-vars) |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
96 (defvar byte-compile-not-obsolete-vars nil)) |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
97 (setq byte-compile-not-obsolete-vars '(directory-sep-char)) |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
98 |
108377
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
99 ;; For not existing functions, or functions with a changed argument |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
100 ;; list, there are compiler warnings. We want to avoid them in |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
101 ;; cases we know what we do. |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
102 (defmacro tramp-compat-funcall (function &rest arguments) |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
103 (if (featurep 'xemacs) |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
104 `(funcall (symbol-function ,function) ,@arguments) |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
105 `(when (or (subrp ,function) (functionp ,function)) |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
106 (with-no-warnings (funcall ,function ,@arguments))))) |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
107 |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
108 ;; `set-buffer-multibyte' comes from Emacs Leim. |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
109 (unless (fboundp 'set-buffer-multibyte) |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
110 (defalias 'set-buffer-multibyte 'ignore)) |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
111 |
104808
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
112 ;; The following functions cannot be aliases of the corresponding |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
113 ;; `tramp-handle-*' functions, because this would bypass the locking |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
114 ;; mechanism. |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
115 |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
116 ;; `file-remote-p' has been introduced with Emacs 22. The version |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
117 ;; of XEmacs is not a magic file name function (yet); this is |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
118 ;; corrected in tramp-util.el. Here it is sufficient if the |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
119 ;; function exists. |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
120 (unless (fboundp 'file-remote-p) |
104808
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
121 (defalias 'file-remote-p |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
122 (lambda (file &optional identification connected) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
123 (when (tramp-tramp-file-p file) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
124 (tramp-file-name-handler |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
125 'file-remote-p file identification connected))))) |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
126 |
107820
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
127 ;; `process-file' does not exist in XEmacs. |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
128 (unless (fboundp 'process-file) |
104808
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
129 (defalias 'process-file |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
130 (lambda (program &optional infile buffer display &rest args) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
131 (when (tramp-tramp-file-p default-directory) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
132 (apply |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
133 'tramp-file-name-handler |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
134 'process-file program infile buffer display args))))) |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
135 |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
136 ;; `start-file-process' is new in Emacs 23. |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
137 (unless (fboundp 'start-file-process) |
104808
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
138 (defalias 'start-file-process |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
139 (lambda (name buffer program &rest program-args) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
140 (when (tramp-tramp-file-p default-directory) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
141 (apply |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
142 'tramp-file-name-handler |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
143 'start-file-process name buffer program program-args))))) |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
144 |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
145 ;; `set-file-times' is also new in Emacs 23. |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
146 (unless (fboundp 'set-file-times) |
104808
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
147 (defalias 'set-file-times |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
148 (lambda (filename &optional time) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
149 (when (tramp-tramp-file-p filename) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
150 (tramp-file-name-handler |
106613
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
151 'set-file-times filename time))))) |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
152 |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
153 ;; We currently use "[" and "]" in the filename format for IPv6 |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
154 ;; hosts of GNU Emacs. This means, that Emacs wants to expand |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
155 ;; wildcards if `find-file-wildcards' is non-nil, and then barfs |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
156 ;; because no expansion could be found. We detect this situation |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
157 ;; and do something really awful: we have `file-expand-wildcards' |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
158 ;; return the original filename if it can't expand anything. Let's |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
159 ;; just hope that this doesn't break anything else. |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
160 ;; It is not needed anymore since GNU Emacs 23.2. |
107820
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
161 (unless (or (featurep 'xemacs) |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
162 ;; `featurep' has only one argument in XEmacs. |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
163 (funcall 'featurep 'files 'remote-wildcards)) |
106613
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
164 (defadvice file-expand-wildcards |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
165 (around tramp-advice-file-expand-wildcards activate) |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
166 (let ((name (ad-get-arg 0))) |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
167 ;; If it's a Tramp file, look if wildcards need to be expanded |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
168 ;; at all. |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
169 (if (and |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
170 (tramp-tramp-file-p name) |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
171 (not (string-match |
108975
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
172 "[[*?]" (tramp-compat-funcall |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
173 'file-remote-p name 'localname)))) |
106613
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
174 (setq ad-return-value (list name)) |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
175 ;; Otherwise, just run the original function. |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
176 ad-do-it))) |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
177 (add-hook |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
178 'tramp-unload-hook |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
179 (lambda () |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
180 (ad-remove-advice |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
181 'file-expand-wildcards 'around 'tramp-advice-file-expand-wildcards) |
291ea018e478
* files.el (file-expand-wildcards): In case of remote files, check
Michael Albinus <michael.albinus@gmx.de>
parents:
105892
diff
changeset
|
182 (ad-activate 'file-expand-wildcards))))) |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
183 |
110374
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
184 ;; `with-temp-message' does not exists in XEmacs. |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
185 (if (fboundp 'with-temp-message) |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
186 (defalias 'tramp-compat-with-temp-message 'with-temp-message) |
110390
670fe38909f5
* net/tramp-compat.el (tramp-compat-with-temp-message): Make it a
Michael Albinus <michael.albinus@gmx.de>
parents:
110374
diff
changeset
|
187 (defmacro tramp-compat-with-temp-message (message &rest body) |
110374
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
188 "Display MESSAGE temporarily if non-nil while BODY is evaluated." |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
189 `(progn ,@body))) |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
190 |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
191 ;; `font-lock-add-keywords' does not exist in XEmacs. |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
192 (defun tramp-compat-font-lock-add-keywords (mode keywords &optional how) |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
193 "Add highlighting KEYWORDS for MODE." |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
194 (ignore-errors |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
195 (tramp-compat-funcall 'font-lock-add-keywords mode keywords how))) |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
196 |
104851
5e1bd0e3a13b
* net/tramp-compat.el (tramp-compat-line-beginning-position): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
104808
diff
changeset
|
197 (defsubst tramp-compat-line-beginning-position () |
5e1bd0e3a13b
* net/tramp-compat.el (tramp-compat-line-beginning-position): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
104808
diff
changeset
|
198 "Return point at beginning of line (compat function). |
5e1bd0e3a13b
* net/tramp-compat.el (tramp-compat-line-beginning-position): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
104808
diff
changeset
|
199 Calls `line-beginning-position' or `point-at-bol' if defined, else |
5e1bd0e3a13b
* net/tramp-compat.el (tramp-compat-line-beginning-position): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
104808
diff
changeset
|
200 own implementation." |
5e1bd0e3a13b
* net/tramp-compat.el (tramp-compat-line-beginning-position): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
104808
diff
changeset
|
201 (cond |
5e1bd0e3a13b
* net/tramp-compat.el (tramp-compat-line-beginning-position): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
104808
diff
changeset
|
202 ((fboundp 'line-beginning-position) |
108377
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
203 (tramp-compat-funcall 'line-beginning-position)) |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
204 ((fboundp 'point-at-bol) (tramp-compat-funcall 'point-at-bol)) |
104851
5e1bd0e3a13b
* net/tramp-compat.el (tramp-compat-line-beginning-position): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
104808
diff
changeset
|
205 (t (save-excursion (beginning-of-line) (point))))) |
5e1bd0e3a13b
* net/tramp-compat.el (tramp-compat-line-beginning-position): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
104808
diff
changeset
|
206 |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
207 (defsubst tramp-compat-line-end-position () |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
208 "Return point at end of line (compat function). |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
209 Calls `line-end-position' or `point-at-eol' if defined, else |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
210 own implementation." |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
211 (cond |
108377
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
212 ((fboundp 'line-end-position) (tramp-compat-funcall 'line-end-position)) |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
213 ((fboundp 'point-at-eol) (tramp-compat-funcall 'point-at-eol)) |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
214 (t (save-excursion (end-of-line) (point))))) |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
215 |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
216 (defsubst tramp-compat-temporary-file-directory () |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
217 "Return name of directory for temporary files (compat function). |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
218 For Emacs, this is the variable `temporary-file-directory', for XEmacs |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
219 this is the function `temp-directory'." |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
220 (cond |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
221 ((boundp 'temporary-file-directory) (symbol-value 'temporary-file-directory)) |
108377
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
222 ((fboundp 'temp-directory) (tramp-compat-funcall 'temp-directory)) |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
223 ((let ((d (getenv "TEMP"))) (and d (file-directory-p d))) |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
224 (file-name-as-directory (getenv "TEMP"))) |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
225 ((let ((d (getenv "TMP"))) (and d (file-directory-p d))) |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
226 (file-name-as-directory (getenv "TMP"))) |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
227 ((let ((d (getenv "TMPDIR"))) (and d (file-directory-p d))) |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
228 (file-name-as-directory (getenv "TMPDIR"))) |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
229 ((file-exists-p "c:/temp") (file-name-as-directory "c:/temp")) |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
230 (t (message (concat "Neither `temporary-file-directory' nor " |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
231 "`temp-directory' is defined -- using /tmp.")) |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
232 (file-name-as-directory "/tmp")))) |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
233 |
107820
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
234 ;; `make-temp-file' exists in Emacs only. On XEmacs, we use our own |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
235 ;; implementation with `make-temp-name', creating the temporary file |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
236 ;; immediately in order to avoid a security hole. |
107320
d2bfe26756ed
* net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix an
Michael Albinus <michael.albinus@gmx.de>
parents:
106815
diff
changeset
|
237 (defsubst tramp-compat-make-temp-file (filename &optional dir-flag) |
85041
a42b8750a992
* net/tramp.el (tramp-make-temp-file): Move to tramp-compat.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
85024
diff
changeset
|
238 "Create a temporary file (compat function). |
a42b8750a992
* net/tramp.el (tramp-make-temp-file): Move to tramp-compat.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
85024
diff
changeset
|
239 Add the extension of FILENAME, if existing." |
94402
2faa99de7eef
* net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents:
92981
diff
changeset
|
240 (let* (file-name-handler-alist |
2faa99de7eef
* net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents:
92981
diff
changeset
|
241 (prefix (expand-file-name |
2faa99de7eef
* net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents:
92981
diff
changeset
|
242 (symbol-value 'tramp-temp-name-prefix) |
2faa99de7eef
* net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents:
92981
diff
changeset
|
243 (tramp-compat-temporary-file-directory))) |
2faa99de7eef
* net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents:
92981
diff
changeset
|
244 (extension (file-name-extension filename t)) |
2faa99de7eef
* net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents:
92981
diff
changeset
|
245 result) |
108975
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
246 (condition-case nil |
85041
a42b8750a992
* net/tramp.el (tramp-make-temp-file): Move to tramp-compat.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
85024
diff
changeset
|
247 (setq result |
108377
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
248 (tramp-compat-funcall 'make-temp-file prefix dir-flag extension)) |
108975
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
249 (error |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
250 ;; We use our own implementation, taken from files.el. |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
251 (while |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
252 (condition-case () |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
253 (progn |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
254 (setq result (concat (make-temp-name prefix) extension)) |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
255 (if dir-flag |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
256 (make-directory result) |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
257 (write-region "" nil result nil 'silent)) |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
258 nil) |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
259 (file-already-exists t)) |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
260 ;; The file was somehow created by someone else between |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
261 ;; `make-temp-name' and `write-region', let's try again. |
c4552014bea2
* net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents:
108816
diff
changeset
|
262 nil))) |
85041
a42b8750a992
* net/tramp.el (tramp-make-temp-file): Move to tramp-compat.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
85024
diff
changeset
|
263 result)) |
a42b8750a992
* net/tramp.el (tramp-make-temp-file): Move to tramp-compat.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
85024
diff
changeset
|
264 |
107820
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
265 ;; `most-positive-fixnum' does not exist in XEmacs. |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
266 (defsubst tramp-compat-most-positive-fixnum () |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
267 "Return largest positive integer value (compat function)." |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
268 (cond |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
269 ((boundp 'most-positive-fixnum) (symbol-value 'most-positive-fixnum)) |
107820
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
270 ;; Default value in XEmacs. |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84992
diff
changeset
|
271 (t 134217727))) |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
272 |
110264
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
273 (defun tramp-compat-decimal-to-octal (i) |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
274 "Return a string consisting of the octal digits of I. |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
275 Not actually used. Use `(format \"%o\" i)' instead?" |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
276 (cond ((< i 0) (error "Cannot convert negative number to octal")) |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
277 ((not (integerp i)) (error "Cannot convert non-integer to octal")) |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
278 ((zerop i) "0") |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
279 (t (concat (tramp-compat-decimal-to-octal (/ i 8)) |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
280 (number-to-string (% i 8)))))) |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
281 |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
282 ;; Kudos to Gerd Moellmann for this suggestion. |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
283 (defun tramp-compat-octal-to-decimal (ostr) |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
284 "Given a string of octal digits, return a decimal number." |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
285 (let ((x (or ostr ""))) |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
286 ;; `save-match' is in `tramp-mode-string-to-int' which calls this. |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
287 (unless (string-match "\\`[0-7]*\\'" x) |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
288 (error "Non-octal junk in string `%s'" x)) |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
289 (string-to-number ostr 8))) |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
290 |
107820
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
291 ;; ID-FORMAT does not exists in XEmacs. |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
292 (defun tramp-compat-file-attributes (filename &optional id-format) |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
293 "Like `file-attributes' for Tramp files (compat function)." |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
294 (cond |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
295 ((or (null id-format) (eq id-format 'integer)) |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
296 (file-attributes filename)) |
104808
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
297 ((tramp-tramp-file-p filename) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
298 (tramp-file-name-handler 'file-attributes filename id-format)) |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
299 (t (condition-case nil |
108377
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
300 (tramp-compat-funcall 'file-attributes filename id-format) |
108269
96984953f99e
* net/tramp.el (top, with-progress-reporter): Use
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
301 (wrong-number-of-arguments (file-attributes filename)))))) |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
302 |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
303 ;; PRESERVE-UID-GID has been introduced with Emacs 23. It does not |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
304 ;; hurt to ignore it for other (X)Emacs versions. |
108377
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
305 ;; PRESERVE-SELINUX-CONTEXT has been introduced with Emacs 24. |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
306 (defun tramp-compat-copy-file |
108377
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
307 (filename newname &optional ok-if-already-exists keep-date |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
308 preserve-uid-gid preserve-selinux-context) |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
309 "Like `copy-file' for Tramp files (compat function)." |
108377
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
310 (cond |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
311 (preserve-selinux-context |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
312 (tramp-compat-funcall |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
313 'copy-file filename newname ok-if-already-exists keep-date |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
314 preserve-uid-gid preserve-selinux-context)) |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
315 (preserve-uid-gid |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
316 (tramp-compat-funcall |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
317 'copy-file filename newname ok-if-already-exists keep-date |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
318 preserve-uid-gid)) |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
319 (t |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
320 (copy-file filename newname ok-if-already-exists keep-date)))) |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
321 |
105892
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
322 ;; `copy-directory' is a new function in Emacs 23.2. Implementation |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
323 ;; is taken from there. |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
324 (defun tramp-compat-copy-directory |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
325 (directory newname &optional keep-time parents) |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
326 "Make a copy of DIRECTORY (compat function)." |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
327 (if (fboundp 'copy-directory) |
108377
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
328 (tramp-compat-funcall 'copy-directory directory newname keep-time parents) |
105892
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
329 |
107820
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
330 ;; If `default-directory' is a remote directory, make sure we find |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
331 ;; its `copy-directory' handler. |
105892
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
332 (let ((handler (or (find-file-name-handler directory 'copy-directory) |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
333 (find-file-name-handler newname 'copy-directory)))) |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
334 (if handler |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
335 (funcall handler 'copy-directory directory newname keep-time parents) |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
336 |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
337 ;; Compute target name. |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
338 (setq directory (directory-file-name (expand-file-name directory)) |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
339 newname (directory-file-name (expand-file-name newname))) |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
340 (if (and (file-directory-p newname) |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
341 (not (string-equal (file-name-nondirectory directory) |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
342 (file-name-nondirectory newname)))) |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
343 (setq newname |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
344 (expand-file-name |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
345 (file-name-nondirectory directory) newname))) |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
346 (if (not (file-directory-p newname)) (make-directory newname parents)) |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
347 |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
348 ;; Copy recursively. |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
349 (mapc |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
350 (lambda (file) |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
351 (if (file-directory-p file) |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
352 (tramp-compat-copy-directory file newname keep-time parents) |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
353 (copy-file file newname t keep-time))) |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
354 ;; We do not want to delete "." and "..". |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
355 (directory-files |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
356 directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")) |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
357 |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
358 ;; Set directory attributes. |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
359 (set-file-modes newname (file-modes directory)) |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
360 (if keep-time |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
361 (set-file-times newname (nth 5 (file-attributes directory)))))))) |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
362 |
108806
511da81b16c5
Change delete-by-moving-to-trash so Lisp calls explicitly request trashing.
Chong Yidong <cyd@stupidchicken.com>
parents:
108377
diff
changeset
|
363 ;; TRASH has been introduced with Emacs 24.1. |
511da81b16c5
Change delete-by-moving-to-trash so Lisp calls explicitly request trashing.
Chong Yidong <cyd@stupidchicken.com>
parents:
108377
diff
changeset
|
364 (defun tramp-compat-delete-file (filename &optional trash) |
108244
2ee48fcc701c
Add FORCE argument to `delete-file'.
Michael Albinus <michael.albinus@gmx.de>
parents:
107820
diff
changeset
|
365 "Like `delete-file' for Tramp files (compat function)." |
108806
511da81b16c5
Change delete-by-moving-to-trash so Lisp calls explicitly request trashing.
Chong Yidong <cyd@stupidchicken.com>
parents:
108377
diff
changeset
|
366 (condition-case nil |
511da81b16c5
Change delete-by-moving-to-trash so Lisp calls explicitly request trashing.
Chong Yidong <cyd@stupidchicken.com>
parents:
108377
diff
changeset
|
367 (tramp-compat-funcall 'delete-file filename trash) |
511da81b16c5
Change delete-by-moving-to-trash so Lisp calls explicitly request trashing.
Chong Yidong <cyd@stupidchicken.com>
parents:
108377
diff
changeset
|
368 ;; This Emacs version does not support the TRASH flag. |
511da81b16c5
Change delete-by-moving-to-trash so Lisp calls explicitly request trashing.
Chong Yidong <cyd@stupidchicken.com>
parents:
108377
diff
changeset
|
369 (wrong-number-of-arguments |
511da81b16c5
Change delete-by-moving-to-trash so Lisp calls explicitly request trashing.
Chong Yidong <cyd@stupidchicken.com>
parents:
108377
diff
changeset
|
370 (let ((delete-by-moving-to-trash |
511da81b16c5
Change delete-by-moving-to-trash so Lisp calls explicitly request trashing.
Chong Yidong <cyd@stupidchicken.com>
parents:
108377
diff
changeset
|
371 (and (boundp 'delete-by-moving-to-trash) |
108816
94d1d8a6dcfd
* net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents:
108806
diff
changeset
|
372 (symbol-value 'delete-by-moving-to-trash) |
108806
511da81b16c5
Change delete-by-moving-to-trash so Lisp calls explicitly request trashing.
Chong Yidong <cyd@stupidchicken.com>
parents:
108377
diff
changeset
|
373 trash))) |
511da81b16c5
Change delete-by-moving-to-trash so Lisp calls explicitly request trashing.
Chong Yidong <cyd@stupidchicken.com>
parents:
108377
diff
changeset
|
374 (delete-file filename))))) |
108244
2ee48fcc701c
Add FORCE argument to `delete-file'.
Michael Albinus <michael.albinus@gmx.de>
parents:
107820
diff
changeset
|
375 |
105892
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
376 ;; RECURSIVE has been introduced with Emacs 23.2. |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
377 (defun tramp-compat-delete-directory (directory &optional recursive) |
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
378 "Like `delete-directory' for Tramp files (compat function)." |
107820
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
379 (if (null recursive) |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
380 (delete-directory directory) |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
381 (condition-case nil |
108377
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
382 (tramp-compat-funcall 'delete-directory directory recursive) |
107820
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
383 ;; This Emacs version does not support the RECURSIVE flag. We |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
384 ;; use the implementation from Emacs 23.2. |
108269
96984953f99e
* net/tramp.el (top, with-progress-reporter): Use
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
385 (wrong-number-of-arguments |
107820
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
386 (setq directory (directory-file-name (expand-file-name directory))) |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
387 (if (not (file-symlink-p directory)) |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
388 (mapc (lambda (file) |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
389 (if (eq t (car (file-attributes file))) |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
390 (tramp-compat-delete-directory file recursive) |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
391 (delete-file file))) |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
392 (directory-files |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
393 directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*"))) |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
394 (delete-directory directory))))) |
105892
ac069dcbfe75
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105493
diff
changeset
|
395 |
107820
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
396 ;; `number-sequence' does not exist in XEmacs. Implementation is |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
107320
diff
changeset
|
397 ;; taken from Emacs 23. |
104808
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
398 (defun tramp-compat-number-sequence (from &optional to inc) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
399 "Return a sequence of numbers from FROM to TO as a list (compat function)." |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
400 (if (or (subrp 'number-sequence) (symbol-file 'number-sequence)) |
108377
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
401 (tramp-compat-funcall 'number-sequence from to inc) |
104808
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
402 (if (or (not to) (= from to)) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
403 (list from) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
404 (or inc (setq inc 1)) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
405 (when (zerop inc) (error "The increment can not be zero")) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
406 (let (seq (n 0) (next from)) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
407 (if (> inc 0) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
408 (while (<= next to) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
409 (setq seq (cons next seq) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
410 n (1+ n) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
411 next (+ from (* n inc)))) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
412 (while (>= next to) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
413 (setq seq (cons next seq) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
414 n (1+ n) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
415 next (+ from (* n inc))))) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
416 (nreverse seq))))) |
90ec0abf1017
* net/tramp-compat.el (top): Autoload used functions from
Michael Albinus <michael.albinus@gmx.de>
parents:
103529
diff
changeset
|
417 |
103529
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
418 (defun tramp-compat-split-string (string pattern) |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
419 "Like `split-string' but omit empty strings. |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
420 In Emacs, (split-string \"/foo/bar\" \"/\") returns (\"foo\" \"bar\"). |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
421 This is, the first, empty, element is omitted. In XEmacs, the first |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
422 element is not omitted." |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
423 (delete "" (split-string string pattern))) |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
424 |
110264
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
425 (defun tramp-compat-call-process |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
426 (program &optional infile destination display &rest args) |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
427 "Calls `call-process' on the local host. |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
428 This is needed because for some Emacs flavors Tramp has |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
429 defadviced `call-process' to behave like `process-file'. The |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
430 Lisp error raised when PROGRAM is nil is trapped also, returning 1." |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
431 (let ((default-directory |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
432 (if (file-remote-p default-directory) |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
433 (tramp-compat-temporary-file-directory) |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
434 default-directory))) |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
435 (if (executable-find program) |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
436 (apply 'call-process program infile destination display args) |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
437 1))) |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
438 |
103529
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
439 (defun tramp-compat-process-running-p (process-name) |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
440 "Returns `t' if system process PROCESS-NAME is running for `user-login-name'." |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
441 (when (stringp process-name) |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
442 (cond |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
443 ;; GNU Emacs 22 on w32. |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
444 ((fboundp 'w32-window-exists-p) |
108377
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
445 (tramp-compat-funcall 'w32-window-exists-p process-name process-name)) |
103529
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
446 |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
447 ;; GNU Emacs 23. |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
448 ((and (fboundp 'list-system-processes) (fboundp 'process-attributes)) |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
449 (let (result) |
108377
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
450 (dolist (pid (tramp-compat-funcall 'list-system-processes) result) |
7827d5a5c826
* net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents:
108269
diff
changeset
|
451 (let ((attributes (tramp-compat-funcall 'process-attributes pid))) |
105493
c8d4e5f3f0c8
(tramp-compat-process-running-p): Check that
Sam Steingold <sds@gnu.org>
parents:
105044
diff
changeset
|
452 (when (and (string-equal |
c8d4e5f3f0c8
(tramp-compat-process-running-p): Check that
Sam Steingold <sds@gnu.org>
parents:
105044
diff
changeset
|
453 (cdr (assoc 'user attributes)) (user-login-name)) |
c8d4e5f3f0c8
(tramp-compat-process-running-p): Check that
Sam Steingold <sds@gnu.org>
parents:
105044
diff
changeset
|
454 (let ((comm (cdr (assoc 'comm attributes)))) |
c8d4e5f3f0c8
(tramp-compat-process-running-p): Check that
Sam Steingold <sds@gnu.org>
parents:
105044
diff
changeset
|
455 ;; The returned command name could be truncated |
c8d4e5f3f0c8
(tramp-compat-process-running-p): Check that
Sam Steingold <sds@gnu.org>
parents:
105044
diff
changeset
|
456 ;; to 15 characters. Therefore, we cannot check |
c8d4e5f3f0c8
(tramp-compat-process-running-p): Check that
Sam Steingold <sds@gnu.org>
parents:
105044
diff
changeset
|
457 ;; for `string-equal'. |
c8d4e5f3f0c8
(tramp-compat-process-running-p): Check that
Sam Steingold <sds@gnu.org>
parents:
105044
diff
changeset
|
458 (and comm (string-match |
c8d4e5f3f0c8
(tramp-compat-process-running-p): Check that
Sam Steingold <sds@gnu.org>
parents:
105044
diff
changeset
|
459 (concat "^" (regexp-quote comm)) |
c8d4e5f3f0c8
(tramp-compat-process-running-p): Check that
Sam Steingold <sds@gnu.org>
parents:
105044
diff
changeset
|
460 process-name)))) |
103529
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
461 (setq result t)))))) |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
462 |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
463 ;; Fallback, if there is no Lisp support yet. |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
464 (t (let ((default-directory |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
465 (if (file-remote-p default-directory) |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
466 (tramp-compat-temporary-file-directory) |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
467 default-directory)) |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
468 (unix95 (getenv "UNIX95")) |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
469 result) |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
470 (setenv "UNIX95" "1") |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
471 (when (member |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
472 (user-login-name) |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
473 (tramp-compat-split-string |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
474 (shell-command-to-string |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
475 (format "ps -C %s -o user=" process-name)) |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
476 "[ \f\t\n\r\v]+")) |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
477 (setq result t)) |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
478 (setenv "UNIX95" unix95) |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
479 result))))) |
83914fa17916
* net/tramp-compat.el (tramp-compat-split-string)
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
480 |
110374
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
481 ;; The following functions do not exist in XEmacs. We ignore this; |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
482 ;; they are used for checking a remote tty. |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
483 (defun tramp-compat-process-get (process propname) |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
484 "Return the value of PROCESS' PROPNAME property. |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
485 This is the last value stored with `(process-put PROCESS PROPNAME VALUE)'." |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
486 (ignore-errors (tramp-compat-funcall 'process-get process propname))) |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
487 |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
488 (defun tramp-compat-process-put (process propname value) |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
489 "Change PROCESS' PROPNAME property to VALUE. |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
490 It can be retrieved with `(process-get PROCESS PROPNAME)'." |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
491 (ignore-errors (tramp-compat-funcall 'process-put process propname value))) |
932697ced7aa
* net/tramp-compat.el (tramp-compat-with-temp-message)
Michael Albinus <michael.albinus@gmx.de>
parents:
110321
diff
changeset
|
492 |
110264
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
493 (add-hook 'tramp-unload-hook |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
494 (lambda () |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
495 (unload-feature 'tramp-compat 'force))) |
ec526909f60b
Migrate to Tramp 2.2. Rearrange load dependencies.
Michael Albinus <michael.albinus@gmx.de>
parents:
110015
diff
changeset
|
496 |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
497 (provide 'tramp-compat) |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
498 |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
499 ;;; TODO: |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
500 |
84992 | 501 ;; arch-tag: 0e724b18-6699-4f87-ad96-640b272e5c85 |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
502 ;;; tramp-compat.el ends here |