Icicles's icicle-buffer doesn't take into account the current buffer

1

Icicles's icicle-buffer doesn't take into account the current buffer from which it was invoked.

How can I disable this feature?

Bleeding Fingers

Posted 2014-01-09T12:05:15.260

Reputation: 254

What do you mean by it not taking into account the current buffer? That buffer is excluded from the set of candidates, as is usual for buffer-switching commands (e.g. switch-to-buffer, whose keys icicle-buffer appropriates when in Icicle mode). – Drew – 2014-01-16T21:40:39.043

Can you be more specific? What feature do you want to disable? Etc. – Drew – 2014-02-02T05:58:07.950

Apologies for the late response. Say there are buffers A, B and C. Now I want to Progressive Search (from icicle-buffer) through all the three buffers looking for foo. If I invoked the search while in buffer A the search wouldn't take into account the content of buffer A and will only search the content of buffers B and C. – Bleeding Fingers – 2014-02-02T20:13:26.390

Answers

0

OK, I understand now, based on your comment replies. The reason is that icicle-buffer is a replacement (in Icicle mode) for switch-to-buffer (C-x b), which excludes the current buffer as a candidate. The idea is that you want to "Switch to a different buffer, whose content contains a regexp match" as the first line of the doc string says.

Not allowing the current buffer as a candidate could easily be made optional, if there is a real use case for it. Help me understand the use case. Why would you want to "switch" to the same buffer, i.e., do nothing? I suppose your answer will have something to do with using the content-searching feature, but please explain it a bit. Is the idea that you do not want to do anything (e.g., change buffer) except to find out whether the contents of the current buffer match a certain pattern or patterns?

If so, then why not just use search? Remember, icicle-buffer does not show you any matches it finds. It simply looks for one match, and if there is one then the buffer name remains a candidate. If there is no match then the buffer name is removed as a candidate.

What I would like to know is why you would like the current buffer to be a candidate here. Why not just use Icicles search or plain Isearch, if you want to know whether the current buffer contents match some pattern?

I can guess that perhaps your use case involves wanting to see the names of all of the buffers whose contents match a pattern, and depending on that set, perhaps switch to one or perhaps stay in the current buffer. Is that it? Without keeping the current buffer as a candidate you have no way of knowing, via the same command invocation, whether the current buffer is one of those that contains the pattern. To find that out you would need to search the current buffer in a separate operation.

But please let me know your intended use case. I'll be glad to consider making this optional, if I see a real use case for it. StackOverflow is not designed for discussion, so feel free to email me about this: M-x icicle-send-bug-report.

To try the behavior you ask for, as a test, you can modify the code yourself. All you need to do is comment out this part of the definition of icicle-buffer, in file icicle-cmd1.el:

(icicle-bufflist (setq icicle-bufflist (delete icicle-orig-buff icicle-bufflist)))

(Be sure to keep the )) that comes just after that sexp in the code.) That will prevent removal of the current buffer name as a candidate.

If by chance there is some confusion about the content-searching of icicle-buffer, please read also this "chapter & verse" part of the doc, which describes it in general terms, contrasting it with search etc.

Drew

Posted 2014-01-09T12:05:15.260

Reputation: 1 898

ping -- Any news? – Drew – 2014-02-19T03:32:27.163