;;; bookmark.el --- set bookmarks, maybe annotate them, jump to them later
;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 2001, 2002, 2003,
-;; 2004, 2005 Free Software Foundation, Inc.
+;; 2004, 2005, 2006 Free Software Foundation, Inc.
;; Author: Karl Fogel <kfogel@red-bean.com>
;; Maintainer: Karl Fogel <kfogel@red-bean.com>
;;; end file-format stuff
+\f
+;;; Generic helpers.
+
+(defun bookmark-maybe-message (fmt &rest args)
+ "Apply `message' to FMT and ARGS, but only if the display is fast enough."
+ (if (>= baud-rate 9600)
+ (apply 'message fmt args)))
+
\f
;;; Core code:
(defun bookmark-write-file (file)
(save-excursion
(save-window-excursion
- (if (>= baud-rate 9600)
- (message "Saving bookmarks to file %s..." file))
+ (bookmark-maybe-message "Saving bookmarks to file %s..." file)
(set-buffer (get-buffer-create " *Bookmarks*"))
(goto-char (point-min))
(delete-region (point-min) (point-max))
(write-region (point-min) (point-max) file)
(file-error (message "Can't write %s" file)))
(kill-buffer (current-buffer))
- (if (>= baud-rate 9600)
- (message "Saving bookmarks to file %s...done" file)))))))
+ (bookmark-maybe-message
+ "Saving bookmarks to file %s...done" file))))))
(defun bookmark-import-new-list (new-list)
(if (file-readable-p file)
(save-excursion
(save-window-excursion
- (if (and (null no-msg) (>= baud-rate 9600))
- (message "Loading bookmarks from %s..." file))
+ (if (null no-msg)
+ (bookmark-maybe-message "Loading bookmarks from %s..." file))
(set-buffer (let ((enable-local-variables nil))
(find-file-noselect file)))
(goto-char (point-min))
(bookmark-bmenu-surreptitiously-rebuild-list))
(error "Invalid bookmark list in %s" file)))
(kill-buffer (current-buffer)))
- (if (and (null no-msg) (>= baud-rate 9600))
- (message "Loading bookmarks from %s...done" file)))
+ (if (null no-msg)
+ (bookmark-maybe-message "Loading bookmarks from %s...done" file)))
(error "Cannot read bookmark file %s" file)))