Re: why does :save not work with -stdin-

2007-06-06 Thread Bram Moolenaar

Edward L. Fox wrote:

> On 6/6/07, Mohsin <[EMAIL PROTECTED]> wrote:
> > I usually do search like this:
> >
> > $ grep  Word *.* | vim -u myvimrc -
> >
> > $ cat myvimrc
> >
> >:autocmd StdinReadPost * :sav! /tmp/x
> >
> > but when I quit :q, vim always asks me to save the file again,
> > why is the file marked as modified?
> >
> > I tried all combinations of flags, but can't get vim to
> > mark the file as "saved",
> 
> It's a bug. Here is the patch. Please test it carefully, thanks very
> much for reporting this to me. I'll ask Bram to add it to the official
> release soon.
> 
> Index: buffer.c
> ===
> --- buffer.c(revision 296)
> +++ buffer.c(working copy)
> @@ -171,14 +171,6 @@
> /* Put the cursor on the first line. */
> curwin->w_cursor.lnum = 1;
> curwin->w_cursor.col = 0;
> -#ifdef FEAT_AUTOCMD
> -# ifdef FEAT_EVAL
> -   apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
> -   curbuf, &retval);
> -# else
> -   apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf);
> -# endif
> -#endif
> }
>  }
> 
> @@ -207,6 +199,18 @@
> unchanged(curbuf, FALSE);
>  save_file_ff(curbuf);  /* keep this fileformat */
> 
> +#ifdef FEAT_AUTOCMD
> +if (read_stdin)
> +{
> +# ifdef FEAT_EVAL
> +apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
> +   curbuf, &retval);
> +# else
> +apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf);
> +# endif
> +}
> +#endif
> +
>  /* require "!" to overwrite the file, because it wasn't read completely 
> */
>  #ifdef FEAT_EVAL
>  if (aborting())

Instead of moving the autocommands, it might be better to move the call
to changed() to before the autocommands (with the "if" that checks for
read_stdin).  The readfile() call also invokes the ReadPost
autocommands, this keeps it consistent.

-- 
hundred-and-one symptoms of being an internet addict:
162. You go outside and look for a brightness knob to turn down the sun.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- 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///


Re: VimWiki - released finally

2007-06-06 Thread Robert Cussons

On 6/5/07, Sebastian Menge <[EMAIL PROTECTED]> wrote:

[cross-posted to vim, vim-dev, vim-announce, wikia-l]

Hi all

Finally I have imported all the vim tips from http://vim.org/tips to

http://vim.wikia.com

and set up a minimal infrastructure to keep things going. Not everything
is perfect, but I think it is usable now.

Thanks to all the support from [EMAIL PROTECTED] and especially to the very
kind wikia community (#wikia on freenode and the mailing list,
Greetings!).

Some words on contribution: A good wiki depends on two main factors:
Excellent content and a lively community. We have a lot of good content
now, but to make it excellent we need You!

If you ever posted a tip or a comment to the old tips database, please
have a look at it on the wiki, and review the page. Every little bit
helps!

See you on the wiki, Sebastian.






Very good work Sebastian, it looks great to me.

I have already come across a new tip on vim wikia that I hadn't known 
anything about which I thought I might draw programmer's attention to 
(sorry if you already know about it). Tip #1267, which is a tip to 
enable a programmer to see (by a simple key combination of his/her 
choice), in which function they are. Very useful if you have just landed 
in the middle of a long function during a search for example, you know 
longer have to move around inside the buffer to find which function you 
are in, just type your chosen key combination: see 
http://vim.wikia.com/wiki/Show_current_function_name_(for_C_programmers)

if you are interested.

Thanks very much to the original author of the tip and to everyone who 
has contributed to setting up the vim wikia.

Rob.