##Merge of all patches applied from revision 0 ## Initial-patch: New definition of bookmark-bmenu-bookmark by string comparison.(no need to toggle filenames every time). ## patch-r2: Set bookmarkp-latest-sorted-alist to bookmark-alist value when not sorting. ## diff --git a/bookmark.el b/bookmark.el --- a/bookmark.el +++ b/bookmark.el @@ -922,14 +922,15 @@ (setq bookmarks-already-loaded t))) +(defvar bookmarkp-latest-sorted-alist nil) (defun bookmark-maybe-sort-alist () ;;Return the bookmark-alist for display. If the bookmark-sort-flag ;;is non-nil, then return a sorted copy of the alist. - (if bookmark-sort-flag - (sort (copy-alist bookmark-alist) - (function - (lambda (x y) (string-lessp (car x) (car y))))) - bookmark-alist)) + (let ((bmk-alist (copy-alist bookmark-alist))) + (if bookmark-sort-flag + (setq bookmarkp-latest-sorted-alist + (sort bmk-alist #'(lambda (x y) (string-lessp (car x) (car y))))) + (setq bookmarkp-latest-sorted-alist bookmark-alist)))) (defvar bookmark-after-jump-hook nil @@ -1670,28 +1671,9 @@ (defun bookmark-bmenu-bookmark () - ;; return a string which is bookmark of this line. - (if (bookmark-bmenu-check-position) - (save-excursion - (save-window-excursion - (goto-char (point-min)) - (search-forward "Bookmark") - (backward-word 1) - (setq bookmark-bmenu-bookmark-column (current-column))))) - (if bookmark-bmenu-toggle-filenames - (bookmark-bmenu-hide-filenames)) - (save-excursion - (save-window-excursion - (beginning-of-line) - (forward-char bookmark-bmenu-bookmark-column) - (prog1 - (buffer-substring-no-properties (point) - (progn - (end-of-line) - (point))) - ;; well, this is certainly crystal-clear: - (if bookmark-bmenu-toggle-filenames - (bookmark-bmenu-toggle-filenames t)))))) + "Return a string which is bookmark of this line." + (let ((pos (- (line-number-at-pos) 3))) + (car (nth pos bookmarkp-latest-sorted-alist)))) (defun bookmark-show-annotation (bookmark) @@ -1936,8 +1918,7 @@ "Delete bookmarks marked with \\\\[Buffer-menu-delete] commands." (interactive) (message "Deleting bookmarks...") - (let ((hide-em bookmark-bmenu-toggle-filenames) - (o-point (point)) + (let ((o-point (point)) (o-str (save-excursion (beginning-of-line) (if (looking-at "^D") @@ -1946,16 +1927,11 @@ (point) (progn (end-of-line) (point)))))) (o-col (current-column))) - (if hide-em (bookmark-bmenu-hide-filenames)) - (setq bookmark-bmenu-toggle-filenames nil) (goto-char (point-min)) (forward-line 1) (while (re-search-forward "^D" (point-max) t) (bookmark-delete (bookmark-bmenu-bookmark) t)) ; pass BATCH arg (bookmark-bmenu-list) - (setq bookmark-bmenu-toggle-filenames hide-em) - (if bookmark-bmenu-toggle-filenames - (bookmark-bmenu-toggle-filenames t)) (if o-str (progn (goto-char (point-min))