Function: bookmark-bmenu--revert
bookmark-bmenu--revert is a byte-compiled function defined in
bookmark.el.gz.
Signature
(bookmark-bmenu--revert)
Documentation
Re-populate tabulated-list-entries.
Source Code
;; Defined in /usr/src/emacs/lisp/bookmark.el.gz
(defun bookmark-bmenu--revert ()
"Re-populate `tabulated-list-entries'."
(let (entries)
(dolist (full-record (bookmark-maybe-sort-alist))
(let* ((name (bookmark-name-from-full-record full-record))
(type (bookmark-type-from-full-record full-record))
(annotation (bookmark-get-annotation full-record))
(location (bookmark-location full-record)))
(push (list
full-record
`[,(if (and annotation (not (string-equal annotation "")))
"*" "")
,(if (display-mouse-p)
(propertize name
'font-lock-face 'bookmark-menu-bookmark
'mouse-face 'highlight
'follow-link t
'help-echo "mouse-2: go to this bookmark in other window")
name)
,(or type "")
,@(if bookmark-bmenu-toggle-filenames
(list location))])
entries)))
;; The value of `bookmark-sort-flag' might have changed since the
;; last time the buffer contents were generated, so re-check it.
(cond ((eq bookmark-sort-flag t)
(setq tabulated-list-sort-key '("Bookmark Name" . nil)
tabulated-list-entries entries))
((or (null bookmark-sort-flag)
(eq bookmark-sort-flag 'last-modified))
(setq tabulated-list-sort-key nil)
;; And since we're not sorting by bookmark name, show bookmarks
;; according to order of creation, with the most recently
;; created bookmarks at the top and the least recently created
;; at the bottom.
;;
;; Note that clicking the column sort toggle for the bookmark
;; name column will invoke the `tabulated-list-mode' sort, which
;; uses `bookmark-bmenu--name-predicate' to sort lexically by
;; bookmark name instead of by (reverse) creation order.
;; Clicking the toggle again will reverse the lexical sort, but
;; the sort will still be lexical not creation-order. However,
;; if the user reverts the buffer, then the above check of
;; `bookmark-sort-flag' will happen again and the buffer will
;; go back to a creation-order sort. This is all expected
;; behavior, as documented in `bookmark-bmenu-mode'.
(setq tabulated-list-entries (reverse entries))))
;; Generate the header only after `tabulated-list-sort-key' is
;; settled, because if that's non-nil then the sort-direction
;; indicator will be shown in the named column, but if it's
;; nil then the indicator will not be shown.
(tabulated-list-init-header))
(tabulated-list-print t))