ivy-switch-buffer: calling current-buffer soon afterward returns old buffer #1766
Comments
mehw
added a commit
to mehw/swiper
that referenced
this issue
Sep 26, 2018
basil-conto
added a commit
to basil-conto/swiper
that referenced
this issue
Sep 26, 2018
The call to with-current-buffer was made redundant by the preceding set-buffer added in abo-abo#1607, and incorrectly restores ivy-state-buffer after calling action. (ivy-call): Remove call to with-current-buffer. Closes abo-abo#1766
Which is why I think this |
Please, also see @ericdanan 717#issuecomment-321920963. It seems to work. Thanks!
Peer reviews will be helpful... Please, kindly review #1767. |
Thanks, all. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello.
Could someone confirm the following, please?
Description
Switching buffer from
A
toB
viaivy-switch-buffer
changes the buffer toB
as expected, but callingcurrent-buffer
soon afterward returnsA
notB
!Versions affected
How to replicate
Register the command
testme-ivy-switch-buffer
below, then run it viaM-x testme-ivy-switch-buffer
. Then, try to switch to a different buffer and take note of the printed message.Expected odd results:
(current-buffer)
returns the old buffer.(window-buffer (selected-window))
returns the buffer switched to.Implementation notes
There's a sort of oddity in
ivy-call
:When
action
isivy--switch-buffer-action
, it switches buffer tox
, but the wrappingwith-current-buffer
set it back toivy-last
's registered:buffer
... the old buffer.Proposed solution
Excuse me for not opening a PR... my bad...
I pushed a commit on a new branch and there should be a referenced solution right here.
The text was updated successfully, but these errors were encountered: