Bug fix for vc-dispatcher split.
[bpt/emacs.git] / lisp / saveplace.el
index b6f3a76..bc290f3 100644 (file)
@@ -1,7 +1,7 @@
 ;;; saveplace.el --- automatically save place in files
 
 ;; Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007 Free Software Foundation, Inc.
+;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: Karl Fogel <kfogel@red-bean.com>
 ;; Maintainer: FSF
@@ -39,7 +39,7 @@
 ;;; Code:
 
 ;; this is what I was using during testing:
-;; (define-key ctl-x-map "p" 'toggle-save-place)
+;; (define-key ctl-x-map "p" 'toggle-save-place-globally)
 
 (defgroup save-place nil
   "Automatically save place in files."
@@ -205,13 +205,15 @@ may have changed\) back to `save-place-alist'."
       (setq save-place-alist (cdr save-place-alist)))))
 
 (defun save-place-alist-to-file ()
-  (let ((file (expand-file-name save-place-file)))
+  (let ((file (expand-file-name save-place-file))
+        (coding-system-for-write 'utf-8))
     (save-excursion
-      (message "Saving places to %s..." file)
       (set-buffer (get-buffer-create " *Saved Places*"))
       (delete-region (point-min) (point-max))
       (when save-place-forget-unreadable-files
        (save-place-forget-unreadable-files))
+      (insert (format ";;; -*- coding: %s -*-\n"
+                      (symbol-name coding-system-for-write)))
       (let ((print-length nil)
             (print-level nil))
         (print save-place-alist (current-buffer)))
@@ -224,10 +226,9 @@ may have changed\) back to `save-place-alist'."
                t))))
        (condition-case nil
            ;; Don't use write-file; we don't want this buffer to visit it.
-           (write-region (point-min) (point-max) file)
-         (file-error (message "Can't write %s" file)))
-        (kill-buffer (current-buffer))
-        (message "Saving places to %s...done" file)))))
+            (write-region (point-min) (point-max) file)
+         (file-error (message "Saving places: can't write %s" file)))
+        (kill-buffer (current-buffer))))))
 
 (defun load-save-place-alist-from-file ()
   (if (not save-place-loaded)
@@ -238,7 +239,6 @@ may have changed\) back to `save-place-alist'."
           ;; load it if it exists:
           (if (file-readable-p file)
               (save-excursion
-                (message "Loading places from %s..." file)
                 ;; don't want to use find-file because we have been
                 ;; adding hooks to it.
                 (set-buffer (get-buffer-create " *Saved Places*"))
@@ -266,8 +266,7 @@ may have changed\) back to `save-place-alist'."
                             (setq count (1+ count)))
                           (setq s (cdr s))))))
 
-                (kill-buffer (current-buffer))
-                (message "Loading places from %s...done" file)))
+                (kill-buffer (current-buffer))))
           nil))))
 
 (defun save-places-to-alist ()
@@ -311,5 +310,5 @@ may have changed\) back to `save-place-alist'."
 
 (provide 'saveplace) ; why not...
 
-;;; arch-tag: 3c2ef47b-0a22-4558-b116-118c9ef454a0
+;; arch-tag: 3c2ef47b-0a22-4558-b116-118c9ef454a0
 ;;; saveplace.el ends here