54903au_exists bug, was Re: Test Existence of Autocommand?
- Sep 3, 2009Bob Hiestand wrote:
> On Tue, Aug 25, 2009 at 11:38 AM, Ben Fritz<fritzophrenic@...> wrote:Thanks for the patch and testcase script. Would you be able to turn the
> >> On Fri, Aug 14, 2009 at 6:38 PM, Edward Beach<beach9...@...> wrote:
> >> > I'm trying to write a script that will toggle an autocommand on/off
> >> > and I'm looking for a function to return it's existence. I've found
> >> > the built-in exists function and from the help it gives me this:
> >> > #group#event autocommand defined for this group and event.
> >> > So from my command line I enter in the following
> >> > :aug TestGroup | aug END | echo exists("#TestGroup#BufWritePost")
> >> > and it comes back 1 -- but shouldn't it be 0 since I haven't created a
> >> > BufWritePost event and since
> >> > :au TestGroup
> >> > returns nothing?
> >> It looks like the #group#event code doesn't check for an autocommand
> >> for that event being defined *within* the group, just whether both the
> >> group and the autocommand exist. The #group#event#pattern does check
> >> for an autocommand defined within the specified group, though, so that
> >> may be helpful to you.
> > Since this is a patch for some VERY unexpected behavior, I'm cc'ing
> > vim_dev where such things are normally discussed.
> > My opinion is that this is a bug, if it can be reliably reproduced. I
> > can't imagine any situation where the described behavior would be
> > helpful.
> Here's a probably better patch, and a test case to show the behavior I
> expect from exists() with respect to autocommands:
script into a test for src/testdir? That will greatly help avoid
hundred-and-one symptoms of being an internet addict:
178. You look for an icon to double-click to open your bedroom window.
/// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
- << Previous post in topic Next post in topic >>