mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-17 18:37:33 +00:00
* net/tramp-compat.el (top): Autoload used functions from
tramp.el. (file-remote-p, process-file, start-file-process, set-file-times) (tramp-compat-file-attributes): Compatibility functions shall not call directly `tramp-handle-*', because this would bypass the locking mechanism. (tramp-compat-number-sequence): New defun.
This commit is contained in:
parent
7f49fe463d
commit
e5aa47f993
2 changed files with 84 additions and 9 deletions
|
|
@ -1,3 +1,33 @@
|
|||
2009-09-02 Michael Albinus <michael.albinus@gmx.de>
|
||||
|
||||
* net/tramp.el (tramp-handle-file-attributes-with-ls)
|
||||
(tramp-do-file-attributes-with-perl)
|
||||
(tramp-do-file-attributes-with-stat): Rename from
|
||||
`tramp-handle-file-attributes-with-*'.
|
||||
(tramp-handle-file-attributes): Use them.
|
||||
(tramp-do-directory-files-and-attributes-with-perl)
|
||||
(tramp-do-directory-files-and-attributes-with-stat): Rename from
|
||||
`tramp-handle-directory-files-and-attributes-with-*'.
|
||||
(tramp-handle-directory-files-and-attributes): Use them.
|
||||
(tramp-method-out-of-band-p): Additional parameter SIZE.
|
||||
(tramp-do-copy-or-rename-file, tramp-handle-file-local-copy)
|
||||
(tramp-handle-write-region): Use it.
|
||||
(tramp-handle-insert-directory): Use "?\ " for compatibility
|
||||
reasons.
|
||||
(tramp-handle-vc-registered): Check, whether the first run did
|
||||
return files to be tested.
|
||||
(tramp-advice-make-auto-save-file-name): Do not call directly
|
||||
`tramp-handle-make-auto-save-file-name', because this would bypass
|
||||
the locking mechanism.
|
||||
|
||||
* net/tramp-compat.el (top): Autoload used functions from
|
||||
tramp.el.
|
||||
(file-remote-p, process-file, start-file-process, set-file-times)
|
||||
(tramp-compat-file-attributes): Compatibility functions shall not
|
||||
call directly `tramp-handle-*', because this would bypass the
|
||||
locking mechanism.
|
||||
(tramp-compat-number-sequence): New defun.
|
||||
|
||||
2009-09-02 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* calendar/time-date.el (time-to-seconds): In Emacs, make it an obsolete
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@
|
|||
(require 'timer-funcs)
|
||||
(require 'timer))
|
||||
|
||||
(autoload 'tramp-tramp-file-p "tramp")
|
||||
(autoload 'tramp-file-name-handler "tramp")
|
||||
|
||||
;; tramp-util offers integration into other (X)Emacs packages like
|
||||
;; compile.el, gud.el etc. Not necessary in Emacs 23.
|
||||
(eval-after-load "tramp"
|
||||
|
|
@ -99,24 +102,46 @@
|
|||
(unless (fboundp 'font-lock-add-keywords)
|
||||
(defalias 'font-lock-add-keywords 'ignore))
|
||||
|
||||
;; The following functions cannot be aliases of the corresponding
|
||||
;; `tramp-handle-*' functions, because this would bypass the locking
|
||||
;; mechanism.
|
||||
|
||||
;; `file-remote-p' has been introduced with Emacs 22. The version
|
||||
;; of XEmacs is not a magic file name function (yet); this is
|
||||
;; corrected in tramp-util.el. Here it is sufficient if the
|
||||
;; function exists.
|
||||
(unless (fboundp 'file-remote-p)
|
||||
(defalias 'file-remote-p 'tramp-handle-file-remote-p))
|
||||
(defalias 'file-remote-p
|
||||
(lambda (file &optional identification connected)
|
||||
(when (tramp-tramp-file-p file)
|
||||
(tramp-file-name-handler
|
||||
'file-remote-p file identification connected)))))
|
||||
|
||||
;; `process-file' exists since Emacs 22.
|
||||
(unless (fboundp 'process-file)
|
||||
(defalias 'process-file 'tramp-handle-process-file))
|
||||
(defalias 'process-file
|
||||
(lambda (program &optional infile buffer display &rest args)
|
||||
(when (tramp-tramp-file-p default-directory)
|
||||
(apply
|
||||
'tramp-file-name-handler
|
||||
'process-file program infile buffer display args)))))
|
||||
|
||||
;; `start-file-process' is new in Emacs 23.
|
||||
(unless (fboundp 'start-file-process)
|
||||
(defalias 'start-file-process 'tramp-handle-start-file-process))
|
||||
(defalias 'start-file-process
|
||||
(lambda (name buffer program &rest program-args)
|
||||
(when (tramp-tramp-file-p default-directory)
|
||||
(apply
|
||||
'tramp-file-name-handler
|
||||
'start-file-process name buffer program program-args)))))
|
||||
|
||||
;; `set-file-times' is also new in Emacs 23.
|
||||
(unless (fboundp 'set-file-times)
|
||||
(defalias 'set-file-times 'tramp-handle-set-file-times)))
|
||||
(defalias 'set-file-times
|
||||
(lambda (filename &optional time)
|
||||
(when (tramp-tramp-file-p filename)
|
||||
(tramp-file-name-handler
|
||||
'set-file-times filename time))))))
|
||||
|
||||
(defsubst tramp-compat-line-end-position ()
|
||||
"Return point at end of line (compat function).
|
||||
|
|
@ -197,10 +222,8 @@ Add the extension of FILENAME, if existing."
|
|||
(cond
|
||||
((or (null id-format) (eq id-format 'integer))
|
||||
(file-attributes filename))
|
||||
;; FIXME: shouldn't that be tramp-file-p or somesuch?
|
||||
((file-remote-p filename)
|
||||
(funcall (symbol-function 'tramp-handle-file-attributes)
|
||||
filename id-format))
|
||||
((tramp-tramp-file-p filename)
|
||||
(tramp-file-name-handler 'file-attributes filename id-format))
|
||||
(t (condition-case nil
|
||||
(funcall (symbol-function 'file-attributes) filename id-format)
|
||||
(error (file-attributes filename))))))
|
||||
|
|
@ -219,7 +242,7 @@ Add the extension of FILENAME, if existing."
|
|||
;; `copy-tree' is a built-in function in XEmacs. In Emacs 21, it is
|
||||
;; an autoloaded function in cl-extra.el. Since Emacs 22, it is part
|
||||
;; of subr.el. There are problems when autoloading, therefore we test
|
||||
;; for `subrp' and `symbol-file'. Implementation is taken from Emacs23.
|
||||
;; for `subrp' and `symbol-file'. Implementation is taken from Emacs 23.
|
||||
(defun tramp-compat-copy-tree (tree)
|
||||
"Make a copy of TREE (compat function)."
|
||||
(if (or (subrp 'copy-tree) (symbol-file 'copy-tree))
|
||||
|
|
@ -233,6 +256,28 @@ Add the extension of FILENAME, if existing."
|
|||
(setq tree (cdr tree)))
|
||||
(nconc (nreverse result) tree))))
|
||||
|
||||
;; `number-sequence' has been introduced in Emacs 22. Implementation
|
||||
;; is taken from Emacs 23.
|
||||
(defun tramp-compat-number-sequence (from &optional to inc)
|
||||
"Return a sequence of numbers from FROM to TO as a list (compat function)."
|
||||
(if (or (subrp 'number-sequence) (symbol-file 'number-sequence))
|
||||
(funcall (symbol-function 'number-sequence) from to inc)
|
||||
(if (or (not to) (= from to))
|
||||
(list from)
|
||||
(or inc (setq inc 1))
|
||||
(when (zerop inc) (error "The increment can not be zero"))
|
||||
(let (seq (n 0) (next from))
|
||||
(if (> inc 0)
|
||||
(while (<= next to)
|
||||
(setq seq (cons next seq)
|
||||
n (1+ n)
|
||||
next (+ from (* n inc))))
|
||||
(while (>= next to)
|
||||
(setq seq (cons next seq)
|
||||
n (1+ n)
|
||||
next (+ from (* n inc)))))
|
||||
(nreverse seq)))))
|
||||
|
||||
(defun tramp-compat-split-string (string pattern)
|
||||
"Like `split-string' but omit empty strings.
|
||||
In Emacs, (split-string \"/foo/bar\" \"/\") returns (\"foo\" \"bar\").
|
||||
|
|
|
|||
Loading…
Reference in a new issue