diff options
| author | Richard M. Stallman | 1993-12-23 03:45:09 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-12-23 03:45:09 +0000 |
| commit | 191b14ba97b839996021df58def68e760970518e (patch) | |
| tree | 34a6cf5b36c3d82ad1da6ce99b634de0cfa68869 | |
| parent | 579cc01c3a11fd80c9b39ab6ca03f05f0b693def (diff) | |
| download | emacs-191b14ba97b839996021df58def68e760970518e.tar.gz emacs-191b14ba97b839996021df58def68e760970518e.zip | |
(shadow-noquery): Use it.
(shadow-copy-file): Use abbreviate-file-name to
avoid incorrect warnings.
Lucid support commented out (didn't work and caused compiler warnings).
| -rw-r--r-- | lisp/shadowfile.el | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/lisp/shadowfile.el b/lisp/shadowfile.el index 197e51b3796..800a4e33310 100644 --- a/lisp/shadowfile.el +++ b/lisp/shadowfile.el | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | ;;; LCD Archive Entry: | 22 | ;;; LCD Archive Entry: |
| 23 | ;;; shadowfile|Boris Goldowsky|boris@cs.rochester.edu| | 23 | ;;; shadowfile|Boris Goldowsky|boris@cs.rochester.edu| |
| 24 | ;;; Helps you keep identical copies of files in multiple places.| | 24 | ;;; Helps you keep identical copies of files in multiple places.| |
| 25 | ;;; $Date: 93/11/17 08:46:07 $ |$Revision: 2.8 $|~/misc/shadowfile.el.Z| | 25 | ;;; $Date: 1993/11/23 06:17:27 $ |$Revision: 1.1 $|~/misc/shadowfile.el.Z| |
| 26 | 26 | ||
| 27 | ;;; Commentary: | 27 | ;;; Commentary: |
| 28 | ;;; | 28 | ;;; |
| @@ -85,7 +85,9 @@ | |||
| 85 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 85 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 86 | 86 | ||
| 87 | (defvar shadow-noquery nil | 87 | (defvar shadow-noquery nil |
| 88 | "*If nonnil, always copy shadow files without asking.") | 88 | "*If t, always copy shadow files without asking. |
| 89 | If nil \(the default), always ask. If not nil and not t, ask only if there | ||
| 90 | is no buffer currently visiting the file.") | ||
| 89 | 91 | ||
| 90 | (defvar shadow-inhibit-message nil | 92 | (defvar shadow-inhibit-message nil |
| 91 | "*If nonnil, do not display a message when a file needs copying.") | 93 | "*If nonnil, do not display a message when a file needs copying.") |
| @@ -510,7 +512,7 @@ call it manually." | |||
| 510 | (save-excursion | 512 | (save-excursion |
| 511 | (map-y-or-n-p (function | 513 | (map-y-or-n-p (function |
| 512 | (lambda (pair) | 514 | (lambda (pair) |
| 513 | (or arg | 515 | (or arg shadow-noquery |
| 514 | (format "Copy shadow file %s? " (cdr pair))))) | 516 | (format "Copy shadow file %s? " (cdr pair))))) |
| 515 | (function shadow-copy-file) | 517 | (function shadow-copy-file) |
| 516 | shadow-files-to-copy | 518 | shadow-files-to-copy |
| @@ -552,16 +554,18 @@ site." | |||
| 552 | (defun shadow-copy-file (s) | 554 | (defun shadow-copy-file (s) |
| 553 | "Copy one shadow file." | 555 | "Copy one shadow file." |
| 554 | (let* ((buffer | 556 | (let* ((buffer |
| 555 | (cond ((get-file-buffer (car s))) | 557 | (cond ((get-file-buffer |
| 558 | (abbreviate-file-name (shadow-expand-file-name (car s))))) | ||
| 556 | ((not (file-readable-p (car s))) | 559 | ((not (file-readable-p (car s))) |
| 557 | (if (y-or-n-p | 560 | (if (y-or-n-p |
| 558 | (format "Cannot find file %s--cancel copy request?" | 561 | (format "Cannot find file %s--cancel copy request?" |
| 559 | (car s))) | 562 | (car s))) |
| 560 | (shadow-remove-from-todo s)) | 563 | (shadow-remove-from-todo s)) |
| 561 | nil) | 564 | nil) |
| 562 | ((y-or-n-p | 565 | ((or (eq t shadow-noquery) |
| 563 | (format "No buffer for %s -- update shadow anyway?" | 566 | (y-or-n-p |
| 564 | (car s))) | 567 | (format "No buffer for %s -- update shadow anyway?" |
| 568 | (car s)))) | ||
| 565 | (find-file-noselect (car s))))) | 569 | (find-file-noselect (car s))))) |
| 566 | (to (shadow-expand-cluster-in-file-name (cdr s)))) | 570 | (to (shadow-expand-cluster-in-file-name (cdr s)))) |
| 567 | (shadow-when buffer | 571 | (shadow-when buffer |
| @@ -642,8 +646,9 @@ PAIR must be (eq to) one of the elements of that list." | |||
| 642 | thus restoring shadowfile's state from your last emacs session. | 646 | thus restoring shadowfile's state from your last emacs session. |
| 643 | Returns t unless files were locked; then returns nil." | 647 | Returns t unless files were locked; then returns nil." |
| 644 | (interactive) | 648 | (interactive) |
| 645 | (if (or (stringp (file-locked-p shadow-info-file)) | 649 | (if (and (fboundp 'file-locked-p) |
| 646 | (stringp (file-locked-p shadow-todo-file))) | 650 | (or (stringp (file-locked-p shadow-info-file)) |
| 651 | (stringp (file-locked-p shadow-todo-file)))) | ||
| 647 | (progn | 652 | (progn |
| 648 | (message "Shadowfile is running in another emacs; can't have two.") | 653 | (message "Shadowfile is running in another emacs; can't have two.") |
| 649 | (beep) | 654 | (beep) |
| @@ -772,20 +777,22 @@ look for files that have been changed and need to be copied to other systems." | |||
| 772 | (kill-emacs))) | 777 | (kill-emacs))) |
| 773 | 778 | ||
| 774 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 779 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 775 | ;;; Lucid Emacs compatibility (may not be complete) | 780 | ;;; Lucid Emacs compatibility |
| 776 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 781 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 777 | 782 | ||
| 778 | (shadow-when (not (fboundp 'file-truename)) | 783 | ;; This is on hold until someone tells me about a working version of |
| 779 | (require 'symlink-fix) | 784 | ;; map-ynp for Lucid Emacs. |
| 780 | (defun shadow-expand-file-name (file &optional default) | 785 | |
| 781 | (symlink-expand-file-name file default))) | 786 | ;(shadow-when (string-match "Lucid" emacs-version) |
| 782 | 787 | ; (require 'symlink-fix) | |
| 783 | (shadow-when (not (fboundp 'ange-ftp-ftp-name)) | 788 | ; (require 'ange-ftp) |
| 784 | (require 'ange-ftp) | 789 | ; (require 'map-ynp) |
| 785 | (defun shadow-parse-fullpath (fullpath) | 790 | ; (if (not (fboundp 'file-truename)) |
| 786 | (if (listp fullpath) | 791 | ; (fset 'shadow-expand-file-name |
| 787 | fullpath | 792 | ; (symbol-function 'symlink-expand-file-name))) |
| 788 | (ange-ftp-ftp-path fullpath)))) | 793 | ; (if (not (fboundp 'ange-ftp-ftp-name)) |
| 794 | ; (fset 'ange-ftp-ftp-name | ||
| 795 | ; (symbol-function 'ange-ftp-ftp-path)))) | ||
| 789 | 796 | ||
| 790 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 797 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 791 | ;;; Hook us up | 798 | ;;; Hook us up |