changeset 86967:1cd90460f988

Offer option for saveplace to be quiet about loading and saving. Suggested by: David Reitter <dreitter{_AT_}inf.ed.ac.uk> * lisp/saveplace.el (save-place-quiet): New customizable boolean. (save-place-alist-to-file, load-save-place-alist-from-file): Use it to determine whether to print loading/saving messages.
author Karl Fogel <kfogel@red-bean.com>
date Sun, 02 Dec 2007 19:54:46 +0000
parents bb838b593914
children 7c7322501bc1
files lisp/ChangeLog lisp/saveplace.el
diffstat 2 files changed, 21 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Dec 02 18:58:23 2007 +0000
+++ b/lisp/ChangeLog	Sun Dec 02 19:54:46 2007 +0000
@@ -1,3 +1,12 @@
+2007-12-02  Karl Fogel  <kfogel@red-bean.com>
+
+	Offer option for saveplace to be quiet about loading and saving.
+	Suggested by: David Reitter <dreitter{_AT_}inf.ed.ac.uk>
+
+	* lisp/saveplace.el (save-place-quiet): New customizable boolean.
+	(save-place-alist-to-file, load-save-place-alist-from-file): Use it
+	to determine whether to print loading/saving messages.
+
 2007-12-02  Glenn Morris  <rgm@gnu.org>
 
 	* mail/binhex.el: Move here from gnus/.
--- a/lisp/saveplace.el	Sun Dec 02 18:58:23 2007 +0000
+++ b/lisp/saveplace.el	Sun Dec 02 19:54:46 2007 +0000
@@ -119,6 +119,10 @@
 on this flag."
   :type 'boolean :group 'save-place)
 
+(defcustom save-place-quiet nil
+  "If non-nil, suppress messages about loading and saving `save-place-alist'."
+  :type 'boolean :group 'save-place)
+
 (defcustom save-place-skip-check-regexp
   ;; thanks to ange-ftp-name-format
   "\\`/\\(?:cdrom\\|floppy\\|mnt\\|\\(?:[^@/:]*@\\)?[^@/:]*[^@/:.]:\\)"
@@ -207,7 +211,8 @@
 (defun save-place-alist-to-file ()
   (let ((file (expand-file-name save-place-file)))
     (save-excursion
-      (message "Saving places to %s..." file)
+      (unless save-place-quiet
+        (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
@@ -227,7 +232,8 @@
 	    (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)))))
+        (unless save-place-quiet
+          (message "Saving places to %s...done" file))))))
 
 (defun load-save-place-alist-from-file ()
   (if (not save-place-loaded)
@@ -238,7 +244,8 @@
           ;; load it if it exists:
           (if (file-readable-p file)
               (save-excursion
-                (message "Loading places from %s..." file)
+                (unless save-place-quiet
+                  (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*"))
@@ -267,7 +274,8 @@
                           (setq s (cdr s))))))
 
                 (kill-buffer (current-buffer))
-                (message "Loading places from %s...done" file)))
+                (unless save-place-quiet
+                  (message "Loading places from %s...done" file))))
           nil))))
 
 (defun save-places-to-alist ()