From 518449e07cb298fec6c98c4dea87e739b3abc9c3 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Sat, 15 Feb 2025 08:34:36 +1100 Subject: [emacs] firefox places completion in my-browse-url --- emacs/.emacs.d/lisp/my/my-web.el | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'emacs/.emacs.d/lisp/my/my-web.el') diff --git a/emacs/.emacs.d/lisp/my/my-web.el b/emacs/.emacs.d/lisp/my/my-web.el index 6de8386..7d08936 100644 --- a/emacs/.emacs.d/lisp/my/my-web.el +++ b/emacs/.emacs.d/lisp/my/my-web.el @@ -223,10 +223,19 @@ https://emacs.stackexchange.com/questions/40887/in-org-mode-how-do-i-link-to-int (string-lines (buffer-string)) ))) -(defun my-firefox-places-collection (query _ action) +(defun my-firefox-places-collection (query pred action) (if (eq action 'metadata) - (message "action is metadata") - (my-firefox-places query))) + `(metadata (display-sort-function . ,#'identity) + ;; Needed for icomplete to respect list order + (cycle-sort-function . ,#'identity)) + (let ((candidates (my-firefox-places query))) + (message "Got %d candidates for query %s. Current action is %s" (length candidates) query action) + (cl-loop for str in-ref candidates do + (setf str (orderless--highlight regexps ignore-case (substring str)))) + candidates + ;; Does not show remotely as many results + ;; (complete-with-action action candidates query pred) + ))) (defun my-browse-url (url) (interactive (list (completing-read "URL to browse: " -- cgit v1.2.3