From: Manuel Giraud Date: Wed, 1 Jun 2022 15:32:28 +0000 (+0200) Subject: Place bookmarks without last-modified at the end X-Git-Tag: emacs-29.0.90~1910^2~295^2~9 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fccde521585c708a9108517204b3e9a88c25ab2f;p=emacs.git Place bookmarks without last-modified at the end * lisp/bookmark.el (bookmark-sort-flag): Typo fix in doc string. (bookmark-maybe-sort-alist): Fix sorting when there's no last modified. --- diff --git a/lisp/bookmark.el b/lisp/bookmark.el index 8e251e9de87..849303fac7e 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -120,7 +120,7 @@ nil means they will be displayed in LIFO order (that is, most recently created ones come first, oldest ones come last). `last-modified' means that bookmarks will be displayed sorted -from most recently set to last recently set. +from most recently set to least recently set. Other values means that bookmarks will be displayed sorted by bookmark name." @@ -520,8 +520,11 @@ is ordered from most recently created to least recently created bookmark." (sort copy (lambda (x y) (string-lessp (car x) (car y))))) ((eq bookmark-sort-flag 'last-modified) (sort copy (lambda (x y) - (time-less-p (bookmark-get-last-modified y) - (bookmark-get-last-modified x))))) + (let ((tx (bookmark-get-last-modified x)) + (ty (bookmark-get-last-modified y))) + (cond ((null tx) nil) + ((null ty) t) + (t (time-less-p ty tx))))))) (t copy)))) (defun bookmark-completing-read (prompt &optional default)