comparison lisp/bookmark.el @ 81910:fbf992fc2463

(bookmark-maybe-sort-alist): Don't modify bookmark-alist. Instead, if not sorting, simply return it. (bookmark-bmenu-list): Call bookmark-maybe-sort-alist for its return value, not for its side effect.
author Thien-Thi Nguyen <ttn@gnuvola.org>
date Mon, 16 Jul 2007 16:57:45 +0000
parents f10b72da2fb4
children b98604865ea0 a1be62cbd32a
comparison
equal deleted inserted replaced
81909:bf55b9b62e57 81910:fbf992fc2463
1043 1043
1044 (defun bookmark-maybe-sort-alist () 1044 (defun bookmark-maybe-sort-alist ()
1045 ;;Return the bookmark-alist for display. If the bookmark-sort-flag 1045 ;;Return the bookmark-alist for display. If the bookmark-sort-flag
1046 ;;is non-nil, then return a sorted copy of the alist. 1046 ;;is non-nil, then return a sorted copy of the alist.
1047 (if bookmark-sort-flag 1047 (if bookmark-sort-flag
1048 (setq bookmark-alist 1048 (sort (copy-alist bookmark-alist)
1049 (sort (copy-alist bookmark-alist) 1049 (function
1050 (function 1050 (lambda (x y) (string-lessp (car x) (car y)))))
1051 (lambda (x y) (string-lessp (car x) (car y)))))))) 1051 bookmark-alist))
1052 1052
1053 1053
1054 (defvar bookmark-after-jump-hook nil 1054 (defvar bookmark-after-jump-hook nil
1055 "Hook run after `bookmark-jump' jumps to a bookmark. 1055 "Hook run after `bookmark-jump' jumps to a bookmark.
1056 Useful for example to unhide text in `outline-mode'.") 1056 Useful for example to unhide text in `outline-mode'.")
1588 (let ((inhibit-read-only t)) 1588 (let ((inhibit-read-only t))
1589 (erase-buffer) 1589 (erase-buffer)
1590 (insert "% Bookmark\n- --------\n") 1590 (insert "% Bookmark\n- --------\n")
1591 (add-text-properties (point-min) (point) 1591 (add-text-properties (point-min) (point)
1592 '(font-lock-face bookmark-menu-heading)) 1592 '(font-lock-face bookmark-menu-heading))
1593 (bookmark-maybe-sort-alist)
1594 (mapcar 1593 (mapcar
1595 (lambda (full-record) 1594 (lambda (full-record)
1596 ;; if a bookmark has an annotation, prepend a "*" 1595 ;; if a bookmark has an annotation, prepend a "*"
1597 ;; in the list of bookmarks. 1596 ;; in the list of bookmarks.
1598 (let ((annotation (bookmark-get-annotation 1597 (let ((annotation (bookmark-get-annotation
1611 '(mouse-face highlight 1610 '(mouse-face highlight
1612 follow-link t 1611 follow-link t
1613 help-echo "mouse-2: go to this bookmark in other window"))) 1612 help-echo "mouse-2: go to this bookmark in other window")))
1614 (insert "\n") 1613 (insert "\n")
1615 ))) 1614 )))
1616 bookmark-alist)) 1615 (bookmark-maybe-sort-alist)))
1617 (goto-char (point-min)) 1616 (goto-char (point-min))
1618 (forward-line 2) 1617 (forward-line 2)
1619 (bookmark-bmenu-mode) 1618 (bookmark-bmenu-mode)
1620 (if bookmark-bmenu-toggle-filenames 1619 (if bookmark-bmenu-toggle-filenames
1621 (bookmark-bmenu-toggle-filenames t))) 1620 (bookmark-bmenu-toggle-filenames t)))