summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1992-09-14 01:39:31 +0000
committerRichard M. Stallman <rms@gnu.org>1992-09-14 01:39:31 +0000
commit5d68c2c227eb79f3eca2323f86780f8b7b178c49 (patch)
treef9aaa08b1cd91de4a330699a6769ab0d52c0f3ff /lisp/files.el
parent6c43f2f9e97b5dbaa9f582444c9c905cda9b29f1 (diff)
downloademacs-5d68c2c227eb79f3eca2323f86780f8b7b178c49.tar.gz
*** empty log message ***
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el43
1 files changed, 31 insertions, 12 deletions
diff --git a/lisp/files.el b/lisp/files.el
index bd7cf7d8864..f784004c04a 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -221,6 +221,23 @@ and ignores this variable.")
This is an interface to the function `load'."
(interactive "sLoad library: ")
(load library))
+
+;; OTHER is the other file to be compared.
+(defun file-local-copy (file)
+ "Copy the file FILE into a temporary file on this machine.
+Returns the name of the local copy, or nil, if FILE is directly
+accessible."
+ (let (handler (handlers file-name-handler-alist))
+ (save-match-data
+ (while (and (consp handlers) (null handler))
+ (if (and (consp (car handlers))
+ (stringp (car (car handlers)))
+ (string-match (car (car handlers)) file))
+ (setq handler (cdr (car handlers))))
+ (setq handlers (cdr handlers))))
+ (if handler
+ (funcall handler 'file-local-copy file)
+ nil)))
(defun switch-to-buffer-other-window (buffer)
"Select buffer BUFFER in another window."
@@ -831,12 +848,13 @@ redefine it.
If the optional argument KEEP-BACKUP-VERSION is non-nil,
we do not remove backup version numbers, only true file version numbers."
(let (handler (handlers file-name-handler-alist))
- (while (and (consp handlers) (null handler))
- (if (and (consp (car handlers))
- (stringp (car (car handlers)))
- (string-match (car (car handlers)) name))
- (setq handler (cdr (car handlers))))
- (setq handlers (cdr handlers)))
+ (save-match-data
+ (while (and (consp handlers) (null handler))
+ (if (and (consp (car handlers))
+ (stringp (car (car handlers)))
+ (string-match (car (car handlers)) name))
+ (setq handler (cdr (car handlers))))
+ (setq handlers (cdr handlers))))
(if handler
(funcall handler 'file-name-sans-versions name keep-backup-version)
(substring name 0
@@ -1430,12 +1448,13 @@ This works by running a directory listing program
whose name is in the variable `ls-program'.
If WILDCARD, it also runs the shell specified by `shell-file-name'."
(let (handler (handlers file-name-handler-alist))
- (while (and (consp handlers) (null handler))
- (if (and (consp (car handlers))
- (stringp (car (car handlers)))
- (string-match (car (car handlers)) file))
- (setq handler (cdr (car handlers))))
- (setq handlers (cdr handlers)))
+ (save-match-data
+ (while (and (consp handlers) (null handler))
+ (if (and (consp (car handlers))
+ (stringp (car (car handlers)))
+ (string-match (car (car handlers)) file))
+ (setq handler (cdr (car handlers))))
+ (setq handlers (cdr handlers))))
(if handler
(funcall handler 'insert-directory file switches
wildcard full-directory-p)