(t (time-less-p ty tx)))))))
(t copy))))
+(defun bookmark--affixation (names)
+ "Return completion affixations for bookmark name list NAMES."
+ (let ((max-name 0)
+ (max-type 0)
+ (all nil)
+ (res nil))
+ (dolist (name names)
+ (setq max-name (max max-name (string-width name)))
+ (let* ((bmrk (assoc name bookmark-alist))
+ (type (bookmark-type-from-full-record bmrk))
+ (type (if (and type (not (string-empty-p type))) type "File")))
+ (setq max-type (max max-type (string-width type)))
+ (push (list name type (bookmark-get-last-modified bmrk)) all)))
+ (pcase-dolist (`(,name ,type ,lmod) all)
+ (push (list name ""
+ (propertize
+ (concat (make-string (- (+ max-name 2) (string-width name)) ?\s)
+ type
+ (when lmod
+ (concat (make-string (- (+ max-type 2)
+ (string-width type))
+ ?\s)
+ (format-time-string "%Y-%m-%d %T" lmod))))
+ 'face 'completions-annotations))
+ res))
+ res))
+
(defun bookmark-completing-read (prompt &optional default)
"Prompting with PROMPT, read a bookmark name in completion.
PROMPT will get a \": \" stuck on the end no matter what, so you
bookmark-alist
`((category . bookmark)
(narrow-completions-function
- . bookmark-narrow-completions-by-type)))
+ . bookmark-narrow-completions-by-type)
+ ,@(when completions-detailed
+ '((affixation-function . bookmark--affixation)))))
nil 0 nil 'bookmark-history default)))))
(defun bookmark-narrow-completions-by-type ()
(let* ((get-type
(lambda (bmk-record)
(let ((res (bookmark-type-from-full-record bmk-record)))
- (if (and res (not (string-empty-p res))) res "Regular"))))
+ (if (and res (not (string-empty-p res))) res "File"))))
(types (delete-dups (mapcar get-type bookmark-alist)))
(type (completing-read "Keep bookmark completions of type: "
types nil t)))