Function: ange-ftp-add-name-to-file
ange-ftp-add-name-to-file is a byte-compiled function defined in
ange-ftp.el.gz.
Signature
(ange-ftp-add-name-to-file FILENAME NEWNAME &optional OK-IF-ALREADY-EXISTS)
Source Code
;; Defined in /usr/src/emacs/lisp/net/ange-ftp.el.gz
(defun ange-ftp-add-name-to-file
(filename newname &optional ok-if-already-exists)
(let ((f-parsed (ange-ftp-ftp-name filename))
(n-parsed (ange-ftp-ftp-name newname)))
(unless (and (string-equal (nth 0 f-parsed) (nth 0 n-parsed))
(string-equal (nth 1 f-parsed) (nth 1 n-parsed)))
(signal
'file-error
(list "add-name-to-file: only implemented for same user, same host")))
;; Do the 'confirm if exists' thing.
(when (file-exists-p newname)
;; What to do?
(if (or (null ok-if-already-exists) ; not allowed to exist
(and (numberp ok-if-already-exists)
(not (yes-or-no-p
(format
"File %s already exists; make it a link anyway? "
(nth 2 n-parsed))))))
(signal 'file-already-exists (list newname))
(delete-file newname)))
(copy-file
filename newname 'ok-if-already-exists 'keep-time
'preserve-uid-gid 'preserve-permissions)))