Skip to content

Commit 530c349

Browse files
committed
Improve documentation of bookmark default sorting
* lisp/bookmark.el (bookmark-alist, bookmark-store, bookmark-maybe-sort-alist): Update doc strings and comments.
1 parent 1149225 commit 530c349

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

lisp/bookmark.el

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,13 @@ functions have a binding in this keymap.")
249249
Bookmark functions update the value automatically.
250250
You probably do NOT want to change the value yourself.
251251
252-
The value is an alist with bookmarks of the form
252+
The value is an alist whose elements are of the form
253253
254254
(BOOKMARK-NAME . PARAM-ALIST)
255255
256-
or the deprecated form (BOOKMARK-NAME PARAM-ALIST).
256+
or the deprecated form (BOOKMARK-NAME PARAM-ALIST). The alist is
257+
ordered from most recently created bookmark at the front to least
258+
recently created bookmark at the end.
257259
258260
BOOKMARK-NAME is the name you gave to the bookmark when creating it.
259261
@@ -577,10 +579,10 @@ old one."
577579
;; Modify using the new (NAME . ALIST) format.
578580
(setcdr bm alist))
579581

580-
;; otherwise just cons it onto the front (either the bookmark
581-
;; doesn't exist already, or there is no prefix arg. In either
582-
;; case, we want the new bookmark consed onto the alist...)
583-
582+
;; Otherwise just put it onto the front of the list. Either the
583+
;; bookmark doesn't exist already, or there is no prefix arg.
584+
;; In either case, we want the new bookmark on the front of the
585+
;; list, since the list is kept in reverse order of creation.
584586
(push (cons stripped-name alist) bookmark-alist))
585587

586588
;; Added by db
@@ -1138,7 +1140,9 @@ it to the name of the bookmark currently being set, advancing
11381140

11391141
(defun bookmark-maybe-sort-alist ()
11401142
"Return `bookmark-alist' for display.
1141-
If `bookmark-sort-flag' is non-nil, then return a sorted copy of the alist."
1143+
If `bookmark-sort-flag' is non-nil, then return a sorted copy of the alist.
1144+
Otherwise, just return `bookmark-alist', which by default is ordered
1145+
from most recently created to least recently created bookmark."
11421146
(if bookmark-sort-flag
11431147
(sort (copy-alist bookmark-alist)
11441148
(lambda (x y) (string-lessp (car x) (car y))))

0 commit comments

Comments
 (0)