aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1992-09-12 22:27:16 +0000
committerRichard M. Stallman1992-09-12 22:27:16 +0000
commit26aaadf383d7d68514d85ce1b204541e38b18955 (patch)
tree5cfc57965440b5117bc070f358664caec037d1b0
parent2f7ea155925cbb84f0ef222aa73e119eb8477971 (diff)
downloademacs-26aaadf383d7d68514d85ce1b204541e38b18955.tar.gz
emacs-26aaadf383d7d68514d85ce1b204541e38b18955.zip
*** empty log message ***
-rw-r--r--lisp/ange-ftp.el79
1 files changed, 26 insertions, 53 deletions
diff --git a/lisp/ange-ftp.el b/lisp/ange-ftp.el
index 8fc9a831b43..4be219f87f1 100644
--- a/lisp/ange-ftp.el
+++ b/lisp/ange-ftp.el
@@ -27,16 +27,6 @@
27;;; from within GNU Emacs as simple and transparent as possible. A subset of 27;;; from within GNU Emacs as simple and transparent as possible. A subset of
28;;; the common file-handling routines are extended to interact with FTP. 28;;; the common file-handling routines are extended to interact with FTP.
29 29
30;;; Installation:
31;;;
32;;; Byte-compile ange-ftp.el to ange-ftp.elc and put them both in a directory
33;;; on your load-path. Load the package from your .emacs file with:
34;;;
35;;; (require 'ange-ftp).
36;;;
37;;; ange-ftp can't sensibly be auto-loaded; you are either using it, or you
38;;; ain't.
39
40;;; Usage: 30;;; Usage:
41;;; 31;;;
42;;; Some of the common GNU Emacs file-handling operations have been made 32;;; Some of the common GNU Emacs file-handling operations have been made
@@ -1397,9 +1387,7 @@ file."
1397 (if (and (stringp buffer-file-name) 1387 (if (and (stringp buffer-file-name)
1398 (ange-ftp-ftp-path buffer-file-name)) 1388 (ange-ftp-ftp-path buffer-file-name))
1399 (progn 1389 (progn
1400 (auto-save-mode ange-ftp-auto-save) 1390 (auto-save-mode ange-ftp-auto-save))))
1401 (make-variable-buffer-local 'revert-buffer-function)
1402 (setq revert-buffer-function 'ange-ftp-revert-buffer))))
1403 1391
1404(defun ange-ftp-kill-ftp-process (buffer) 1392(defun ange-ftp-kill-ftp-process (buffer)
1405 "If the BUFFER's visited filename or default-directory is an ftp filename 1393 "If the BUFFER's visited filename or default-directory is an ftp filename
@@ -3017,25 +3005,6 @@ ftp transfers."
3017 filename)))) 3005 filename))))
3018 (ange-ftp-real-insert-file-contents filename visit)))) 3006 (ange-ftp-real-insert-file-contents filename visit))))
3019 3007
3020(defun ange-ftp-revert-buffer (arg noconfirm)
3021 "Revert this buffer from a remote file using ftp."
3022 (let ((opoint (point)))
3023 (cond ((null buffer-file-name)
3024 (error "Buffer does not seem to be associated with any file"))
3025 ((or noconfirm
3026 (yes-or-no-p (format "Revert buffer from file %s? "
3027 buffer-file-name)))
3028 (let ((buffer-read-only nil))
3029 ;; Set buffer-file-name to nil
3030 ;; so that we don't try to lock the file.
3031 (let ((buffer-file-name nil))
3032 (unlock-buffer)
3033 (erase-buffer))
3034 (insert-file-contents buffer-file-name t))
3035 (goto-char (min opoint (point-max)))
3036 (after-find-file nil)
3037 t))))
3038
3039(defun ange-ftp-expand-symlink (file dir) 3008(defun ange-ftp-expand-symlink (file dir)
3040 (if (file-name-absolute-p file) 3009 (if (file-name-absolute-p file)
3041 (ange-ftp-replace-path-component dir file) 3010 (ange-ftp-replace-path-component dir file)
@@ -3687,15 +3656,34 @@ to the directory part of the contents of the current buffer."
3687;;; Define the handler for special file names 3656;;; Define the handler for special file names
3688;;; that causes ange-ftp to be invoked. 3657;;; that causes ange-ftp to be invoked.
3689 3658
3690;;; omitted: 3659;;;###autoload
3691;;; diff 3660(defun ange-ftp-hook-function (operation &rest args)
3661 (let ((fn (get operation 'ange-ftp)))
3662 (if fn (apply fn args)
3663 (let (file-name-handler-alist)
3664 (apply operation args)))))
3665
3666;;;###autoload
3667(or (assoc ":" file-name-handler-alist)
3668 (setq file-name-handler-alist
3669 (cons '(":" . ange-ftp-hook-function)
3670 file-name-handler-alist)))
3671
3672;;; The above two forms are sufficient to cause this file to be loaded
3673;;; if the user ever uses a file name with a colon in it.
3674
3675;;; This sets the mode
3676(or (memq 'ange-ftp-set-buffer-mode find-file-hooks)
3677 (setq find-file-hooks
3678 (cons 'ange-ftp-set-buffer-mode find-file-hooks)))
3679
3680;;; Now say where to find the handlers for particular operations.
3692 3681
3693(put 'file-name-directory 'ange-ftp 'ange-ftp-file-name-directory) 3682(put 'file-name-directory 'ange-ftp 'ange-ftp-file-name-directory)
3694(put 'file-name-nondirectory 'ange-ftp 'ange-ftp-file-name-nondirectory) 3683(put 'file-name-nondirectory 'ange-ftp 'ange-ftp-file-name-nondirectory)
3695(put 'file-name-as-directory 'ange-ftp 'ange-ftp-file-name-as-directory) 3684(put 'file-name-as-directory 'ange-ftp 'ange-ftp-file-name-as-directory)
3696(put 'directory-file-name 'ange-ftp 'ange-ftp-directory-file-name) 3685(put 'directory-file-name 'ange-ftp 'ange-ftp-directory-file-name)
3697(put 'expand-file-name 'ange-ftp 'ange-ftp-expand-file-name) 3686(put 'expand-file-name 'ange-ftp 'ange-ftp-expand-file-name)
3698
3699(put 'make-directory 'ange-ftp 'ange-ftp-make-directory) 3687(put 'make-directory 'ange-ftp 'ange-ftp-make-directory)
3700(put 'delete-directory 'ange-ftp 'ange-ftp-delete-directory) 3688(put 'delete-directory 'ange-ftp 'ange-ftp-delete-directory)
3701(put 'insert-file-contents 'ange-ftp 'ange-ftp-insert-file-contents) 3689(put 'insert-file-contents 'ange-ftp 'ange-ftp-insert-file-contents)
@@ -3716,9 +3704,10 @@ to the directory part of the contents of the current buffer."
3716(put 'file-attributes 'ange-ftp 'ange-ftp-file-attributes) 3704(put 'file-attributes 'ange-ftp 'ange-ftp-file-attributes)
3717(put 'file-name-all-completions 'ange-ftp 'ange-ftp-file-name-all-completions) 3705(put 'file-name-all-completions 'ange-ftp 'ange-ftp-file-name-all-completions)
3718(put 'file-name-completion 'ange-ftp 'ange-ftp-file-name-completion) 3706(put 'file-name-completion 'ange-ftp 'ange-ftp-file-name-completion)
3707
3708;;; Define ways of getting at unmodified Emacs primitives,
3709;;; turning off our handler.
3719 3710
3720;;; Now define ways of getting at the unmodified Emacs primitive,
3721;;; turning off the hooks.
3722(defun ange-ftp-real-file-name-directory (&rest args) 3711(defun ange-ftp-real-file-name-directory (&rest args)
3723 (let (file-name-handler-alist) 3712 (let (file-name-handler-alist)
3724 (apply 'file-name-directory args))) 3713 (apply 'file-name-directory args)))
@@ -3791,22 +3780,6 @@ to the directory part of the contents of the current buffer."
3791(defun ange-ftp-real-file-name-completion (&rest args) 3780(defun ange-ftp-real-file-name-completion (&rest args)
3792 (let (file-name-handler-alist) 3781 (let (file-name-handler-alist)
3793 (apply 'file-name-completion args))) 3782 (apply 'file-name-completion args)))
3794
3795(defun ange-ftp-hook-function (operation &rest args)
3796 (let ((fn (get operation 'ange-ftp)))
3797 (if fn (apply fn args)
3798 (let (file-name-handler-alist)
3799 (apply operation args)))))
3800
3801(or (assoc ":" file-name-handler-alist)
3802 (setq file-name-handler-alist
3803 (cons '(":" . ange-ftp-hook-function)
3804 file-name-handler-alist)))
3805
3806(or (memq 'ange-ftp-set-buffer-mode find-file-hooks)
3807 (setq find-file-hooks
3808 (cons 'ange-ftp-set-buffer-mode find-file-hooks)))
3809
3810 3783
3811;;; This is obsolete and won't work 3784;;; This is obsolete and won't work
3812 3785