[PATCH] Fix to bufdo executing command on deleted buffer after 7.4-566.

261 views
Skip to first unread message

Shane Harper

unread,
Feb 17, 2015, 10:39:39 PM2/17/15
to vim...@googlegroups.com
The "first buffer" and not the "first buffer that is not deleted" was being used when processing :bufdo.

new_ex_bufdo_function.diff: bufdo specific code was moved out of ex_listdo() into a new function ex_bufdo(). I made the change so I could more easily understand how bufdo is processed. (Much of the diff is due to increasing indentation level of some code. The diff looks *much* nicer when ignoring whitespace changes.)

bufdo_skip_deleted_buffer.diff: bug fix including updated test case. (Apply after new_ex_bufdo_function.diff.)
new_ex_bufdo_function.diff
bufdo_skip_deleted_buffer.diff

Bram Moolenaar

unread,
Feb 18, 2015, 5:09:43 PM2/18/15
to Shane Harper, vim...@googlegroups.com

Shane Harper wrote:

> The "first buffer" and not the "first buffer that is not deleted" was
> being used when processing :bufdo.

Do you mean the first buffer that is listed, thus skipping unlisted
buffers?

> new_ex_bufdo_function.diff: bufdo specific code was moved out of
> ex_listdo() into a new function ex_bufdo(). I made the change so I
> could more easily understand how bufdo is processed. (Much of the diff
> is due to increasing indentation level of some code. The diff looks
> *much* nicer when ignoring whitespace changes.)
>
> bufdo_skip_deleted_buffer.diff: bug fix including updated test case.
> (Apply after new_ex_bufdo_function.diff.)

Would the fix also work if we didn't split out ex_bufdo()? Or is
splitting it off essential for being able to fix it?


--
hundred-and-one symptoms of being an internet addict:
250. You've given up the search for the "perfect woman" and instead,
sit in front of the PC until you're just too tired to care.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Shane Harper

unread,
Feb 18, 2015, 6:20:03 PM2/18/15
to vim...@googlegroups.com, sh...@shaneharper.net
> Do you mean the first buffer that is listed, thus skipping unlisted
> buffers?

Yes.

Before patch 566 if I had two buffers (1 and 2) and I did
:1bd
:bufdo some_cmd
some_cmd would be executed only on buffer 2.

After 566 some_cmd is executed on buffers 1 and 2. The patch restores the original behavior.



> Would the fix also work if we didn't split out ex_bufdo()? Or is
> splitting it off essential for being able to fix it?

It can be fixed with or without splitting out ex_bufdo.

I split out the code in ex_bufdo mostly to make it easier for me to understand. (The original ex_listdo function also handles specifics for :windo, :tabdo and :argdo.)


Attached is a patch which doesn't involve splitting out the code to handle bufdo into a separate function.
bufdo_skip_unlisted_buffer.diff
Reply all
Reply to author
Forward
0 new messages