(shadow-join): Remove.
authorJuanma Barranquero <lekktu@gmail.com>
Wed, 31 Oct 2007 10:24:20 +0000 (10:24 +0000)
committerJuanma Barranquero <lekktu@gmail.com>
Wed, 31 Oct 2007 10:24:20 +0000 (10:24 +0000)
(shadow-shadows): Use `mapconcat' instead of `shadow-join'.
(shadow-initialize): Use `write-file-functions', not `write-file-hooks'.
(shadowfile-unload-hook): Remove function and variable.
(shadowfile-unload-function): New-style unload function, adapted
from `shadowfile-unload-hook'.

lisp/ChangeLog
lisp/shadowfile.el

index ff36e73..a8e111c 100644 (file)
@@ -1,3 +1,12 @@
+2007-10-31  Juanma Barranquero  <lekktu@gmail.com>
+
+       * shadowfile.el (shadow-join): Remove.
+       (shadow-shadows): Use `mapconcat' instead of `shadow-join'.
+       (shadow-initialize): Use `write-file-functions', not `write-file-hooks'.
+       (shadowfile-unload-hook): Remove function and variable.
+       (shadowfile-unload-function): New-style unload function, adapted
+       from `shadowfile-unload-hook'.
+
 2007-10-31  Dan Nicolaescu  <dann@ics.uci.edu>
 
        * progmodes/mixal-mode.el (mixal-run, mixal-debug): Call mixvm
@@ -19,8 +28,8 @@
        Wrap with-no-warnings around uses of next-line and previous-line.
 
        * ediff.el (run-ediff-from-cvs-buffer):
-       * ediff-vers.el (cvs-run-ediff-on-file-descriptor): Remove
-       function not used by pcl-cvs anymore.
+       * ediff-vers.el (cvs-run-ediff-on-file-descriptor):
+       Remove function not used by pcl-cvs anymore.
        (noninteractive, generic-sc-get-latest-rev)
        (ediff-generic-sc-internal, ediff-generic-sc-merge-internal):
        Delete support for long obsolete generic-sc.el.
index d1de8be..ca06ace 100644 (file)
@@ -28,7 +28,7 @@
 ;;  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).
+;;  copy it when you exit Emacs (or use the shadow-copy-files command).
 
 ;; Installation & Use:
 
@@ -38,8 +38,8 @@
 ;;  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
+;;  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
@@ -47,7 +47,7 @@
 ;;  .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
+;;  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
@@ -192,12 +192,6 @@ Nondestructive; actually returns a copy of the list with the elements removed."
        (cons (car list) (shadow-remove-if func (cdr list))))
     nil))
 
-(defun shadow-join (strings sep)
-  "Concatenate elements of the list of STRINGS with SEP between each."
-  (cond ((null strings) "")
-       ((null (cdr strings)) (car strings))
-       ((concat (car strings) " " (shadow-join (cdr strings) sep)))))
-
 (defun shadow-regexp-superquote (string)
   "Like `regexp-quote', but includes the ^ and $.
 This makes sure regexp matches nothing but STRING."
@@ -503,9 +497,7 @@ Each site can be either a hostname or the name of a cluster \(see
   ;; Mostly for debugging.
   "Interactive function to display shadows of a buffer."
   (interactive)
-  (let ((msg (shadow-join (mapcar (function cdr)
-                                 (shadow-shadows-of (buffer-file-name)))
-                         " ")))
+  (let ((msg (mapconcat #'cdr (shadow-shadows-of (buffer-file-name)) " ")))
     (message "%s"
             (if (zerop (length msg))
                 "No shadows."
@@ -643,7 +635,7 @@ Consider them as regular expressions if third arg REGEXP is true."
                       "Use \\[shadow-copy-files] to update shadows."))
        (sit-for 1))
       (shadow-write-todo-file)))
-  nil)     ; Return nil for write-file-hooks
+  nil)     ; Return nil for write-file-functions
 
 (defun shadow-remove-from-todo (pair)
   "Remove PAIR from `shadow-files-to-copy'.
@@ -830,16 +822,16 @@ look for files that have been changed and need to be copied to other systems."
       (defalias 'shadow-orig-save-buffers-kill-emacs
        (symbol-function 'save-buffers-kill-emacs))
       (defalias 'save-buffers-kill-emacs 'shadow-save-buffers-kill-emacs))
-    (add-hook 'write-file-hooks 'shadow-add-to-todo)
+    (add-hook 'write-file-functions 'shadow-add-to-todo)
     (define-key ctl-x-4-map "s" 'shadow-copy-files)))
 
-(defun shadowfile-unload-hook ()
-  (if (fboundp 'shadow-orig-save-buffers-kill-emacs)
-      (fset 'save-buffers-kill-emacs
-           (symbol-function 'shadow-orig-save-buffers-kill-emacs)))
-  (remove-hook 'write-file-hooks 'shadow-add-to-todo))
-
-(add-hook 'shadowfile-unload-hook 'shadowfile-unload-hook)
+(defun shadowfile-unload-function ()
+  (substitute-key-definition 'shadow-copy-files nil ctl-x-4-map)
+  (when (fboundp 'shadow-orig-save-buffers-kill-emacs)
+    (fset 'save-buffers-kill-emacs
+         (symbol-function 'shadow-orig-save-buffers-kill-emacs)))
+  ;; continue standard unloading
+  nil)
 
 (provide 'shadowfile)