-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Embark and consult-line are not working properly #637
Comments
This a strange one! I think somehow (defun my/embark-find-file-other-window-vsplit ()
"Open the file in the other window."
(interactive)
(embark--quit-and-run (lambda (file)
(windmove-display-right)
(find-file-other-window file))
(plist-get (car (embark--targets)) :target))) |
That's weird, your solution does work. Do I need to report this to emacs?
(keymap-set minibuffer-local-map "C-v" #'(lambda ()(interactive)(my/embark-find-file-other-window 'vsplit)))
(defun my/embark-find-file-other-window (pos)
"Open the file in the other window."
(interactive)
(embark--quit-and-run (lambda (file)
(pcase pos
('vsplit (windmove-display-right))
('split (windmove-display-down))
(_ (windmove-display-right)))
(find-file-other-window file))
(plist-get (car (embark--targets)) :target)))
|
No,
That error message sounds like you are not using lexical binding! Make sure the code is in a file whose first line is: ;;; -*- lexical-binding: t -*- |
But honestly, instead of (define-key minibuffer-local-map (kbd "C-v") #'(lambda () (interactive) (my/embark-find-file-other-window 'vsplit)))
(define-key minibuffer-local-map (kbd "C-s") #'(lambda () (interactive) (my/embark-find-file-other-window 'split))) By the way, just use |
I'm closing because I don't think this issue requires any changes in Embark, but feel free to continue the conversation. |
I did try wrapping with let with the variable lexical-binding but that did not work.
It's not embark only, why does this code cause the same problem? (define-key minibuffer-local-map (kbd "C-v") (lambda ()(interactive)(progn (windmove-display-right) (call-interactively (key-binding (kbd "RET"))) )))
What's the difference? byte-compiled? According to the Emacs docs Anonymous Functions
(lambda (x) (* x x))
(function (lambda (x) (* x x)))
#'(lambda (x) (* x x)) Thanks |
Did you try, instead of ;;; -*- lexical-binding: t -*-
I am not aware of any difference, which means the more complicated and ugly-looking |
Yea the buffer variable does work, I usually try to avoid lexical-binding as a buffer (defun my/embark-find-file-other-window-vsplit (test)
"Open the file in the other window."
(interactive)
(let ((pos test))
(embark--quit-and-run (lambda (file)
(pcase pos
('vsplit (windmove-display-right))
('split (windmove-display-down))
(_ (windmove-display-right)))
(find-file-other-window file))
(plist-get (car (embark--targets)) :target))))
|
I put it at the top of every single elisp file. 🙃 |
Omar, my knowledge if elisp is limited. Hence, my response. Perhaps one day (lambda (x) (message "do something with %s" x))
(lambda (x) (message "Another function using x %s" x)) |
Hey Omar, I have another problem. Your solution does not work with consult (keymap-set minibuffer-local-map "C-v" 'my/embark-find-file-other-window-vsplit) I've always used this and it works fine to open up ripgreps but had the problem that it did not say in consult-line. (define-key minibuffer-local-map (kbd "C-v") (lambda ()(interactive)(progn (windmove-display-right) (call-interactively (key-binding (kbd "RET"))) ))) Thanks |
Update: I also tried to act on it: (define-key embark-buffer-map "v" 'my/embark-find-file-other-window-vsplit) |
Hello,
I seem to have a problem with embark and consult-line.
When I:
C-v
I'm not in the minibuffer, I end up deleting deleting characters with x because
I have evil. See video below. I think the problem seems to be with
windmove-display-right but I'm not sure.
My overall goals are to:
C-v
C-s
Here is my relevant configuration for embark.
I was taking a pos argument and pcase it but first I need to get this fixed.
This is a minimal configuration.
This is my main configuration.
Thanks
The text was updated successfully, but these errors were encountered: