Mercurial > hg > xemacs-beta
diff lisp/utils/shadowfile.el @ 2:ac2d302a0011 r19-15b2
Import from CVS: tag r19-15b2
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:46:35 +0200 |
parents | 376386a54a3c |
children | 4103f0995bd7 |
line wrap: on
line diff
--- a/lisp/utils/shadowfile.el Mon Aug 13 08:45:53 2007 +0200 +++ b/lisp/utils/shadowfile.el Mon Aug 13 08:46:35 2007 +0200 @@ -5,77 +5,81 @@ ;; Author: Boris Goldowsky <boris@gnu.ai.mit.edu> ;; Keywords: comm -;; This file is part of GNU Emacs. +;; This file is part of XEmacs. -;; GNU Emacs is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by +;; XEmacs is free software; you can redistribute it and/or modify it +;; under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. +;; XEmacs is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +;; along with XEmacs; see the file COPYING. If not, write to the Free +;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +;; 02111-1307, USA. -;;; LCD Archive Entry: -;;; shadowfile|Boris Goldowsky|boris@gnu.ai.mit.edu| -;;; Helps you keep identical copies of files in multiple places.| -;;; $Date: 1996/12/18 03:32:59 $ |$Revision: 1.1.1.1 $|~/misc/shadowfile.el.Z| +;; LCD Archive Entry: +;; shadowfile|Boris Goldowsky|boris@gnu.ai.mit.edu| +;; Helps you keep identical copies of files in multiple places.| +;; $Date: 1996/12/18 03:45:48 $ |$Revision: 1.1.1.2 $|~/misc/shadowfile.el.Z| ;;; Synched up with: FSF 19.30. -;;; Commentary: -;;; -;;; This package helps you to keep identical copies of files in more than one -;;; place - possibly on different machines. When you save a file, it checks -;;; whether it is on the list of files with "shadows", and if so, it tries to -;;; copy it when you exit emacs (or use the shadow-copy-files command). +;; Commentary: + +;; This package helps you to keep identical copies of files in more than one +;; place - possibly on different machines. When you save a file, it checks +;; whether it is on the list of files with "shadows", and if so, it tries to +;; copy it when you exit emacs (or use the shadow-copy-files command). + +;; Installation & Use: + +;; Put (require 'shadowfile) in your .emacs; add clusters (if necessary) +;; and file groups with shadow-define-cluster, +;; shadow-define-literal-group, and shadow-define-regexp-group (see the +;; documentation for these functions for information on how and when to +;; use them). After doing this once, everything should be automatic. + +;; The lists of clusters and shadows are saved in a file called .shadows, +;; so that they can be remembered from one emacs session to another, even +;; (as much as possible) if the emacs session terminates abnormally. The +;; files needing to be copied are stored in .shadow_todo; if a file cannot +;; be copied for any reason, it will stay on the list to be tried again +;; next time. The .shadows file should itself have shadows on all your +;; accounts so that the information in it is consistent everywhere, but +;; .shadow_todo is local information and should have no shadows. -;;; Installation & Use: -;;; -;;; Put (require 'shadowfile) in your .emacs; add clusters (if necessary) -;;; and file groups with shadow-define-cluster, shadow-define-literal-group, -;;; and shadow-define-regexp-group (see the documentation for these functions -;;; for information on how and when to use them). After doing this once, -;;; everything should be automatic. -;;; The lists of clusters and shadows are saved in a file called -;;; .shadows, so that they can be remembered from one emacs session to -;;; another, even (as much as possible) if the emacs session terminates -;;; abnormally. The files needing to be copied are stored in .shadow_todo; if -;;; a file cannot be copied for any reason, it will stay on the list to be -;;; tried again next time. The .shadows file should itself have shadows on -;;; all your accounts so that the information in it is consistent everywhere, -;;; but .shadow_todo is local information and should have no shadows. -;;; If you do not want to copy a particular file, you can answer "no" -;;; and be asked again next time you hit C-x 4 s or exit emacs. If you do not -;;; want to be asked again, use shadow-cancel, and you will not be asked until -;;; you change the file and save it again. If you do not want to shadow -;;; that file ever again, you can edit it out of the .shadows buffer. -;;; Anytime you edit the .shadows buffer, you must type M-x shadow-read-files -;;; to load in the new information, or your changes will be overwritten! +;; If you do not want to copy a particular file, you can answer "no" and +;; be asked again next time you hit C-x 4 s or exit emacs. If you do not +;; want to be asked again, use shadow-cancel, and you will not be asked +;; until you change the file and save it again. If you do not want to +;; shadow that file ever again, you can edit it out of the .shadows +;; buffer. Anytime you edit the .shadows buffer, you must type M-x +;; shadow-read-files to load in the new information, or your changes will +;; be overwritten! -;;; Bugs & Warnings: -;;; -;;; - It is bad to have two emacses both running shadowfile at the same -;;; time. It tries to detect this condition, but is not always successful. -;;; -;;; - You have to be careful not to edit a file in two locations -;;; before shadowfile has had a chance to copy it; otherwise -;;; "updating shadows" will overwrite one of the changed versions. -;;; -;;; - It ought to check modification times of both files to make sure -;;; it is doing the right thing. This will have to wait until -;;; file-newer-than-file-p works between machines. -;;; -;;; - It will not make directories for you, it just fails to copy files -;;; that belong in non-existent directories. -;;; -;;; Please report any bugs to me (boris@gnu.ai.mit.edu). Also let me know -;;; if you have suggestions or would like to be informed of updates. +;; Bugs & Warnings: +;; +;; - It is bad to have two emacses both running shadowfile at the same +;; time. It tries to detect this condition, but is not always successful. +;; +;; - You have to be careful not to edit a file in two locations +;; before shadowfile has had a chance to copy it; otherwise +;; "updating shadows" will overwrite one of the changed versions. +;; +;; - It ought to check modification times of both files to make sure +;; it is doing the right thing. This will have to wait until +;; file-newer-than-file-p works between machines. +;; +;; - It will not make directories for you, it just fails to copy files +;; that belong in non-existent directories. +;; +;; Please report any bugs to me (boris@gnu.ai.mit.edu). Also let me know +;; if you have suggestions or would like to be informed of updates. ;;; Code: @@ -499,7 +503,8 @@ (let ((msg (shadow-join (mapcar (function cdr) (shadow-shadows-of (buffer-file-name))) " "))) - (message (if (zerop (length msg)) + (message "%s" + (if (zerop (length msg)) "No shadows." msg)))) @@ -537,8 +542,8 @@ (shadow-remove-from-todo pair))) shadow-files-to-copy '("shadow" "shadows" "cancel copy")) - (message (format "There are %d shadows to be updated." - (length shadow-files-to-copy))) + (message "There are %d shadows to be updated." + (length shadow-files-to-copy)) (shadow-write-todo-file)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -580,8 +585,7 @@ (progn (write-region (point-min) (point-max) to) (shadow-remove-from-todo s)) - (error (message (format "Shadow %s not updated!" - (cdr s))))))))) + (error (message "Shadow %s not updated!" (cdr s)))))))) (defun shadow-shadows-of (file) "Returns copy operations needed to update FILE. @@ -632,8 +636,8 @@ (setq shadow-files-to-copy (shadow-union shadows shadow-files-to-copy)) (shadow-when (not shadow-inhibit-message) - (message (substitute-command-keys - "Use \\[shadow-copy-files] to update shadows.")) + (message "%s" (substitute-command-keys + "Use \\[shadow-copy-files] to update shadows.")) (sit-for 1)) (shadow-write-todo-file))) nil) ; Return nil for write-file-hooks