`C-x k` with ivy-mode kills wrong buffer #135

Closed
tsdh opened this Issue Jun 9, 2015 · 2 comments

Projects

None yet

2 participants

@tsdh
Contributor
tsdh commented Jun 9, 2015

I'm just viewing an attachment of an email received with Gnus. The buffer name is " *mm*-469037". Now I want to kill that buffer and do C-x k. The prompt is 10 Kill buffer (default *mm*-469037): but in the list of candidates, the selected buffer is the gnus summary buffer. And indeed, when I confirm with RET what gets killed is the gnus summary buffer and not the *mm*-469037 buffer. (Well, and having a discrepancy between default value and what's selected is strange anyhow.)

I guess the reason is that the *mm*-469037 buffer is a hidden buffer and thus isn't on the buffer candidate list by default when there's no input starting with a space. If that's indeed the culprit, then basically you have to make sure that the current buffer is always in the list of candidates even though it might be hidden.

@abo-abo abo-abo added a commit that closed this issue Jun 9, 2015
@abo-abo Add a hack for kill-buffer and invisible buffer
* ivy.el (ivy-read): When COLLECTION is 'internal-complete-buffer,
  ignore the fact that REQUIRE-MATCH was set to t.
  Normally, when REQUIRE-MATCH is t, the COLLECTION should not be
  extended with PRESELECT.

Fixes #135
607d943
@abo-abo abo-abo closed this in 607d943 Jun 9, 2015
@abo-abo
Owner
abo-abo commented Jun 9, 2015

Thanks, but it seems to me that kill-buffer is at fault here, since it sets require-match but does not put the proposed default into collection.
Anyway, added a work-around.

@tsdh
Contributor
tsdh commented Jun 9, 2015

Oleh Krehel notifications@github.com writes:

Thanks, but it seems to me that kill-buffer is at fault here, since
it sets require-match but does not put the proposed default into
collection.
Anyway, added a work-around.

Indeed, that seems strange. But it doesn't only apply to kill-buffer
but to all commands with "b" interactive spec I think. At least
kill-buffer or rather its C subr Fkill_buffer doesn't read the
buffer itself but eventually that's the job of Fcall_interactively
which calls Fread_buffer. And that uses completing read with the
given default and internal-complete-buffer, and the latter suggests
hidden buffers only when the search string has a space prefix.

Bye,
Tassilo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment