Add C-c C-e key binding to save an org-ql-find session

This commit is contained in:
Omar Antolín Camarena 2023-09-08 14:42:30 -06:00 committed by Adam Porter
parent 4ef9d9efed
commit 121af5c5d5

View file

@ -322,7 +322,23 @@ single predicate)."
(mapc #'org-ql--ensure-buffer buffers-files) (mapc #'org-ql--ensure-buffer buffers-files)
(let* ((completion-styles '(org-ql-completing-read)) (let* ((completion-styles '(org-ql-completing-read))
(completion-styles-alist (list (list 'org-ql-completing-read #'try #'all "Org QL Find"))) (completion-styles-alist (list (list 'org-ql-completing-read #'try #'all "Org QL Find")))
(selected (completing-read prompt #'collection nil t))) (selected
(minibuffer-with-setup-hook
(lambda ()
(let ((map (make-sparse-keymap)))
(define-key
map (kbd "C-c C-e")
(lambda ()
(interactive)
(run-at-time 0 nil
#'org-ql-search
buffers-files
(minibuffer-contents-no-properties))
(if (fboundp 'minibuffer-quit-recursive-edit)
(minibuffer-quit-recursive-edit)
(abort-recursive-edit))))
(use-local-map (make-composed-keymap map (current-local-map)))))
(completing-read prompt #'collection nil t))))
;; (debug-message "SELECTED:%S KEYS:%S" selected (hash-table-keys table)) ;; (debug-message "SELECTED:%S KEYS:%S" selected (hash-table-keys table))
(or (gethash selected table) (or (gethash selected table)
;; If there are completions in the table, but none of them exactly match the user input ;; If there are completions in the table, but none of them exactly match the user input