summaryrefslogtreecommitdiff
path: root/lisp/bookmark.el
diff options
context:
space:
mode:
authorManuel Giraud <manuel@ledu-giraud.fr>2022-06-01 17:32:28 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-06-01 17:32:28 +0200
commitfccde521585c708a9108517204b3e9a88c25ab2f (patch)
tree718fc0eadc25f46971f81004a29c8e087ad8c594 /lisp/bookmark.el
parent88b88c08a2ab23ac666bec8c9063cc75a9ed43a9 (diff)
downloademacs-fccde521585c708a9108517204b3e9a88c25ab2f.tar.gz
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.
Diffstat (limited to 'lisp/bookmark.el')
-rw-r--r--lisp/bookmark.el9
1 files changed, 6 insertions, 3 deletions
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)