-
Notifications
You must be signed in to change notification settings - Fork 33
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
How to make candidates clickable? #113
Comments
Well, text properties are never stripped, so I think adding at any point would be fine. Why not in the collection passed to (let ((button "Hello world")
(keymap (make-sparse-keymap)))
(define-key keymap
[mouse-1]
(lambda
()
(interactive)
(message "Hi there!")))
(put-text-property
0 (length button) 'keymap keymap button)
(completing-read "Click me: " (list button))) |
I wanted to add the ability to select candidates via the mouse for all selections, but I'm not sure at what point the final candidates are decided. I wanted to do something like the following. (seq-map-indexed (lambda (cand index)
(propertize
cand
'keymap (let ((keymap (make-sparse-keymap)))
(define-key keymap [mouse-1]
(lambda ()
(interactive)
(selectrum-select-current-candidate (1+ index))))
(define-key keymap [mouse-3]
(lambda ()
(interactive)
(selectrum-insert-current-candidate (1+ index)))))))
cands) |
I see. You were not talking about propertizing a particular candidate, rather you wanted to contribute a pull request that would allow mouse control of Selectrum. I think it would make the most sense to do this at the very end, around here where other text properties are handled: |
Thank you for your help. I made a pull request. |
At which point should the clickable text be added to the candidates? It must be added to
selectrum--refined-candidates
, yes?The text was updated successfully, but these errors were encountered: