-The number of panes depends on the number of entries."
- (interactive "e")
- (x-popup-menu event (bookmark-menu-build-paned-menu name entries)))
-
-
-(defun bookmark-menu-popup-paned-bookmark-menu (event name)
- "Pop up menu of bookmarks, return chosen bookmark.
-Pop up at EVENT, menu's name is NAME.
-The number of panes depends on the number of bookmarks."
- (bookmark-menu-popup-paned-menu event name (bookmark-all-names)))
-
-
-(defun bookmark-popup-menu-and-apply-function (func-sym menu-label event)
- ;; help function for making menus that need to apply a bookmark
- ;; function to a string.
- (let* ((choice (bookmark-menu-popup-paned-bookmark-menu
- event menu-label)))
- (if choice (apply func-sym (list choice)))))
-
-
-;;;###autoload
-(defun bookmark-menu-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
-`bookmark-alist' is nil. If that happens, you need to load in some
-bookmarks. See help on function `bookmark-load' for more about
-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))
-
-
-;;;###autoload
-(defun bookmark-menu-jump (event)
- "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
-bookmarks. See help on function `bookmark-load' for more about
-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))
-
-
-;;;###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\).
-
-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))
-
-
-;;;###autoload
-(defun bookmark-menu-rename (event)
- "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.
-
-While you are entering the new name, consecutive C-w's insert
-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))
-
-
-;;;###autoload
-(defun bookmark-menu-delete (event)
- "Delete the bookmark named NAME from the bookmark list.
-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\).
-
-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))
+The number of panes depends on the number of entries.
+The visible entries are truncated to `bookmark-menu-length', but the
+strings returned are not."
+ (let ((f-height (/ (frame-height) 2))
+ (pane-list nil)
+ (iter 0))
+ (while entries
+ (let (lst
+ (count 0))
+ (while (and (< count f-height) entries)
+ (let ((str (car entries)))
+ (push (cons
+ (if (> (length str) bookmark-menu-length)
+ (substring str 0 bookmark-menu-length)
+ str)
+ str)
+ lst)
+ (setq entries (cdr entries))
+ (setq count (1+ count))))
+ (setq iter (1+ iter))
+ (push (cons
+ (format "-*- %s (%d) -*-" name iter)
+ (nreverse lst))
+ pane-list)))
+
+ ;; Popup the menu and return the string.
+ (x-popup-menu event (cons (concat "-*- " name " -*-")
+ (nreverse pane-list)))))