]> code.delx.au - gnu-emacs/blobdiff - lisp/bookmark.el
Also load for .sgm and .dtd files.
[gnu-emacs] / lisp / bookmark.el
index b31e711e02effbad64c0cb436d7ed7aa333e0617..7afecd3d20d3ce5efd01d6ccf866a4f981038a99 100644 (file)
@@ -2,16 +2,17 @@
 
 ;; Copyright (C) 1993, 1994, 1995 Free Software Foundation
 
 
 ;; Copyright (C) 1993, 1994, 1995 Free Software Foundation
 
-;; Author: Karl Fogel <kfogel@cyclic.com>
-;; Maintainer: Karl Fogel <kfogel@cyclic.com>
+;; Author: Karl Fogel <kfogel@red-bean.com>
+;; Maintainer: Karl Fogel <kfogel@red-bean.com>
 ;; Created: July, 1993
 ;; Created: July, 1993
-;; Author's Update Number: 2.6.10
+;; Author's Update Number: see variable `bookmark-version'.
 ;; Keywords: bookmarks, placeholders, annotations
 
 ;;; Summary:
 ;; This package is for setting "bookmarks" in files.  A bookmark
 ;; associates a string with a location in a certain file.  Thus, you
 ;; can navigate your way to that location by providing the string.
 ;; Keywords: bookmarks, placeholders, annotations
 
 ;;; Summary:
 ;; This package is for setting "bookmarks" in files.  A bookmark
 ;; associates a string with a location in a certain file.  Thus, you
 ;; can navigate your way to that location by providing the string.
+;; See the "User Variables" section for customizations.
 
 ;;; Copyright info:
 ;; This file is part of GNU Emacs.
 
 ;;; Copyright info:
 ;; This file is part of GNU Emacs.
@@ -46,7 +47,7 @@
 ;; bookmark-bmenu-check-position, and some of the Lucid compatibility
 ;; stuff).
 
 ;; bookmark-bmenu-check-position, and some of the Lucid compatibility
 ;; stuff).
 
-;; Kudos (whatever they are) go to Jim Blandy <jimb@cyclic.com>
+;; Kudos (whatever they are) go to Jim Blandy <jimb@red-bean.com>
 ;; for his eminently sensible suggestion to separate bookmark-jump
 ;; into bookmark-jump and bookmark-jump-noselect, which made many
 ;; other things cleaner as well.
 ;; for his eminently sensible suggestion to separate bookmark-jump
 ;; into bookmark-jump and bookmark-jump-noselect, which made many
 ;; other things cleaner as well.
@@ -54,7 +55,7 @@
 ;; Thanks to Roland McGrath for encouragement and help with defining
 ;; autoloads on the menu-bar.
 
 ;; 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
+;; Jonathan Stigelman <stig@hackvan.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!)
 ;; 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>.
 
 ;; Based on info-bookmark.el, by Karl Fogel and Ken Olstad
 ;; <olstad@msc.edu>.
 
+;; Thanks to Mikio Nakajima <PBC01764@niftyserve.or.jp> for many bugs
+;; reported and fixed.
+
+;; Thank you, Michael Kifer, for contributing the XEmacs support.
+
 ;; Enough with the credits already, get on to the good stuff:
 
 ;; FAVORITE CHINESE RESTAURANT: 
 ;; Enough with the credits already, get on to the good stuff:
 
 ;; FAVORITE CHINESE RESTAURANT: 
 \f
 ;;;; Code:
 
 \f
 ;;;; Code:
 
+(defconst bookmark-version "2.6.20"
+  "Version number of bookmark.el.  This is not related to the version
+of Emacs bookmark comes with; it is used solely by bookmark's
+maintainers to avoid version confusion.")
+
 ;;; Misc comments:
 ;;
 ;; If variable bookmark-use-annotations is non-nil, an annotation is
 ;;; Misc comments:
 ;;
 ;; If variable bookmark-use-annotations is non-nil, an annotation is
 ;; the list will be presented in the order it is recorded
 ;; (chronologically), which is actually fairly useful as well.
 
 ;; the list will be presented in the order it is recorded
 ;; (chronologically), which is actually fairly useful as well.
 
-;;; Code:
+;;; User Variables
+
+(defvar bookmark-use-annotations nil
+  "*If non-nil, saving a bookmark will query for an annotation in a
+buffer.")
+
+
+(defvar bookmark-save-flag t
+  "*Controls when Emacs saves bookmarks to a file.
+--> Nil means never save bookmarks, except when `bookmark-save' is
+    explicitly called \(\\[bookmark-save]\).
+--> t means save bookmarks when Emacs is killed.
+--> Otherwise, it should be a number that is the frequency with which
+    the bookmark list is saved \(i.e.: the number of times which
+    Emacs' bookmark list may be modified before it is automatically
+    saved.\).  If it is a number, Emacs will also automatically save
+    bookmarks when it is killed.
+
+Therefore, the way to get it to save every time you make or delete a
+bookmark is to set this variable to 1 \(or 0, which produces the same
+behavior.\)
+
+To specify the file in which to save them, modify the variable
+bookmark-default-file, which is `~/.emacs.bmk' by default.")
+
+
+(defconst bookmark-old-default-file "~/.emacs-bkmrks"
+  "*The .emacs.bmk file used to be called this.")
+
+
+;; defvarred to avoid a compilation warning:
+(defvar bookmark-file nil
+  "Old name for `bookmark-default-file'.")
+
+(defvar bookmark-default-file
+  (if bookmark-file
+      ;; In case user set `bookmark-file' in her .emacs:
+      bookmark-file
+    (if (eq system-type 'ms-dos)
+        "~/emacs.bmk" ; Cannot have initial dot [Yuck!]
+      "~/.emacs.bmk"))
+  "*File in which to save bookmarks by default.")
+
+
+(defvar bookmark-version-control 'nospecial
+  "*Whether or not to make numbered backups of the bookmark file.
+It can have four values: t, nil, `never', and `nospecial'.
+The first three have the same meaning that they do for the
+variable `version-control', and the final value `nospecial' means just
+use the value of `version-control'.")
+
+
+(defvar bookmark-completion-ignore-case t
+  "*Non-nil means bookmark functions ignore case in completion.")
+
+
+(defvar bookmark-sort-flag t
+  "*Non-nil means that bookmarks will be displayed sorted by bookmark
+name.  Otherwise they will be displayed in LIFO order (that is, most
+recently set ones come first, oldest ones come last).")
+
+
+(defvar bookmark-automatically-show-annotations t
+  "*Nil means don't show annotations when jumping to a bookmark.")
+
+
+(defvar bookmark-bmenu-file-column 30
+  "*Column at which to display filenames in a buffer listing bookmarks.
+You can toggle whether files are shown with \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-toggle-filenames].")
+
+
+(defvar bookmark-bmenu-toggle-filenames t
+  "*Non-nil means show filenames when listing bookmarks.
+This may result in truncated bookmark names.  To disable this, put the
+following in your .emacs:
+
+\(setq bookmark-bmenu-toggle-filenames nil\)")
+
+
+(defvar bookmark-menu-length 70
+  "*Maximum length of a bookmark name displayed on a popup menu.")
+
+
+;;; No user-serviceable parts beyond this point.
+
+;; Is it XEmacs?
+(defconst bookmark-xemacsp
+  (string-match "\\(Lucid\\|Xemacs\\)" emacs-version))
+
 
 ;; Added  for lucid emacs  compatibility, db
 (or (fboundp 'defalias)  (fset 'defalias 'fset))
 
 ;; suggested for lucid compatibility by david hughes:
 
 ;; Added  for lucid emacs  compatibility, db
 (or (fboundp 'defalias)  (fset 'defalias 'fset))
 
 ;; suggested for lucid compatibility by david hughes:
-(or (fboundp 'frame-height)  (fset 'frame-height 'screen-height))
+(or (fboundp 'frame-height)  (defalias 'frame-height 'screen-height))
 
 
+;; This variable is probably obsolete now...
+(or (boundp 'baud-rate)
+    ;; some random value higher than 9600    
+    (setq baud-rate 19200))
+
+;; XEmacs apparently call this `buffer-substring-without-properties',
+;; sigh.
+(or (fboundp 'buffer-substring-no-properties)
+    (if (fboundp 'buffer-substring-without-properties)
+        (fset 'buffer-substring-no-properties
+              'buffer-substring-without-properties)
+      (fset 'buffer-substring-no-properties 'buffer-substring)))
 
 \f
 ;;; Keymap stuff:
 
 \f
 ;;; Keymap stuff:
@@ -120,10 +231,6 @@ so that you have a bookmark prefix, just use `global-set-key' and bind a
 key of your choice to `bookmark-map'.  All interactive bookmark
 functions have a binding in this keymap.")
 
 key of your choice to `bookmark-map'.  All interactive bookmark
 functions have a binding in this keymap.")
 
-(defvar bookmark-use-annotations nil
-  "*If non-nil, saving a bookmark will query for an annotation in a
-buffer.")
-
 ;;;###autoload
 (define-prefix-command 'bookmark-map)
 
 ;;;###autoload
 (define-prefix-command 'bookmark-map)
 
@@ -167,7 +274,24 @@ buffer.")
 (defvar bookmark-alist ()
   "Association list of bookmarks and their records.
 You probably don't want to change the value of this alist yourself;
 (defvar bookmark-alist ()
   "Association list of bookmarks and their records.
 You probably don't want to change the value of this alist yourself;
-instead, let the various bookmark functions do it for you.")
+instead, let the various bookmark functions do it for you.
+
+The format of the alist is
+
+       \(BOOKMARK1 BOOKMARK2 ...\)
+
+where each BOOKMARK is of the form
+
+\(NAME
+  \(filename . FILE\)
+  \(front-context-string . FRONT-STR\)
+  \(rear-context-string  . REAR-STR\)
+  \(position . POS\)
+  \(info-node . POS\)
+  \(annotation . ANNOTATION\)\)
+
+So the cdr of each bookmark is an alist too.
+`info-node' is optional, by the way.")
 
 
 (defvar bookmarks-already-loaded nil)
 
 
 (defvar bookmarks-already-loaded nil)
@@ -193,69 +317,10 @@ through a file easier.")
 (make-variable-buffer-local 'bookmark-current-bookmark)
 
 
 (make-variable-buffer-local 'bookmark-current-bookmark)
 
 
-(defvar bookmark-save-flag t
-  "*Controls when Emacs saves bookmarks to a file.
---> Nil means never save bookmarks, except when `bookmark-save' is
-    explicitly called \(\\[bookmark-save]\).
---> t means save bookmarks when Emacs is killed.
---> Otherise, it should be a number that is the frequency with which
-    the bookmark list is saved \(i.e.: the number of times which
-    Emacs' bookmark list may be modified before it is automatically
-    saved.\).  If it is a number, Emacs will also automatically save
-    bookmarks when it is killed.
-
-Therefore, the way to get it to save every time you make or delete a
-bookmark is to set this variable to 1 \(or 0, which produces the same
-behavior.\)
-
-To specify the file in which to save them, modify the variable
-bookmark-default-file, which is `~/.emacs.bmk' by default.")
-
-
 (defvar bookmark-alist-modification-count 0
   "Number of modifications to bookmark list since it was last saved.")
 
 
 (defvar bookmark-alist-modification-count 0
   "Number of modifications to bookmark list since it was last saved.")
 
 
-(defconst bookmark-old-default-file "~/.emacs-bkmrks"
-  "*The .emacs.bmk file used to be called this.")
-
-
-;; defvarred to avoid a compilation warning:
-(defvar bookmark-file nil
-  "Old name for `bookmark-default-file'.")
-
-(defvar bookmark-default-file
-  (if bookmark-file
-      ;; In case user set `bookmark-file' in her .emacs:
-      bookmark-file
-    (if (eq system-type 'ms-dos)
-        "~/emacs.bmk" ; Cannot have initial dot [Yuck!]
-      "~/.emacs.bmk"))
-  "*File in which to save bookmarks by default.")
-
-
-(defvar bookmark-version-control 'nospecial
-  "This variable controls whether or not to make numbered backups of
-the master bookmark file.  It can have four values: t, nil, never, and
-nospecial.  The first three have the same meaning that they do for the
-variable version-control, and the final value nospecial means just use
-the value of version-control.")
-
-
-(defvar bookmark-completion-ignore-case t
-  "*Non-nil means bookmark functions ignore case in completion.")
-
-
-(defvar bookmark-sort-flag t
-  "*Non-nil means that bookmarks will be displayed sorted by bookmark
-name.  Otherwise they will be displayed in LIFO order (that is, most
-recently set ones come first, oldest ones come last).")
-
-
-(defvar bookmark-automatically-show-annotations t
-  "*Nil means don't show annotations when jumping to a bookmark.")
-
-
 (defvar bookmark-search-size 16
   "Length of the context strings recorded on either side of a bookmark.")
 
 (defvar bookmark-search-size 16
   "Length of the context strings recorded on either side of a bookmark.")
 
@@ -273,7 +338,7 @@ recently set ones come first, oldest ones come last).")
 ;; Everyone else should go through them.
 
 (defun bookmark-name-from-full-record (full-record)
 ;; Everyone else should go through them.
 
 (defun bookmark-name-from-full-record (full-record)
-  "Return name of BOOKMARK \(an alist element instead of a string\)."
+  "Return name of FULL-RECORD \(an alist element instead of a string\)."
   (car full-record))
 
 
   (car full-record))
 
 
@@ -308,7 +373,7 @@ That is, all information but the name."
 
 
 (defun bookmark-set-annotation (bookmark ann)
 
 
 (defun bookmark-set-annotation (bookmark ann)
-  "Set the annotation of BOOKMARK."
+  "Set the annotation of BOOKMARK to ANN."
   (let ((cell (assq 'annotation (bookmark-get-bookmark-record bookmark))))
     (if cell
         (setcdr cell ann)
   (let ((cell (assq 'annotation (bookmark-get-bookmark-record bookmark))))
     (if cell
         (setcdr cell ann)
@@ -375,6 +440,7 @@ That is, all information but the name."
 
 
 (defun bookmark-get-info-node (bookmark)
 
 
 (defun bookmark-get-info-node (bookmark)
+  "Get the info node associated with BOOKMARK."
   (cdr (assq 'info-node (bookmark-get-bookmark-record bookmark))))
   
 
   (cdr (assq 'info-node (bookmark-get-bookmark-record bookmark))))
   
 
@@ -425,61 +491,57 @@ menus, so `completing-read' never gets a chance to set `bookmark-history'."
       (setq bookmark-history (cons (, string) bookmark-history)))))
 
 
       (setq bookmark-history (cons (, string) bookmark-history)))))
 
 
-(defun bookmark-make (str &optional annotation overwrite)
+(defun bookmark-make (name &optional annotation overwrite)
   "Make a bookmark named NAME.
 Optional second arg ANNOTATION gives it an annotation.
 Optional third arg OVERWRITE means replace any existing bookmarks with
 this name."
   (bookmark-maybe-load-default-file)
   "Make a bookmark named NAME.
 Optional second arg ANNOTATION gives it an annotation.
 Optional third arg OVERWRITE means replace any existing bookmarks with
 this name."
   (bookmark-maybe-load-default-file)
-  (if (and (bookmark-get-bookmark str) (not overwrite))
-      ;; already existing boookmark under that name and
-      ;; no prefix arg means just overwrite old bookmark
-      (setcdr (bookmark-get-bookmark str)
-              (list (bookmark-make-cell annotation)))
-    
-    ;; otherwise just cons it onto the front (either the bookmark
-    ;; doesn't exist already, or there is no prefix arg.  In either
-    ;; case, we want the new bookmark consed onto the alist...)
+  (let ((stripped-name (copy-sequence name)))
+    (or bookmark-xemacsp
+        ;; XEmacs's `set-text-properties' doesn't work on
+        ;; free-standing strings, apparently.
+        (set-text-properties 0 (length stripped-name) nil stripped-name))
+    (if (and (bookmark-get-bookmark stripped-name) (not overwrite))
+        ;; already existing bookmark under that name and
+        ;; no prefix arg means just overwrite old bookmark
+        (setcdr (bookmark-get-bookmark stripped-name)
+                (list (bookmark-make-cell annotation)))
+      
+      ;; otherwise just cons it onto the front (either the bookmark
+      ;; doesn't exist already, or there is no prefix arg.  In either
+      ;; case, we want the new bookmark consed onto the alist...)
+      
+      (setq bookmark-alist
+            (cons
+             (list stripped-name 
+                   (bookmark-make-cell annotation))
+             bookmark-alist)))
     
     
-    (setq bookmark-alist
-          (cons
-           (list str 
-                 (bookmark-make-cell annotation))
-           bookmark-alist)))
-
-  ;; Added by db
-  (setq bookmark-current-bookmark str)
-  (setq bookmark-alist-modification-count
-        (1+ bookmark-alist-modification-count))
-  (if (bookmark-time-to-save-p)
-      (bookmark-save)))
+    ;; Added by db
+    (setq bookmark-current-bookmark stripped-name)
+    (setq bookmark-alist-modification-count
+          (1+ bookmark-alist-modification-count))
+    (if (bookmark-time-to-save-p)
+        (bookmark-save))))
 
 
 (defun bookmark-make-cell (annotation)
 
 
 (defun bookmark-make-cell (annotation)
-  "Return the record part of a bookmark.
+  "Return the record part of a new bookmark, given ANNOTATION.
 Must be at the correct position in the buffer in which the bookmark is
 Must be at the correct position in the buffer in which the bookmark is
-being set.  This will change soon.
-Takes ANNOTATION as an argument."
+being set.  This will change soon."
   (` ((filename . (, (bookmark-buffer-file-name)))
       (front-context-string
        . (, (if (>= (- (point-max) (point)) bookmark-search-size)
   (` ((filename . (, (bookmark-buffer-file-name)))
       (front-context-string
        . (, (if (>= (- (point-max) (point)) bookmark-search-size)
-                ;; strip text props via `format':
-               (let ((string
-                        (buffer-substring 
-                         (point)
-                         (+ (point) bookmark-search-size))))
-                  (set-text-properties 0 (length string) nil string)
-                  string)
+                (buffer-substring-no-properties
+                 (point)
+                 (+ (point) bookmark-search-size))
               nil)))
       (rear-context-string
        . (, (if (>= (- (point) (point-min)) bookmark-search-size)
               nil)))
       (rear-context-string
        . (, (if (>= (- (point) (point-min)) bookmark-search-size)
-                ;; strip text props via `format':
-               (let ((string
-                        (buffer-substring 
-                         (point)
-                         (- (point) bookmark-search-size))))
-                  (set-text-properties 0 (length string) nil string)
-                  string)
+                (buffer-substring-no-properties
+                 (point)
+                 (- (point) bookmark-search-size))
               nil)))
       (position . (, (point)))
       (annotation . (, annotation)))))
               nil)))
       (position . (, (point)))
       (annotation . (, annotation)))))
@@ -565,7 +627,7 @@ affect point."
 
 
 (defun bookmark-upgrade-version-0-alist (old-list)
 
 
 (defun bookmark-upgrade-version-0-alist (old-list)
-  "Upgrade a version 0 alist to the current version."
+  "Upgrade a version 0 alist OLD-LIST to the current version."
   (mapcar
    (lambda (bookmark)
      (let* ((name      (car bookmark))
   (mapcar
    (lambda (bookmark)
      (let* ((name      (car bookmark))
@@ -597,7 +659,7 @@ This expects to be called from point-min in a bookmark file."
     (pp new-list (current-buffer))
     (save-buffer))
   (goto-char (point-min))
     (pp new-list (current-buffer))
     (save-buffer))
   (goto-char (point-min))
-  (message "Upgrading bookmark format from 0 to %d... done."
+  (message "Upgrading bookmark format from 0 to %d...done"
            bookmark-file-format-version)
   )
 
            bookmark-file-format-version)
   )
 
@@ -647,8 +709,9 @@ This expects to be called from point-min in a bookmark file."
 ;;; Core code:
 
 ;;;###autoload
 ;;; Core code:
 
 ;;;###autoload
-(defun bookmark-set (&optional parg)
-  "Set a bookmark named NAME inside a file.  
+(defun bookmark-set (&optional name parg)
+  "Set a bookmark named NAME inside a file.
+If name is nil, then the user will be prompted.
 With prefix arg, will not overwrite a bookmark that has the same name
 as NAME if such a bookmark already exists, but instead will \"push\"
 the new bookmark onto the bookmark alist.  Thus the most recently set
 With prefix arg, will not overwrite a bookmark that has the same name
 as NAME if such a bookmark already exists, but instead will \"push\"
 the new bookmark onto the bookmark alist.  Thus the most recently set
@@ -668,7 +731,7 @@ name of the file being visited.
 Use \\[bookmark-delete] to remove bookmarks \(you give it a name,
 and it removes only the first instance of a bookmark with that name from
 the list of bookmarks.\)"
 Use \\[bookmark-delete] to remove bookmarks \(you give it a name,
 and it removes only the first instance of a bookmark with that name from
 the list of bookmarks.\)"
-  (interactive "P")
+  (interactive (list nil current-prefix-arg))
   (or
    (bookmark-buffer-file-name)
    (error "Buffer not visiting a file or directory."))
   (or
    (bookmark-buffer-file-name)
    (error "Buffer not visiting a file or directory."))
@@ -682,15 +745,16 @@ the list of bookmarks.\)"
   (let* ((default (or bookmark-current-bookmark
                       (bookmark-buffer-name)))
         (str
   (let* ((default (or bookmark-current-bookmark
                       (bookmark-buffer-name)))
         (str
-         (read-from-minibuffer
-           (format "Set bookmark (%s): " default)
-          nil
-          (let ((now-map (copy-keymap minibuffer-local-map)))
-            (progn (define-key now-map  "\C-w" 
-                     'bookmark-yank-word)
-                   (define-key now-map  "\C-u" 
-                     'bookmark-insert-current-bookmark))
-            now-map)))
+         (or name
+              (read-from-minibuffer
+               (format "Set bookmark (%s): " default)
+               nil
+               (let ((now-map (copy-keymap minibuffer-local-map)))
+                 (progn (define-key now-map  "\C-w" 
+                          'bookmark-yank-word)
+                        (define-key now-map  "\C-u" 
+                          'bookmark-insert-current-bookmark))
+                 now-map))))
         (annotation nil))
     (and (string-equal str "") (setq str default))
     ;; Ask for an annotation buffer for this bookmark 
         (annotation nil))
     (and (string-equal str "") (setq str default))
     ;; Ask for an annotation buffer for this bookmark 
@@ -767,12 +831,13 @@ the bookmark (and file, and point) specified in buffer local variables."
 
 (defvar bookmark-read-annotation-text-func 'bookmark-default-annotation-text
   "A variable containing a function which returns the text to insert
 
 (defvar bookmark-read-annotation-text-func 'bookmark-default-annotation-text
   "A variable containing a function which returns the text to insert
-into an annotation compisition buffer.  It takes the name of the bookmark,
+into an annotation composition buffer.  It takes the name of the bookmark,
 as a string, as an arg.")
 
 
 (defun bookmark-read-annotation-mode (buf point parg bookmark)
   "Mode for composing annotations for a bookmark.
 as a string, as an arg.")
 
 
 (defun bookmark-read-annotation-mode (buf point parg bookmark)
   "Mode for composing annotations for a bookmark.
+Wants BUF POINT PARG and BOOKMARK.
 When you have finished composing, type \\[bookmark-send-annotation] to send
 the annotation.
 
 When you have finished composing, type \\[bookmark-send-annotation] to send
 the annotation.
 
@@ -861,8 +926,8 @@ as the new annotation for a bookmark."
 
 
 (defun bookmark-insert-current-bookmark ()
 
 
 (defun bookmark-insert-current-bookmark ()
-  ;; insert this buffer's value of bookmark-current-bookmark, default
-  ;; to file name if it's nil.
+  "Insert this buffer's value of bookmark-current-bookmark, default
+to file name if it's nil."
   (interactive)
   (let ((str
         (save-excursion
   (interactive)
   (let ((str
         (save-excursion
@@ -872,8 +937,8 @@ as the new annotation for a bookmark."
 
 
 (defun bookmark-insert-buffer-name ()
 
 
 (defun bookmark-insert-buffer-name ()
-  ;; insert the name (sans path) of the current file into the bookmark
-  ;; name that is being set.
+  "Insert the name (sans path) of the current file into the bookmark
+name that is being set."
   (interactive)
   (let ((str
          (save-excursion
   (interactive)
   (let ((str
          (save-excursion
@@ -913,7 +978,7 @@ In Info, return the current node."
   (let ((string (save-excursion
                     (set-buffer bookmark-current-buffer)
                     (goto-char bookmark-yank-point)
   (let ((string (save-excursion
                     (set-buffer bookmark-current-buffer)
                     (goto-char bookmark-yank-point)
-                    (buffer-substring
+                    (buffer-substring-no-properties
                      (point)
                      (save-excursion
                        (forward-word 1)
                      (point)
                      (save-excursion
                        (forward-word 1)
@@ -966,7 +1031,7 @@ For example, if this is a Info buffer, return the Info file's name."
 
 
 ;;;###autoload
 
 
 ;;;###autoload
-(defun bookmark-jump (str)
+(defun bookmark-jump (bookmark)
   "Jump to bookmark BOOKMARK (a point in some file).  
 You may have a problem using this function if the value of variable
 `bookmark-alist' is nil.  If that happens, you need to load in some
   "Jump to bookmark BOOKMARK (a point in some file).  
 You may have a problem using this function if the value of variable
 `bookmark-alist' is nil.  If that happens, you need to load in some
@@ -979,15 +1044,15 @@ will then jump to the new location, as well as recording it in place
 of the old one in the permanent bookmark record."
   (interactive
    (bookmark-completing-read "Jump to bookmark" bookmark-current-bookmark))
 of the old one in the permanent bookmark record."
   (interactive
    (bookmark-completing-read "Jump to bookmark" bookmark-current-bookmark))
-  (bookmark-maybe-historicize-string str)
-  (let ((cell (bookmark-jump-noselect str)))
+  (bookmark-maybe-historicize-string bookmark)
+  (let ((cell (bookmark-jump-noselect bookmark)))
     (and cell
          (switch-to-buffer (car cell))
          (goto-char (cdr cell))
         (if bookmark-automatically-show-annotations
              ;; if there is an annotation for this bookmark,
              ;; show it in a buffer.
     (and cell
          (switch-to-buffer (car cell))
          (goto-char (cdr cell))
         (if bookmark-automatically-show-annotations
              ;; if there is an annotation for this bookmark,
              ;; show it in a buffer.
-             (bookmark-show-annotation str)))))
+             (bookmark-show-annotation bookmark)))))
 
 
 (defun bookmark-jump-noselect (str)
 
 
 (defun bookmark-jump-noselect (str)
@@ -1058,50 +1123,50 @@ of the old one in the permanent bookmark record."
 
 
 ;;;###autoload
 
 
 ;;;###autoload
-(defun bookmark-relocate (str)
+(defun bookmark-relocate (bookmark)
   "Relocate BOOKMARK -- prompts for a filename, and makes an already
 existing bookmark point to that file, instead of the one it used to
 point at.  Useful when a file has been renamed after a bookmark was
 set in it."
   (interactive (bookmark-completing-read "Bookmark to relocate"))
   "Relocate BOOKMARK -- prompts for a filename, and makes an already
 existing bookmark point to that file, instead of the one it used to
 point at.  Useful when a file has been renamed after a bookmark was
 set in it."
   (interactive (bookmark-completing-read "Bookmark to relocate"))
-  (bookmark-maybe-historicize-string str)
+  (bookmark-maybe-historicize-string bookmark)
   (bookmark-maybe-load-default-file)
   (bookmark-maybe-load-default-file)
-  (let* ((bmrk-filename (bookmark-get-filename str))
+  (let* ((bmrk-filename (bookmark-get-filename bookmark))
          (newloc (expand-file-name
                   (read-file-name
          (newloc (expand-file-name
                   (read-file-name
-                   (format "Relocate %s to: " str)
+                   (format "Relocate %s to: " bookmark)
                    (file-name-directory bmrk-filename)))))
                    (file-name-directory bmrk-filename)))))
-    (bookmark-set-filename str newloc)))
+    (bookmark-set-filename bookmark newloc)))
 
 
 ;;;###autoload
 
 
 ;;;###autoload
-(defun bookmark-insert-location (str &optional no-history)
+(defun bookmark-insert-location (bookmark &optional no-history)
   "Insert the name of the file associated with BOOKMARK.
 Optional second arg NO-HISTORY means don't record this in the
 minibuffer history list `bookmark-history'."
   (interactive (bookmark-completing-read "Insert bookmark location"))
   "Insert the name of the file associated with BOOKMARK.
 Optional second arg NO-HISTORY means don't record this in the
 minibuffer history list `bookmark-history'."
   (interactive (bookmark-completing-read "Insert bookmark location"))
-  (or no-history (bookmark-maybe-historicize-string str))
-  (insert (bookmark-location str)))
+  (or no-history (bookmark-maybe-historicize-string bookmark))
+  (insert (bookmark-location bookmark)))
 
 
 
 
-(defun bookmark-location (str)
+(defun bookmark-location (bookmark)
   "Return the name of the file associated with BOOKMARK."
   (bookmark-maybe-load-default-file)
   "Return the name of the file associated with BOOKMARK."
   (bookmark-maybe-load-default-file)
-  (bookmark-get-filename str))
+  (bookmark-get-filename bookmark))
 
 
 ;;;###autoload
 (defun bookmark-rename (old &optional new)
 
 
 ;;;###autoload
 (defun bookmark-rename (old &optional new)
-  "Change the name of OLD-BOOKMARK to NEWNAME.  
-If called from keyboard, prompts for OLD-BOOKMARK and NEWNAME.
-If called from menubar, OLD-BOOKMARK is selected from a menu, and
-prompts for NEWNAME. 
-If called from Lisp, prompts for NEWNAME if only OLD-BOOKMARK was
-passed as an argument.  If called with two strings, then no prompting
-is done.  You must pass at least OLD-BOOKMARK when calling from Lisp.
+  "Change the name of OLD bookmark to NEW name.  If called from
+keyboard, prompts for OLD and NEW.  If called from menubar, OLD is
+selected from a menu, and prompts for NEW.
+
+If called from Lisp, prompts for NEW if only OLD was passed as an
+argument.  If called with two strings, then no prompting is done.  You
+must pass at least OLD when calling from Lisp.
 
 While you are entering the new name, consecutive C-w's insert
 
 While you are entering the new name, consecutive C-w's insert
-consectutive words from the text of the buffer into the new bookmark
+consecutive words from the text of the buffer into the new bookmark
 name."
   (interactive (bookmark-completing-read "Old bookmark name"))
   (bookmark-maybe-historicize-string old)
 name."
   (interactive (bookmark-completing-read "Old bookmark name"))
   (bookmark-maybe-historicize-string old)
@@ -1131,19 +1196,19 @@ name."
 
 
 ;;;###autoload
 
 
 ;;;###autoload
-(defun bookmark-insert (str)
+(defun bookmark-insert (bookmark)
   "Insert the text of the file pointed to by bookmark BOOKMARK.  
 You may have a problem using this function if the value of variable
 `bookmark-alist' is nil.  If that happens, you need to load in some
 bookmarks.  See help on function `bookmark-load' for more about
 this."
   (interactive (bookmark-completing-read "Insert bookmark contents"))
   "Insert the text of the file pointed to by bookmark BOOKMARK.  
 You may have a problem using this function if the value of variable
 `bookmark-alist' is nil.  If that happens, you need to load in some
 bookmarks.  See help on function `bookmark-load' for more about
 this."
   (interactive (bookmark-completing-read "Insert bookmark contents"))
-  (bookmark-maybe-historicize-string str)
+  (bookmark-maybe-historicize-string bookmark)
   (bookmark-maybe-load-default-file)
   (let ((orig-point (point))
         (str-to-insert
          (save-excursion
   (bookmark-maybe-load-default-file)
   (let ((orig-point (point))
         (str-to-insert
          (save-excursion
-           (set-buffer (car (bookmark-jump-noselect str)))
+           (set-buffer (car (bookmark-jump-noselect bookmark)))
            (buffer-substring (point-min) (point-max)))))
     (insert str-to-insert)
     (push-mark)
            (buffer-substring (point-min) (point-max)))))
     (insert str-to-insert)
     (push-mark)
@@ -1166,7 +1231,7 @@ probably because we were called from there."
   (let ((will-go (bookmark-get-bookmark bookmark)))
     (setq bookmark-alist (delq will-go bookmark-alist))
     ;; Added by db, nil bookmark-current-bookmark if the last
   (let ((will-go (bookmark-get-bookmark bookmark)))
     (setq bookmark-alist (delq will-go bookmark-alist))
     ;; Added by db, nil bookmark-current-bookmark if the last
-    ;; occurence has been deleted
+    ;; occurrence has been deleted
     (or (bookmark-get-bookmark bookmark-current-bookmark)
         (setq bookmark-current-bookmark nil)))
   ;; Don't rebuild the list
     (or (bookmark-get-bookmark bookmark-current-bookmark)
         (setq bookmark-current-bookmark nil)))
   ;; Don't rebuild the list
@@ -1209,7 +1274,8 @@ instead."
 (defun bookmark-save (&optional parg file) 
   "Save currently defined bookmarks.
 Saves by default in the file defined by the variable
 (defun bookmark-save (&optional parg file) 
   "Save currently defined bookmarks.
 Saves by default in the file defined by the variable
-`bookmark-default-file'.  With a prefix arg, save it in file FILE.
+`bookmark-default-file'.  With a prefix arg, save it in file FILE
+\(second argument\).
 
 If you are calling this from Lisp, the two arguments are PREFIX-ARG
 and FILE, and if you just want it to write to the default file, then
 
 If you are calling this from Lisp, the two arguments are PREFIX-ARG
 and FILE, and if you just want it to write to the default file, then
@@ -1264,7 +1330,7 @@ for a file, defaulting to the file defined by variable
         (write-file file)
         (kill-buffer (current-buffer))
         (if (>= baud-rate 9600)
         (write-file file)
         (kill-buffer (current-buffer))
         (if (>= baud-rate 9600)
-            (message (format "Saving bookmarks to file %s... done." file)))
+            (message (format "Saving bookmarks to file %s...done" file)))
         ))))
 
 
         ))))
 
 
@@ -1313,7 +1379,7 @@ explicitly."
               (error (format "Invalid bookmark list in %s." file))))
           (kill-buffer (current-buffer)))
        (if (and (null no-msg) (>= baud-rate 9600))
               (error (format "Invalid bookmark list in %s." file))))
           (kill-buffer (current-buffer)))
        (if (and (null no-msg) (>= baud-rate 9600))
-            (message (format "Loading bookmarks from %s... done" file))))
+            (message (format "Loading bookmarks from %s...done" file))))
     (error (format "Cannot read bookmark file %s." file))))
 
 
     (error (format "Cannot read bookmark file %s." file))))
 
 
@@ -1328,19 +1394,6 @@ explicitly."
 (defvar bookmark-bmenu-hidden-bookmarks ())
 
 
 (defvar bookmark-bmenu-hidden-bookmarks ())
 
 
-(defvar bookmark-bmenu-file-column 30
-  "*Column at which to display filenames in a buffer listing bookmarks.
-You can toggle whether files are shown with \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-toggle-filenames].")
-
-
-(defvar bookmark-bmenu-toggle-filenames t
-  "*Non-nil means show filenames when listing bookmarks.
-This may result in truncated bookmark names.  To disable this, put the
-following in your .emacs:
-
-\(setq bookmark-bmenu-toggle-filenames nil\)")
-
-
 (defvar bookmark-bmenu-mode-map nil)
 
 
 (defvar bookmark-bmenu-mode-map nil)
 
 
@@ -1361,7 +1414,6 @@ following in your .emacs:
   (define-key bookmark-bmenu-mode-map "k" 'bookmark-bmenu-delete)
   (define-key bookmark-bmenu-mode-map "\C-d" 'bookmark-bmenu-delete-backwards)
   (define-key bookmark-bmenu-mode-map "x" 'bookmark-bmenu-execute-deletions)
   (define-key bookmark-bmenu-mode-map "k" 'bookmark-bmenu-delete)
   (define-key bookmark-bmenu-mode-map "\C-d" 'bookmark-bmenu-delete-backwards)
   (define-key bookmark-bmenu-mode-map "x" 'bookmark-bmenu-execute-deletions)
-  (define-key bookmark-bmenu-mode-map "\C-k" 'bookmark-bmenu-delete)
   (define-key bookmark-bmenu-mode-map "d" 'bookmark-bmenu-delete)
   (define-key bookmark-bmenu-mode-map " " 'next-line)
   (define-key bookmark-bmenu-mode-map "n" 'next-line)
   (define-key bookmark-bmenu-mode-map "d" 'bookmark-bmenu-delete)
   (define-key bookmark-bmenu-mode-map " " 'next-line)
   (define-key bookmark-bmenu-mode-map "n" 'next-line)
@@ -1418,7 +1470,7 @@ deletion, or > if it is flagged for displaying."
     (bookmark-maybe-sort-alist)
     (mapcar
      (lambda (full-record)
     (bookmark-maybe-sort-alist)
     (mapcar
      (lambda (full-record)
-       ;; if a bookmark has an annotation, preceed it with a "*"
+       ;; if a bookmark has an annotation, prepend a "*"
        ;; in the list of bookmarks.
        (let ((annotation (bookmark-get-annotation
                           (bookmark-name-from-full-record full-record))))
        ;; in the list of bookmarks.
        (let ((annotation (bookmark-get-annotation
                           (bookmark-name-from-full-record full-record))))
@@ -1445,7 +1497,7 @@ deletion, or > if it is flagged for displaying."
   "Major mode for editing a list of bookmarks.
 Each line describes one of the bookmarks in Emacs.
 Letters do not insert themselves; instead, they are commands.
   "Major mode for editing a list of bookmarks.
 Each line describes one of the bookmarks in Emacs.
 Letters do not insert themselves; instead, they are commands.
-Bookmark names preceeded by a \"*\" have annotations.
+Bookmark names preceded by a \"*\" have annotations.
 \\<bookmark-bmenu-mode-map>
 \\[bookmark-bmenu-mark] -- mark bookmark to be displayed.
 \\[bookmark-bmenu-select] -- select bookmark of line point is on.
 \\<bookmark-bmenu-mode-map>
 \\[bookmark-bmenu-mark] -- mark bookmark to be displayed.
 \\[bookmark-bmenu-select] -- select bookmark of line point is on.
@@ -1462,7 +1514,7 @@ Bookmark names preceeded by a \"*\" have annotations.
 \\[bookmark-bmenu-rename] -- rename this bookmark \(prompts for new name\).   
 \\[bookmark-bmenu-delete] -- mark this bookmark to be deleted, and move down.
 \\[bookmark-bmenu-delete-backwards] -- mark this bookmark to be deleted, and move up. 
 \\[bookmark-bmenu-rename] -- rename this bookmark \(prompts for new name\).   
 \\[bookmark-bmenu-delete] -- mark this bookmark to be deleted, and move down.
 \\[bookmark-bmenu-delete-backwards] -- mark this bookmark to be deleted, and move up. 
-\\[bookmark-bmenu-execute-deletions] -- delete marked bookmarks.
+\\[bookmark-bmenu-execute-deletions] -- delete bookmarks marked with `\\[bookmark-bmenu-delete]'.
 \\[bookmark-bmenu-save] -- save the current bookmark list in the default file.
   With a prefix arg, prompts for a file to save in.
 \\[bookmark-bmenu-load] -- load in a file of bookmarks (prompts for file.)
 \\[bookmark-bmenu-save] -- save the current bookmark list in the default file.
   With a prefix arg, prompts for a file to save in.
 \\[bookmark-bmenu-load] -- load in a file of bookmarks (prompts for file.)
@@ -1482,12 +1534,12 @@ Bookmark names preceeded by a \"*\" have annotations.
   (run-hooks 'bookmark-bmenu-mode-hook))
 
 
   (run-hooks 'bookmark-bmenu-mode-hook))
 
 
-(defun bookmark-bmenu-toggle-filenames (&optional parg)
+(defun bookmark-bmenu-toggle-filenames (&optional show)
   "Toggle whether filenames are shown in the bookmark list.
 Optional argument SHOW means show them unconditionally."
   (interactive)
   (cond
   "Toggle whether filenames are shown in the bookmark list.
 Optional argument SHOW means show them unconditionally."
   (interactive)
   (cond
-   (parg
+   (show
     (setq bookmark-bmenu-toggle-filenames nil)
     (bookmark-bmenu-show-filenames)
     (setq bookmark-bmenu-toggle-filenames t))
     (setq bookmark-bmenu-toggle-filenames nil)
     (bookmark-bmenu-show-filenames)
     (setq bookmark-bmenu-toggle-filenames t))
@@ -1656,20 +1708,19 @@ You can mark bookmarks with the \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-mar
             (delete-char -1)
             (insert ?\ ))
           (or (string-equal tem bmrk) 
             (delete-char -1)
             (insert ?\ ))
           (or (string-equal tem bmrk) 
-              (memq tem others) 
+              (member tem others) 
               (setq others (cons tem others))))
         (setq others (nreverse others)
               tem (/ (1- (frame-height)) (1+ (length others))))
         (delete-other-windows)
         (bookmark-jump bmrk)
         (bury-buffer menu)
               (setq others (cons tem others))))
         (setq others (nreverse others)
               tem (/ (1- (frame-height)) (1+ (length others))))
         (delete-other-windows)
         (bookmark-jump bmrk)
         (bury-buffer menu)
-        (if (equal (length others) 0)
-            nil
-          (while others
-            (split-window nil tem)
-            (other-window 1)
-            (bookmark-jump (car others))
-            (setq others (cdr others)))
+        (if others
+            (while others
+              (split-window nil tem)
+              (other-window 1)
+              (bookmark-jump (car others))
+              (setq others (cdr others)))
           (other-window 1)))))
 
 
           (other-window 1)))))
 
 
@@ -1791,7 +1842,7 @@ The current window remains selected."
 
 (defun bookmark-bmenu-unmark (&optional backup)
   "Cancel all requested operations on bookmark on this line and move down.
 
 (defun bookmark-bmenu-unmark (&optional backup)
   "Cancel all requested operations on bookmark on this line and move down.
-Optional ARG means move up."
+Optional BACKUP means move up."
   (interactive "P")
   (beginning-of-line)
   (if (bookmark-bmenu-check-position)
   (interactive "P")
   (beginning-of-line)
   (if (bookmark-bmenu-check-position)
@@ -1839,6 +1890,7 @@ and then move up one line"
 (defun bookmark-bmenu-execute-deletions ()
   "Delete bookmarks marked with \\<Buffer-menu-mode-map>\\[Buffer-menu-delete] commands."
   (interactive)
 (defun bookmark-bmenu-execute-deletions ()
   "Delete bookmarks marked with \\<Buffer-menu-mode-map>\\[Buffer-menu-delete] commands."
   (interactive)
+  (message "Deleting bookmarks...")
   (let ((hide-em bookmark-bmenu-toggle-filenames)
         (o-point  (point))
         (o-str    (save-excursion
   (let ((hide-em bookmark-bmenu-toggle-filenames)
         (o-point  (point))
         (o-str    (save-excursion
@@ -1870,7 +1922,9 @@ and then move up one line"
     (setq bookmark-alist-modification-count
           (1+ bookmark-alist-modification-count))
     (if (bookmark-time-to-save-p)
     (setq bookmark-alist-modification-count
           (1+ bookmark-alist-modification-count))
     (if (bookmark-time-to-save-p)
-        (bookmark-save))))
+        (bookmark-save))
+    (message "Deleting bookmarks...done")
+    ))
 
 
 (defun bookmark-bmenu-rename ()
 
 
 (defun bookmark-bmenu-rename ()
@@ -1895,10 +1949,6 @@ and then move up one line"
 \f
 ;;; Menu bar stuff.  Prefix is "bookmark-menu".
 
 \f
 ;;; Menu bar stuff.  Prefix is "bookmark-menu".
 
-(defvar bookmark-menu-length 70
-  "*Maximum length of a bookmark name displayed on a popup menu.")
-
-
 (defun bookmark-menu-build-paned-menu (name entries)
   "Build a multi-paned menu named NAME from the strings in ENTRIES.
 That is, ENTRIES is a list of strings which appear as the choices
 (defun bookmark-menu-build-paned-menu (name entries)
   "Build a multi-paned menu named NAME from the strings in ENTRIES.
 That is, ENTRIES is a list of strings which appear as the choices
@@ -1937,6 +1987,33 @@ strings returned are not."
     (cons (concat "-*- " name " -*-") pane-list)))
 
 
     (cons (concat "-*- " name " -*-") pane-list)))
 
 
+(defun bookmark-build-xemacs-menu (name entries function)
+  "Build a menu named NAME from the strings in ENTRIES.
+That is, ENTRIES is a list of strings that appear as the choices
+in the menu.
+The visible entries are truncated to `bookmark-menu-length', but the
+strings returned are not."
+  (let* (lst 
+        (pane-list
+         (progn
+           (while entries
+             (let ((str (car entries)))
+               (setq lst (cons
+                          (vector
+                           (if (> (length str) bookmark-menu-length)
+                               (substring str 0 bookmark-menu-length)
+                             str)
+                           (list function str)
+                           t)
+                          lst))
+               (setq entries (cdr entries))))
+           (nreverse lst))))
+
+    ;; Return the menu:
+    (append (if popup-menu-titles (list (concat "-*- " name " -*-")))
+           pane-list)))
+
+
 (defun bookmark-menu-popup-paned-menu (event name entries)
   "Pop up multi-paned menu at EVENT, return string chosen from ENTRIES.
 That is, ENTRIES is a list of strings which appear as the choices
 (defun bookmark-menu-popup-paned-menu (event name entries)
   "Pop up multi-paned menu at EVENT, return string chosen from ENTRIES.
 That is, ENTRIES is a list of strings which appear as the choices
@@ -1967,7 +2044,11 @@ The number of panes depends on the number of bookmarks."
 You may have a problem using this function if the value of variable
 `bookmark-alist' is nil.  If that happens, you need to load in some
 bookmarks.  See help on function `bookmark-load' for more about
 You may have a problem using this function if the value of variable
 `bookmark-alist' is nil.  If that happens, you need to load in some
 bookmarks.  See help on function `bookmark-load' for more about
-this."
+this.
+
+Warning: this function only takes an EVENT as argument.  Use the
+corresponding bookmark function from Lisp \(the one without the
+\"-menu-\" in its name\)."
   (interactive "e")
   (bookmark-popup-menu-and-apply-function
    'bookmark-insert "Insert Bookmark Contents" event))
   (interactive "e")
   (bookmark-popup-menu-and-apply-function
    'bookmark-insert "Insert Bookmark Contents" event))
@@ -1979,7 +2060,11 @@ this."
 You may have a problem using this function if the value of variable
 `bookmark-alist' is nil.  If that happens, you need to load in some
 bookmarks.  See help on function `bookmark-load' for more about
 You may have a problem using this function if the value of variable
 `bookmark-alist' is nil.  If that happens, you need to load in some
 bookmarks.  See help on function `bookmark-load' for more about
-this."
+this.
+
+Warning: this function only takes an EVENT as argument.  Use the
+corresponding bookmark function from Lisp \(the one without the
+\"-menu-\" in its name\)."
   (interactive "e")
   (bookmark-popup-menu-and-apply-function
    'bookmark-jump "Jump to Bookmark" event))
   (interactive "e")
   (bookmark-popup-menu-and-apply-function
    'bookmark-jump "Jump to Bookmark" event))
@@ -1988,7 +2073,11 @@ this."
 ;;;###autoload
 (defun bookmark-menu-locate (event)
   "Insert the name of the file associated with BOOKMARK. 
 ;;;###autoload
 (defun bookmark-menu-locate (event)
   "Insert the name of the file associated with BOOKMARK. 
-\(This is not the same as the contents of that file\)."
+\(This is not the same as the contents of that file\).
+
+Warning: this function only takes an EVENT as argument.  Use the
+corresponding bookmark function from Lisp \(the one without the
+\"-menu-\" in its name\)."
   (interactive "e")
   (bookmark-popup-menu-and-apply-function
    'bookmark-insert-location "Insert Bookmark Location" event))
   (interactive "e")
   (bookmark-popup-menu-and-apply-function
    'bookmark-insert-location "Insert Bookmark Location" event))
@@ -2005,8 +2094,12 @@ passed as an argument.  If called with two strings, then no prompting
 is done.  You must pass at least OLD-BOOKMARK when calling from Lisp.
 
 While you are entering the new name, consecutive C-w's insert
 is done.  You must pass at least OLD-BOOKMARK when calling from Lisp.
 
 While you are entering the new name, consecutive C-w's insert
-consectutive words from the text of the buffer into the new bookmark
-name."
+consecutive words from the text of the buffer into the new bookmark
+name.
+
+Warning: this function only takes an EVENT as argument.  Use the
+corresponding bookmark function from Lisp \(the one without the
+\"-menu-\" in its name\)."
   (interactive "e")
   (bookmark-popup-menu-and-apply-function
    'bookmark-rename "Rename Bookmark" event))
   (interactive "e")
   (bookmark-popup-menu-and-apply-function
    'bookmark-rename "Rename Bookmark" event))
@@ -2018,7 +2111,11 @@ name."
 Removes only the first instance of a bookmark with that name.  If
 there are one or more other bookmarks with the same name, they will
 not be deleted.  Defaults to the \"current\" bookmark \(that is, the
 Removes only the first instance of a bookmark with that name.  If
 there are one or more other bookmarks with the same name, they will
 not be deleted.  Defaults to the \"current\" bookmark \(that is, the
-one most recently used in this file, if any\)."
+one most recently used in this file, if any\).
+
+Warning: this function only takes an EVENT as argument.  Use the
+corresponding bookmark function from Lisp \(the one without the
+\"-menu-\" in its name\)."
   (interactive "e")
   (bookmark-popup-menu-and-apply-function
    'bookmark-delete "Delete Bookmark" event))
   (interactive "e")
   (bookmark-popup-menu-and-apply-function
    'bookmark-delete "Delete Bookmark" event))
@@ -2030,23 +2127,34 @@ one most recently used in this file, if any\)."
 ;; We MUST autoload EACH form used to set up this variable's value, so
 ;; that the whole job is done in loaddefs.el.
 
 ;; We MUST autoload EACH form used to set up this variable's value, so
 ;; that the whole job is done in loaddefs.el.
 
+;; FSF Emacs menubar stuff
+;; The odd conditional structure is due to the limitations of autoload
+;; cookies.
+
 ;;;###autoload
 (defvar menu-bar-bookmark-map (make-sparse-keymap "Bookmark functions"))
 ;;;###autoload
 (defvar menu-bar-bookmark-map (make-sparse-keymap "Bookmark functions"))
+
 ;;;###autoload
 ;;;###autoload
-(fset 'menu-bar-bookmark-map (symbol-value 'menu-bar-bookmark-map))
+(defalias 'menu-bar-bookmark-map (symbol-value 'menu-bar-bookmark-map))
+
+;; 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
 (define-key menu-bar-bookmark-map [load]
 
 ;;;###autoload
 (define-key menu-bar-bookmark-map [load]
-  '("Load a bookmark file" . bookmark-load))
+  '("Load a Bookmark File..." . bookmark-load))
 
 ;;;###autoload
 (define-key menu-bar-bookmark-map [write]
 
 ;;;###autoload
 (define-key menu-bar-bookmark-map [write]
-  '("Write \(to another file\)" . bookmark-write))
+  '("Save Bookmarks As..." . bookmark-write))
 
 ;;;###autoload
 (define-key menu-bar-bookmark-map [save]
 
 ;;;###autoload
 (define-key menu-bar-bookmark-map [save]
-  '("Save  \(in default file\)" . bookmark-save))
+  '("Save Bookmarks" . bookmark-save))
 
 ;;;###autoload
 (define-key menu-bar-bookmark-map [edit]
 
 ;;;###autoload
 (define-key menu-bar-bookmark-map [edit]
@@ -2054,27 +2162,27 @@ one most recently used in this file, if any\)."
 
 ;;;###autoload
 (define-key menu-bar-bookmark-map [delete]
 
 ;;;###autoload
 (define-key menu-bar-bookmark-map [delete]
-  '("Delete bookmark" . bookmark-menu-delete))
+  '("Delete Bookmark" . bookmark-menu-delete))
 
 ;;;###autoload
 (define-key menu-bar-bookmark-map [rename]
 
 ;;;###autoload
 (define-key menu-bar-bookmark-map [rename]
-  '("Rename bookmark" . bookmark-menu-rename))
+  '("Rename Bookmark" . bookmark-menu-rename))
 
 ;;;###autoload
 (define-key menu-bar-bookmark-map [locate]
 
 ;;;###autoload
 (define-key menu-bar-bookmark-map [locate]
-  '("Insert location" . bookmark-menu-locate))
+  '("Insert Location" . bookmark-menu-locate))
 
 ;;;###autoload
 (define-key menu-bar-bookmark-map [insert]
 
 ;;;###autoload
 (define-key menu-bar-bookmark-map [insert]
-  '("Insert contents" . bookmark-menu-insert))
+  '("Insert Contents" . bookmark-menu-insert))
 
 ;;;###autoload
 (define-key menu-bar-bookmark-map [set]
 
 ;;;###autoload
 (define-key menu-bar-bookmark-map [set]
-  '("Set bookmark" . bookmark-set))
+  '("Set Bookmark" . bookmark-set))
 
 ;;;###autoload
 (define-key menu-bar-bookmark-map [jump] 
 
 ;;;###autoload
 (define-key menu-bar-bookmark-map [jump] 
-  '("Jump to bookmark" . bookmark-menu-jump))
+  '("Jump to Bookmark" . bookmark-menu-jump))
 
 ;;;; end bookmark menu stuff ;;;;
 
 
 ;;;; end bookmark menu stuff ;;;;