-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add C-c C-e key binding to save an org-ql-find session #368
Conversation
Thanks, this seems like a good idea. I'll merge it for v0.8 (I'd like to tag v0.7.2 first). |
Well, it was your idea, you said you wanted something like helm-org-ql-save for org-ql-find. :) |
Right, and for some reason I expected it to be contained within Embark, but of course, that's not feasible, so this makes sense. :) |
This is great, I just need to:
|
059b10c
to
77b4c2b
Compare
1abd990
to
f4b006f
Compare
16e2d2d
to
f98dee5
Compare
@oantolin Thank you very much for your work on this! |
Thanks for merging! I'm not sure how much I like the idea of remapping |
So I tried I don't think there is any real problem with keeping the remap in org-ql-completing-read.el since people (like me!) who don't want it can easily undo it in their own configuration, but all the same I'd (weakly) recommend removing it. Also, the way you did the remappping is much nicer than what I did for |
A buffer displayed with the entries, but activating them signaled an error. Besides that, that buffer doesn't allow modifying or saving the search, so I'm not sure what reason there would be to offer it in addition to the full-featured view. Am I missing something?
Hm, I'll take a look. Thanks. |
I tried to do something like you suggested, but it doesn't work, and I don't know why. For some reason, the Embark commands end up calling the original definition of Anyway, here's the patch. Let me know if you have any thoughts. Thanks. diff --git a/org-ql-completing-read.el b/org-ql-completing-read.el
index 4db51e6..2e1f049 100644
--- a/org-ql-completing-read.el
+++ b/org-ql-completing-read.el
@@ -30,11 +30,9 @@ (require 'org-ql)
(defvar-keymap org-ql-completing-read-map
:doc "Active during `org-ql-completing-read' sessions."
- "C-c C-e" #'org-ql-completing-read-export)
-
-;; `embark-collect' doesn't work for `org-ql-completing-read', so remap
-;; it to `embark-export' (which `keymap-set', et al doesn't allow).
-(define-key org-ql-completing-read-map [remap embark-collect] 'embark-export)
+ "C-c C-e" #'org-ql-completing-read-export
+ "<remap> <embark-collect>" #'org-ql-completing-read-export
+ "<remap> <embark-export>" #'org-ql-completing-read-export)
;;;; Customization
@@ -340,18 +338,16 @@ (cl-defun org-ql-completing-read
(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)))
+ (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)))))
(completing-read prompt #'collection nil t)))))
;; (debug-message "SELECTED:%S KEYS:%S" selected (hash-table-keys table))
(or (gethash selected table) |
Weird. Here using
This also works correctly here: pressing I wonder why that doesn't work on your end.
I tried too and it didn't work either, when I called |
Thanks for checking into those things. I'll have to re-test them myself in case I did something wrong or had some temporary, buggy code defined somewhere. |
Since
buffers-files
is only present in a lexically scoped variable, I define the save command internally toorg-ql-completing-read
.