Set completion-styles via setq-local rather than by let-binding
When the completion-styles are bound they affect all recursive minibuffers as well, overriding the user's completion setup! Using setq-local instead ensures the org-ql completion settings are only applied for the org-ql-completing-read minibuffer.
This commit is contained in:
parent
4b8330a683
commit
56c93ab8c8
1 changed files with 20 additions and 20 deletions
|
|
@ -332,26 +332,26 @@ single predicate)."
|
|||
;; ensuring all of the BUFFERS-FILES are loaded and initialized before calling
|
||||
;; `completing-read'.
|
||||
(mapc #'org-ql--ensure-buffer buffers-files)
|
||||
(let* ((completion-styles '(org-ql-completing-read))
|
||||
(completion-styles-alist (cons (list 'org-ql-completing-read #'try #'all "Org QL Find")
|
||||
completion-styles-alist))
|
||||
(selected
|
||||
(minibuffer-with-setup-hook
|
||||
(lambda ()
|
||||
(use-local-map (make-composed-keymap org-ql-completing-read-map (current-local-map))))
|
||||
(cl-letf* (((symbol-function 'org-ql-completing-read-export)
|
||||
(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))))
|
||||
((symbol-function 'embark-export)
|
||||
(symbol-function 'org-ql-completing-read-export)))
|
||||
(completing-read prompt #'collection nil t)))))
|
||||
(let ((selected
|
||||
(minibuffer-with-setup-hook
|
||||
(lambda ()
|
||||
(setq-local completion-styles '(org-ql-completing-read))
|
||||
(setq-local completion-styles-alist (cons (list 'org-ql-completing-read #'try #'all "Org QL Find")
|
||||
completion-styles-alist))
|
||||
(use-local-map (make-composed-keymap org-ql-completing-read-map (current-local-map))))
|
||||
(cl-letf* (((symbol-function 'org-ql-completing-read-export)
|
||||
(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))))
|
||||
((symbol-function 'embark-export)
|
||||
(symbol-function 'org-ql-completing-read-export)))
|
||||
(completing-read prompt #'collection nil t)))))
|
||||
;; (debug-message "SELECTED:%S KEYS:%S" selected (hash-table-keys table))
|
||||
(or (gethash selected table)
|
||||
;; If there are completions in the table, but none of them exactly match the user input
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue