+2003-02-05 Kai Gro\e,A_\e(Bjohann <kai.grossjohann@uni-duisburg.de>
+
+ * ido.el (ido-define-mode-map): Interact with Viper. From Kim F
+ Storm.
+
+2003-02-05 Kai Gro\e,A_\e(Bjohann <kai.grossjohann@uni-duisburg.de>
+
+ Version 2.0.29 released.
+
+ * net/tramp.el (tramp-send-region): Protect against
+ tramp-chunksize being nil.
+
+2003-02-04 Michael Albinus <Michael.Albinus@alcatel.de>
+
+ * net/tramp.el (tramp-handle-directory-file-name): Handle the case
+ PATH is "".
+ (tramp-completion-handle-file-name-all-completions): Define
+ `tramp-current-user' locally. See `tramp-parse-passwd'.
+ (tramp-parse-passwd): For su-alike methods it would be desirable
+ to return "root@localhost" as default. Unfortunately, we have no
+ information whether any user name has been typed already. So we
+ (mis-)use tramp-current-user as indication, assuming it is set in
+ `tramp-completion-handle-file-name-all-completions'.
+ (tramp-send-region): Handle the case `tramp-chunksize' is equal
+ 0. I did it accidently. Infinite loop ...
+
+ * net/tramp-ftp.el (top-level): eval-after-load "ange-ftp"
+ '(tramp-disable-ange-ftp). Suggested by Kai.
+ (tramp-ftp-file-name-handler): `tramp-disable-ange-ftp' not needed
+ any longer.
+
+ * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Apply
+ `tramp-handle-directory-file-name' in order to profit from Kai's
+ yesterday changes.
+
+2003-02-03 Kai Gro\e,A_\e(Bjohann <kai.grossjohann@uni-duisburg.de>
+
+ * net/tramp.el (tramp-chunksize): Set default to 500 as workaround
+ for some ssh connections.
+ (tramp-handle-directory-file-name): New implementation. Not sure
+ if it works.
+
+2003-01-28 Michael Albinus <Michael.Albinus@alcatel.de>
+
+ * net/tramp.el (tramp-get-device): `tramp-make-tramp-file-name'
+ must not be called with NIL path. It fails in case of
+ multi-method.
+
+2003-01-27 Michael Albinus <Michael.Albinus@alcatel.de>
+
+ * net/tramp.el (tramp-file-name-for-operation): Apply
+ `expand-file-name' for relative file names only. Otherwise there
+ might be problems if the default directory is another Tramp
+ directory as the directory the file is based on.
+ (tramp-find-foreign-file-name-handler): Check whether FILENAME is
+ a Tramp file name. It isn't if it comes from an expanded file
+ name (like "/xx:yy//zz").
+
+2003-01-25 Michael Albinus <Michael.Albinus@alcatel.de>
+
+ * net/tramp.el (tramp-devices): New variable. Keeps virtual
+ device numbers. Devices must distinguish physical file systems.
+ The device numbers provided by "lstat" aren't unique, because we
+ operate on different hosts. So we use virtual device numbers,
+ generated by `tramp-get-device'. Both Ange-FTP and EFS use device
+ number -1. In order to be different, we use device number (-1 x),
+ whereby "x" is unique for a given (multi-method method user host).
+ Suggested by Kai.
+ (tramp-perl-file-attributes): Always return device number -1.
+ There will be a virtual device number set in
+ `tramp-handle-file-attributes', which replaces this one.
+ (tramp-handle-file-attributes): Set virtual device number.
+ (tramp-get-device): New function. Returns the virtual device
+ number. If it doesn't exist, generate a new one.
+ (tramp-handle-file-regular-p): Use Emacs file name primitives
+ instead of calling tramp-handle-* equivalents directly. Needed
+ for tramp-smb.
+
+ * net/tramp-smb.el (tramp-smb-devices, tramp-smb-get-device): Removed.
+ Functionality moved to tramp.el.
+ (tramp-smb-handle-file-attributes): Apply
+ `tramp-get-device'. ATIME and CTIME are (0 0) now (= "don't
+ know"), which is more honest.
+ (tramp-smb-handle-make-directory): Use Emacs file name primitives
+ instead of calling tramp-smb-handle-* equivalents directly.
+ (tramp-smb-read-file-entry): Return size as a number but a string.
+
+2003-01-24 Michael Albinus <Michael.Albinus@alcatel.de>
+
+ * net/tramp.el (tramp-completion-function-alist-ssh): Add parsing
+ of "/etc/ssh_config" and "~/.ssh/config". Suggested by Kai.
+ (tramp-completion-function-alist, tramp-set-completion-function):
+ Doc string update.
+ (tramp-parse-sconfig, tramp-parse-sconfig-group): New functions.
+ Provide parsing of "~/.ssh/config" style files.
+
+2003-01-21 Michael Albinus <Michael.Albinus@alcatel.de>
+
+ * net/tramp.el (tramp-completion-handle-expand-file-name): Apply
+ `tramp-drop-volume-letter'. Otherwise, there are problems on W32
+ systems.
+
+2003-01-21 Michael Albinus <Michael.Albinus@alcatel.de>
+
+ * net/tramp-smb.el (tramp-smb-get-device, tramp-smb-get-inode): New
+ functions. Device number and inode number don't exist for SMB
+ files. Therefore we must generate virtual ones.
+ (tramp-smb-devices, tramp-smb-inodes): New variables. Keep
+ generated virtual device numbers and inodes numbers for SMB files.
+ (tramp-smb-handle-file-attributes): Apply them.
+
+2003-01-14 Kai Gro\e,A_\e(Bjohann <kai.grossjohann@uni-duisburg.de>
+
+ * net/tramp.el (tramp-md5-function): Require md5 before checking
+ function md5. If using md5-encode, put wrapper around it that
+ converts vector of bytes to ascii text.
+
+2003-01-13 Michael Albinus <Michael.Albinus@alcatel.de>
+
+ * net/tramp.el (tramp-completion-mode): Perform check (integerp
+ last-input-event) before (event-modifiers last-input-event) -
+ there might be problems if `last-input-event' is a mouse event.
+
+2003-01-12 Michael Albinus <Michael.Albinus@alcatel.de>
+
+ * net/tramp.el (tramp-parse-rhosts, tramp-parse-shosts)
+ (tramp-parse-hosts, tramp-parse-passwd, tramp-parse-netrc): Use
+ `file-readable-p' instead of `file-exists-p'. Otherwise these
+ functions might block. Reported by <kin@neoscale.com>.
+
+2003-01-02 Michael Albinus <Michael.Albinus@alcatel.de>
+
+ * net/tramp-ftp.el (top-level): Defaults for
+ `tramp-default-method-alist' must be a list.
+
+ * net/tramp-smb.el (top-level): Defaults for
+ `tramp-default-method-alist' must be a list.
+
+2003-01-02 Kai Gro\e,A_\e(Bjohann <kai.grossjohann@uni-duisburg.de>
+
+ * net/tramp.el (top-level): Avoid byte-compiler warnings of unused
+ variables if the byte-compiler supports this. This is for the
+ with-parsed-tramp-file-name macro which is wont to produce such
+ stuff.
+
2003-02-04 Richard M. Stallman <rms@gnu.org>
* term.el (term-raw-map): Set it up at load time.
2002-08-21 Kai Gro\e,A_\e(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
- * tramp.el: Version 2.0.13 released.
+ * net/tramp.el: Version 2.0.13 released.
(tramp-handle-write-region): Don't check to see if remote end is
awake after sending data to remote host: we want to send "EOF" not
"echo are you awake"...
;;; tramp-smb.el --- Tramp access functions for SMB servers -*- coding: iso-8859-1; -*-
-;; Copyright (C) 2002 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2003 Free Software Foundation, Inc.
;; Author: Michael Albinus <Michael.Albinus@alcatel.de>
;; Keywords: comm, processes
;; Add a default for `tramp-default-method-alist'. Rule: If there is
;; a domain in USER, it must be the SMB method.
(add-to-list 'tramp-default-method-alist
- '("%" "" tramp-smb-method))
+ (list "%" "" tramp-smb-method))
;; Add completion function for SMB method.
(tramp-set-completion-function
This variable is local to each buffer.")
(make-variable-buffer-local 'tramp-smb-process-running)
+(defvar tramp-smb-inodes nil
+ "Keeps virtual inodes numbers for SMB files.")
+
;; New handlers should be added here.
(defconst tramp-smb-file-name-handler-alist
'(
(delete-directory . tramp-smb-handle-delete-directory)
(delete-file . tramp-smb-handle-delete-file)
;; `diff-latest-backup-file' performed by default handler
- ;; `directory-file-name' performed by default handler
+ (directory-file-name . tramp-handle-directory-file-name)
(directory-files . tramp-smb-handle-directory-files)
(directory-files-and-attributes . tramp-smb-handle-directory-files-and-attributes)
(dired-call-process . tramp-smb-not-handled)
(file (tramp-smb-get-path path nil))
(entries (tramp-smb-get-file-entries user host share file))
(entry (and entries
- (assoc (file-name-nondirectory file) entries))))
+ (assoc (file-name-nondirectory file) entries)))
+ (inode (tramp-smb-get-inode share file))
+ (device (tramp-get-device nil tramp-smb-method user host)))
+
; check result
(when entry
(list (and (string-match "d" (nth 1 entry))
-1 ;1 link count
-1 ;2 uid
-1 ;3 gid
- (nth 3 entry) ;4 atime
+ '(0 0) ;4 atime
(nth 3 entry) ;5 mtime
- (nth 3 entry) ;6 ctime
+ '(0 0) ;6 ctime
(nth 2 entry) ;7 size
(nth 1 entry) ;8 mode
nil ;9 gid weird
- -1 ;10 inode number
- -1)))))) ;11 file system number
+ inode ;10 inode number
+ device)))))) ;11 file system number
(defun tramp-smb-handle-file-directory-p (filename)
"Like `file-directory-p' for tramp files."
(make-directory ldir parents))
;; Just do it
(when (file-directory-p ldir)
- (tramp-smb-handle-make-directory-internal dir))
+ (make-directory-internal dir))
(unless (file-directory-p dir)
(error "Couldn't make directory %s" dir))))))
;; size
(if (string-match "\\([0-9]+\\)$" line)
- (setq size (match-string 1 line)
- line (substring line 0 (- (max 8 (1+ (length size))))))
+ (setq
+ size (string-to-number (match-string 1 line))
+ line (substring
+ line 0 (- (max 8 (1+ (length (match-string 1 line)))))))
(return))
;; mode
'(0 0)))
(list path mode size mtime))))
+;; Inodes don't exist for SMB files. Therefore we must generate virtual ones.
+;; Used in `find-buffer-visiting'.
+;; The method applied might be not so efficient (Ange-FTP uses hashes). But
+;; performance isn't the major issue given that file transfer will take time.
+
+(defun tramp-smb-get-inode (share file)
+ "Returns the virtual inode number.
+If it doesn't exist, generate a new one."
+ (let ((string (concat share "/" (directory-file-name file))))
+ (unless (assoc string tramp-smb-inodes)
+ (add-to-list 'tramp-smb-inodes
+ (list string (length tramp-smb-inodes))))
+ (nth 1 (assoc string tramp-smb-inodes))))
+
;; Connection functions
;;; tramp.el --- Transparent Remote Access, Multiple Protocol -*- coding: iso-8859-1; -*-
-;; Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
;; Author: Kai.Grossjohann@CS.Uni-Dortmund.DE
;; Keywords: comm, processes
;; In the Tramp CVS repository, the version numer is auto-frobbed from
;; the Makefile, so you should edit the top-level Makefile to change
;; the version number.
-(defconst tramp-version "2.0.28"
+(defconst tramp-version "2.0.29"
"This version of tramp.")
(defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org"
(unless (boundp 'custom-print-functions)
(defvar custom-print-functions nil)) ; not autoloaded before Emacs 20.4
+;; Avoid bytecompiler warnings if the byte-compiler supports this.
+;; Currently, XEmacs supports this.
+(eval-when-compile
+ (when (fboundp 'byte-compiler-options)
+ (byte-compiler-options (warnings (- unused-vars)))))
+
;; XEmacs is distributed with few Lisp packages. Further packages are
;; installed using EFS. If we use a unified filename format, then
;; Tramp is required in addition to EFS. (But why can't Tramp just
;; Default values for non-Unices seeked
(defconst tramp-completion-function-alist-ssh
(unless (memq system-type '(windows-nt))
- '((tramp-parse-rhosts "/etc/hosts.equiv")
- (tramp-parse-rhosts "/etc/shosts.equiv")
- (tramp-parse-shosts "/etc/ssh_known_hosts")
- (tramp-parse-rhosts "~/.rhosts")
- (tramp-parse-rhosts "~/.shosts")
- (tramp-parse-shosts "~/.ssh/known_hosts")))
+ '((tramp-parse-rhosts "/etc/hosts.equiv")
+ (tramp-parse-rhosts "/etc/shosts.equiv")
+ (tramp-parse-shosts "/etc/ssh_known_hosts")
+ (tramp-parse-sconfig "/etc/ssh_config")
+ (tramp-parse-rhosts "~/.rhosts")
+ (tramp-parse-rhosts "~/.shosts")
+ (tramp-parse-shosts "~/.ssh/known_hosts")
+ (tramp-parse-sconfig "~/.ssh/config")))
"Default list of (FUNCTION FILE) pairs to be examined for ssh methods."
)
\(FUNCTION FILE). FUNCTION is responsible to extract user names and host
names from FILE for completion. The following predefined FUNCTIONs exists:
- * `tramp-parse-rhosts' for \".rhosts\" like files,
- * `tramp-parse-shosts' for \"ssh_known_hosts\" like files,
- * `tramp-parse-hosts' for \"/etc/hosts\" like files, and
- * `tramp-parse-passwd' for \"/etc/passwd\" like files.
- * `tramp-parse-netrc' for \".netrc\" like files.
+ * `tramp-parse-rhosts' for \"~/.rhosts\" like files,
+ * `tramp-parse-shosts' for \"~/.ssh/known_hosts\" like files,
+ * `tramp-parse-sconfig' for \"~/.ssh/config\" like files,
+ * `tramp-parse-hosts' for \"/etc/hosts\" like files, and
+ * `tramp-parse-passwd' for \"/etc/passwd\" like files.
+ * `tramp-parse-netrc' for \"~/.netrc\" like files.
FUNCTION can also see a customer defined function. For more details see
the info pages."
(make-variable-buffer-local 'tramp-buffer-file-attributes)
(defvar tramp-md5-function
- (cond ((fboundp 'md5) 'md5)
- ((and (require 'md5) (fboundp 'md5-encode)) 'md5-encode)
+ (cond ((and (require 'md5) (fboundp 'md5)) 'md5)
+ ((fboundp 'md5-encode)
+ (lambda (x) (base64-encode-string (md5-encode x))))
(t (error "Coulnd't find an `md5' function")))
"Function to call for running the MD5 algorithm.")
;; output. If you are hacking on this, note that you get *no* output
;; unless this spits out a complete line, including the '\n' at the
;; end.
+;; The device number is returned as "-1", because there will be a virtual
+;; device number set in `tramp-handle-file-attributes'
(defconst tramp-perl-file-attributes "\
$f = $ARGV[0];
@s = lstat($f);
if (($s[2] & 0170000) == 0120000) { $l = readlink($f); $l = \"\\\"$l\\\"\"; }
elsif (($s[2] & 0170000) == 040000) { $l = \"t\"; }
else { $l = \"nil\" };
-printf(\"(%s %u %d %d (%u %u) (%u %u) (%u %u) %u %u t (%u . %u) (%u %u))\\n\",
+printf(\"(%s %u %d %d (%u %u) (%u %u) (%u %u) %u %u t (%u . %u) -1)\\n\",
$l, $s[3], $s[4], $s[5], $s[8] >> 16 & 0xffff, $s[8] & 0xffff,
$s[9] >> 16 & 0xffff, $s[9] & 0xffff, $s[10] >> 16 & 0xffff, $s[10] & 0xffff,
-$s[7], $s[2], $s[1] >> 16 & 0xffff, $s[1] & 0xffff, $s[0] >> 16 & 0xffff, $s[0] & 0xffff);"
+$s[7], $s[2], $s[1] >> 16 & 0xffff, $s[1] & 0xffff);"
"Perl script to produce output suitable for use with `file-attributes'
on the remote file system.")
The FUNCTION is intended to parse FILE according its syntax.
It might be a predefined FUNCTION, or a user defined FUNCTION.
Predefined FUNCTIONs are `tramp-parse-rhosts', `tramp-parse-shosts',
-`tramp-parse-hosts', and `tramp-parse-passwd'.
+`tramp-parse-sconfig',`tramp-parse-hosts', `tramp-parse-passwd',
+and `tramp-parse-netrc'.
+
Example:
(tramp-set-completion-function
\"ssh\"
- '((tramp-parse-shosts \"/etc/ssh_known_hosts\")
- (tramp-parse-shosts \"~/.ssh/known_hosts\")))"
+ '((tramp-parse-sconfig \"/etc/ssh_config\")
+ (tramp-parse-sconfig \"~/.ssh/config\")))"
(let ((v (cdr (assoc method tramp-completion-function-alist))))
(if v (setcdr v function-list)
(tramp-get-file-exists-command multi-method method user host)
(tramp-shell-quote-argument path)))))))
+;; Devices must distinguish physical file systems. The device numbers
+;; provided by "lstat" aren't unique, because we operate on different hosts.
+;; So we use virtual device numbers, generated by Tramp. Both Ange-FTP and
+;; EFS use device number "-1". In order to be different, we use device number
+;; (-1 x), whereby "x" is unique for a given (multi-method method user host).
+(defvar tramp-devices nil
+ "Keeps virtual device numbers.")
+
;; CCC: This should check for an error condition and signal failure
;; when something goes wrong.
;; Daniel Pittman <daniel@danann.net>
multi-method method user host path nonnumeric))
(setq result
(tramp-handle-file-attributes-with-ls
- multi-method method user host path nonnumeric))))))
+ multi-method method user host path nonnumeric)))
+ ;; set virtual device number
+ (setcar (nthcdr 11 result)
+ (tramp-get-device multi-method method user host)))))
result))
-
(defun tramp-handle-file-attributes-with-ls
(multi-method method user host path &optional nonnumeric)
"Implement `file-attributes' for tramp files using the ls(1) command."
nil ;hm?
;; 10. inode number.
res-inode
- ;; 11. Device number.
- -1 ;hm?
+ ;; 11. Device number. Will be replaced by a virtual device number.
+ -1
)))
(defun tramp-handle-file-attributes-with-perl
(tramp-file-mode-from-int (nth 8 result)))
result))
+(defun tramp-get-device (multi-method method user host)
+ "Returns the virtual device number.
+If it doesn't exist, generate a new one."
+ (let ((string (tramp-make-tramp-file-name multi-method method user host "")))
+ (unless (assoc string tramp-devices)
+ (add-to-list 'tramp-devices
+ (list string (length tramp-devices))))
+ (list -1 (nth 1 (assoc string tramp-devices)))))
+
(defun tramp-handle-set-visited-file-modtime (&optional time-list)
"Like `set-visited-file-modtime' for tramp files."
(unless (buffer-file-name)
(defun tramp-handle-file-regular-p (filename)
"Like `file-regular-p' for tramp files."
(with-parsed-tramp-file-name filename nil
- (and (tramp-handle-file-exists-p filename)
- (eq ?- (aref (nth 8 (tramp-handle-file-attributes filename)) 0)))))
+ (and (file-exists-p filename)
+ (eq ?- (aref (nth 8 (file-attributes filename)) 0)))))
(defun tramp-handle-file-symlink-p (filename)
"Like `file-symlink-p' for tramp files."
;; (substring directory 0 (- (length directory) 1))
;; directory))
-;; Philippe Troin <phil@fifi.org>
+;; ;; Philippe Troin <phil@fifi.org>
+;; (defun tramp-handle-directory-file-name (directory)
+;; "Like `directory-file-name' for tramp files."
+;; (with-parsed-tramp-file-name directory nil
+;; (let ((directory-length-1 (1- (length directory))))
+;; (save-match-data
+;; (if (and (eq (aref directory directory-length-1) ?/)
+;; (eq (string-match tramp-file-name-regexp directory) 0)
+;; (/= (match-end 0) directory-length-1))
+;; (substring directory 0 directory-length-1)
+;; directory)))))
+
(defun tramp-handle-directory-file-name (directory)
"Like `directory-file-name' for tramp files."
+ ;; If path component of filename is "/", leave it unchanged.
+ ;; Otherwise, remove any trailing slash from path component.
+ ;; Method, host, etc, are unchanged. Does it make sense to try
+ ;; to avoid parsing the filename?
(with-parsed-tramp-file-name directory nil
- (let ((directory-length-1 (1- (length directory))))
- (save-match-data
- (if (and (eq (aref directory directory-length-1) ?/)
- (eq (string-match tramp-file-name-regexp directory) 0)
- (/= (match-end 0) directory-length-1))
- (substring directory 0 directory-length-1)
- directory)))))
+ (if (and (not (zerop (length path)))
+ (eq (aref path (1- (length path))) ?/)
+ (not (string= path "/")))
+ (substring directory 0 -1)
+ directory)))
;; Directory listings.
'dired-shell-unhandle-file-name 'dired-uucode-file
'insert-file-contents-literally 'recover-file
'vm-imap-check-mail 'vm-pop-check-mail 'vm-spool-check-mail))
- (expand-file-name (nth 0 args)))
+ (if (file-name-absolute-p (nth 0 args))
+ (nth 0 args)
+ (expand-file-name (nth 0 args))))
; FILE DIRECTORY resp FILE1 FILE2
((member operation
(list 'add-name-to-file 'copy-file 'expand-file-name
(defun tramp-find-foreign-file-name-handler (filename)
"Return foreign file name handler if exists."
- (let (elt res)
- (dolist (elt tramp-foreign-file-name-handler-alist res)
- (when (funcall (car elt) filename)
- (setq res (cdr elt))))
- res))
+ (when (tramp-tramp-file-p filename)
+ (let (elt res)
+ (dolist (elt tramp-foreign-file-name-handler-alist res)
+ (when (funcall (car elt) filename)
+ (setq res (cdr elt))))
+ res)))
;; Main function.
;;;###autoload
file)
(member (match-string 1 file) (mapcar 'car tramp-methods)))
((or (equal last-input-event 'tab)
- (and (not (event-modifiers last-input-event))
- (integerp last-input-event)
+ (and (integerp last-input-event)
+ (not (event-modifiers last-input-event))
(or (char-equal last-input-event ?\?)
(char-equal last-input-event ?\t) ; handled by 'tab already?
(char-equal last-input-event ?\ ))))
(host (tramp-file-name-host car))
(path (tramp-file-name-path car))
(m (tramp-find-method multi-method method user host))
+ (tramp-current-user user) ; see `tramp-parse-passwd'
all-user-hosts)
(unless (or multi-method ;; Not handled (yet).
Either user or host may be nil."
(let (res)
- (when (file-exists-p filename)
+ (when (file-readable-p filename)
(with-temp-buffer
(insert-file-contents filename)
(goto-char (point-min))
User is always nil."
(let (res)
- (when (file-exists-p filename)
+ (when (file-readable-p filename)
(with-temp-buffer
(insert-file-contents filename)
(goto-char (point-min))
(forward-line 1))
result))
+(defun tramp-parse-sconfig (filename)
+ "Return a list of (user host) tuples allowed to access.
+User is always nil."
+
+ (let (res)
+ (when (file-readable-p filename)
+ (with-temp-buffer
+ (insert-file-contents filename)
+ (goto-char (point-min))
+ (while (not (eobp))
+ (push (tramp-parse-sconfig-group) res))))
+ res))
+
+(defun tramp-parse-sconfig-group ()
+ "Return a (user host) tuple allowed to access.
+User is always nil."
+
+ (let ((result)
+ (regexp (concat "^[ \t]*Host[ \t]+" "\\(" tramp-host-regexp "\\)")))
+
+ (narrow-to-region (point) (tramp-point-at-eol))
+ (when (re-search-forward regexp nil t)
+ (setq result (list nil (match-string 1))))
+ (widen)
+ (or
+ (> (skip-chars-forward ",") 0)
+ (forward-line 1))
+ result))
+
(defun tramp-parse-hosts (filename)
"Return a list of (user host) tuples allowed to access.
User is always nil."
(let (res)
- (when (file-exists-p filename)
+ (when (file-readable-p filename)
(with-temp-buffer
(insert-file-contents filename)
(goto-char (point-min))
(forward-line 1))
result))
+;; For su-alike methods it would be desirable to return "root@localhost"
+;; as default. Unfortunately, we have no information whether any user name
+;; has been typed already. So we (mis-)use tramp-current-user as indication,
+;; assuming it is set in `tramp-completion-handle-file-name-all-completions'.
(defun tramp-parse-passwd (filename)
"Return a list of (user host) tuples allowed to access.
Host is always \"localhost\"."
(let (res)
- (if (and (symbolp 'user) (zerop (length user)))
+ (if (zerop (length tramp-current-user))
'(("root" nil))
- (when (file-exists-p filename)
+ (when (file-readable-p filename)
(with-temp-buffer
(insert-file-contents filename)
(goto-char (point-min))
User may be nil."
(let (res)
- (when (file-exists-p filename)
+ (when (file-readable-p filename)
(with-temp-buffer
(insert-file-contents filename)
(goto-char (point-min))
(defun tramp-completion-handle-expand-file-name (name &optional dir)
"Like `expand-file-name' for tramp files."
(let ((fullname (concat (or dir default-directory) name)))
- (if (tramp-completion-mode fullname)
- (tramp-run-real-handler
- 'expand-file-name (list name dir))
- (tramp-completion-run-real-handler
- 'expand-file-name (list name dir)))))
+ (tramp-drop-volume-letter
+ (if (tramp-completion-mode fullname)
+ (tramp-run-real-handler
+ 'expand-file-name (list name dir))
+ (tramp-completion-run-real-handler
+ 'expand-file-name (list name dir))))))
;;; Internal Functions:
(pop-to-buffer (current-buffer))
(funcall 'signal signal (apply 'format fmt args))))
-;; Chunked sending kluge.
-(defvar tramp-chunksize nil
+;; Chunked sending kluge. We set this to 500 just to be on the
+;; safe side; some ssh connections appear to drop bytes when data
+;; is sent too quickly.
+;; This happens when using `ssh' method using GNU Emacs 20.7.1
+;; (hppa1.1-hp-hpux10.20, Motif). (The connection is made to
+;; localhost.)
+(defvar tramp-chunksize 500
"If non-nil, chunksize for sending things to remote host.")
(defun tramp-send-region (multi-method method user host start end)
(tramp-get-buffer multi-method method user host))))
(unless proc
(error "Can't send region to remote host -- not logged in"))
- (if tramp-chunksize
+ (if (and tramp-chunksize (not (zerop tramp-chunksize)))
(let ((pos start))
(while (< pos end)
(tramp-message-for-buffer
;; how to suppress. Maybe not an essential problem.
;; ** Try to avoid usage of `last-input-event' in `tramp-completion-mode'.
;; ** Extend `tramp-get-completion-su' for NIS and shadow passwords.
-;; ** Unify `tramp-parse-{rhosts,shosts,hosts,passwd,netrc}'.
+;; ** Unify `tramp-parse-{rhosts,shosts,sconfig,hosts,passwd,netrc}'.
;; Code is nearly identical.
;; ** Decide whiche files to take for searching user/host names depending on
;; operating system (windows-nt) in `tramp-completion-function-alist'.