;;; bookmark.el --- set bookmarks, jump to them later.
-;; Copyright (C) 1993 Free Software Foundation
+;; Copyright (C) 1993, 1994 Free Software Foundation
;; Author: Karl Fogel <kfogel@cs.oberlin.edu>
;; Maintainer: Karl Fogel <kfogel@cs.oberlin.edu>
;; Created: July, 1993
-;; Version: 2.4
+;; Version: 2.5
;; Keywords: bookmarks, placeholders
;; This file is part of GNU Emacs.
;; Thanks to David Bremner <bremner@cs.sfu.ca> for thinking of and
;; then implementing the bookmark-current-bookmark idea. He even
-;; sent *patches*, bless his soul...
+;; sent *patches*, bless his soul...
;; Thanks to Gregory M. Saunders <saunders@cis.ohio-state.edu> for
;; fixing and improving bookmark-time-to-save-p.
+;; Thanks go to Andrew V. Klein <avk@rtsg.mot.com> for the code that
+;; sorts the alist before presenting it to the user (in list-bookmarks
+;; and the menu-bar).
+
;; And much thanks to David Hughes <djh@harston.cv.com> for many small
;; suggestions and the code to implement them (like
;; Bookmark-menu-check-position, and some of the Lucid compatibility
;; stuff).
+;; Kudos (whatever they are) go to Jim Blandy <jimb@cs.oberlin.edu>
+;; for his eminently sensible suggestion to separate bookmark-jump
+;; into bookmark-jump and bookmark-jump-noselect, which made many
+;; other things cleaner as well.
+
;; Thanks to Roland McGrath for encouragement and help with defining
;; autoloads on the menu-bar.
+;; Jonathan Stigelman <stig@key.amdahl.com> gave patches for default
+;; values in bookmark-jump and bookmark-set. Everybody please keep
+;; all the keystrokes they save thereby and send them to him at the
+;; end of each year :-) (No, seriously, thanks Jonathan!)
+
;; Based on info-bookmark.el, by Karl Fogel and Ken Olstad
;; <olstad@msc.edu>.
;; LCD Archive Entry:
;; bookmark|Karl Fogel|kfogel@cs.oberlin.edu|
;; Setting bookmarks in files or directories, jumping to them later.|
-;; 16-July-93|Version: 2.4|~/misc/bookmark.el.Z|
+;; 16-July-93|Version: 2.5|~/misc/bookmark.el.Z|
;; Enough with the credits already, get on to the good stuff:
;; These are the distribution keybindings suggested by RMS, everything
;; else will be done with M-x or the menubar:
;;;###autoload
-(if (symbolp (key-binding "\C-xr"))
+(if (or (symbolp (key-binding "\C-xr"))
+ (fboundp 'bookmark-set))
nil
(progn (define-key ctl-x-map "rb" 'bookmark-jump)
(define-key ctl-x-map "rm" 'bookmark-set)
;; just add the hook to make sure that people don't lose bookmarks
;; when they kill Emacs, unless they don't want to save them.
-;;;###autoload
(add-hook 'kill-emacs-hook
(function
(lambda () (and (featurep 'bookmark)
(save-window-excursion
(if (>= baud-rate 9600)
(message (format "Saving bookmarks to file %s." file)))
- (set-buffer (find-file-noselect file))
+ (set-buffer (let ((enable-local-variables nil))
+ (find-file-noselect file)))
(goto-char (point-min))
(delete-region (point-min) (point-max))
(print bookmark-alist (current-buffer))
(save-window-excursion
(if (and (null no-msg) (>= baud-rate 9600))
(message (format "Loading bookmarks from %s..." file)))
- (set-buffer (find-file-noselect file))
+ (set-buffer (let ((enable-local-variables nil))
+ (find-file-noselect file)))
(goto-char (point-min))
(let ((blist (car (read-from-string
(buffer-substring (point-min) (point-max))))))
(cons menu-str menu)))))
(if str (apply func-sym (list str)))))
+;;;###autoload
(defun bookmark-menu-bar-insert (event)
"Insert the text of the file pointed to by bookmark BOOKMARK.
You may have a problem using this function if the value of variable
"--- Insert Contents ---"
event))
+;;;###autoload
(defun bookmark-menu-bar-jump (event)
"Jump to bookmark BOOKMARK (a point in some file).
You may have a problem using this function if the value of variable
"--- Jump to Bookmark ---"
event))
+;;;###autoload
(defun bookmark-menu-bar-locate (event)
"Insert the name of the file associated with BOOKMARK.
\(This is not the same as the contents of that file\)."
"--- Insert Location ---"
event))
+;;;###autoload
(defun bookmark-menu-bar-rename (event)
"Change the name of OLD-BOOKMARK to NEWNAME.
If called from keyboard, prompts for OLD-BOOKMARK and NEWNAME.
"--- Rename Bookmark ---"
event))
+;;;###autoload
(defun bookmark-menu-bar-delete (event)
"Delete the bookmark named NAME from the bookmark list.
Removes only the first instance of a bookmark with that name. If
;; Thanks to Roland McGrath for fixing menubar.el so that the
;; following works, and for explaining what to do to make it work.
-;;;###autoload
-(define-key global-map [menu-bar bookmark]
- '("Bookmarks" . menu-bar-bookmark-map))
-
+;;;###autoload
(defvar menu-bar-bookmark-map (make-sparse-keymap "Bookmark functions."))
-;; make bookmarks appear toward the right side of the menu.
-(if (boundp 'menu-bar-final-items)
- (if menu-bar-final-items
- (setq menu-bar-final-items
- (cons 'bookmark menu-bar-final-items)))
- (setq menu-bar-final-items '(bookmark)))
+;;;###autoload
+(fset 'menu-bar-bookmark-map (symbol-value 'menu-bar-bookmark-map))
+;;;###autoload
(define-key menu-bar-bookmark-map [load]
'("Load a bookmark file" . bookmark-load))
+;;;###autoload
(define-key menu-bar-bookmark-map [write]
'("Write \(to another file\)" . bookmark-write))
+;;;###autoload
(define-key menu-bar-bookmark-map [save]
'("Save \(in default file\)" . bookmark-save))
+;;;###autoload
(define-key menu-bar-bookmark-map [edit]
'("Edit Bookmark List" . list-bookmarks))
+;;;###autoload
(define-key menu-bar-bookmark-map [delete]
'("Delete bookmark" . bookmark-menu-bar-delete))
+;;;###autoload
(define-key menu-bar-bookmark-map [rename]
'("Rename bookmark" . bookmark-menu-bar-rename))
+;;;###autoload
(define-key menu-bar-bookmark-map [locate]
'("Insert location" . bookmark-menu-bar-locate))
+;;;###autoload
(define-key menu-bar-bookmark-map [insert]
'("Insert contents" . bookmark-menu-bar-insert))
+;;;###autoload
(define-key menu-bar-bookmark-map [set]
'("Set bookmark" . bookmark-set))
+;;;###autoload
(define-key menu-bar-bookmark-map [jump]
'("Jump to bookmark" . bookmark-menu-bar-jump))
-
-;;;###autoload (autoload 'menu-bar-bookmark-map "bookmark" nil t 'keymap)
(fset 'menu-bar-bookmark-map (symbol-value 'menu-bar-bookmark-map))
(provide 'bookmark)
;;; bookmark.el ends here
-