BufWinEnter autocmd is not invoked when splitting a window

2006-09-02 Thread Yegappan Lakshmanan

Hi all,

The BufWinEnter autocmd is not invoked when splitting a window.
According to the help for the BufWinEnter autocmd, this autocmd
is invoked when a buffer is displayed in a window.

For example, use the following autocmd:

  au BufWinEnter * echomsg "Entering buffer " . expand("")

With the above autocmd, if you execute the following commands:

   :e 
   :split

The BufWinEnter autocmd is not invoked for the new window.

But if you use the following commands, then the BufWinEnter autocmd
is invoked:

   :e 
   :split 

- Yegappan


Re: vim mailing lists

2006-09-02 Thread Bram Moolenaar

Gautam Iyer wrote:

> On Fri, Sep 01, 2006 at 10:18:35PM +0200, Bram Moolenaar wrote:
> 
> > > > > > Apparently the sorbs blacklist mechanism is still being used, 
> > > > > > causing
> > > > > > trouble for some people.  I have asked the mail server maintainer to
> > > > > > remove sorbs a few times now...
> > > > > 
> > > > > Twice recently, sorbs has bounced my mails to the list because some
> > > > > server between my ISP and the vim-dev list is on its blacklist.
> > > > > 
> > > > > Do you have any plans to move the vim mailing lists to a new server,
> > > > > where you (or someone more responsive) has administrative control?
> > > > 
> > > > The plan was to move the maillists to the server that is now already the
> > > > Vim mail server.  And the one causing this blacklist trouble...
> > > > 
> > > > There is no progress in moving the maillists.  I suppose it's time to
> > > > find a better place for the Vim mail server.  Instead of a server that
> > > > just happens to be available and run by someone who doesn't always
> > > > respond, or some big and anonymous server park like Yahoo, I think we
> > > > should look for a small site that does have 24 hour support.
> > > 
> > > How about the sourceforge mailing lists? I know sourceforge has had
> > > numerous failures in the past. But I think their mailing lists might be
> > > OK.
> > 
> > Features missing (at least):
> > - When someone is not subscribed the message should bounce, not sent to
> >   the maillist owner.  (I have to manually remove spam stuff from the
> >   a-a-p lists regularly).
> > - Messages with just HTML, executable attachments etc. should be
> >   bounced.  These rules must be configurable.
> > - Loading all the old messages into the archive, so that searches find
> >   them.
> 
> Bram,
> 
> I just set up a new mailing list on SF. I think the above features are
> there on the version of mailman they just installed.

I do notice there is now an option to reject posts from non-members,
instead of sending them to the list owner for approval.

I don't see a setting for rejecting HTML-only messages or messages with
executable attachments.

I don't see how to fill the archive from an existing archive.

-- 
   An extraordinary TALL KNIGHT in all black (possibly John with Mike on his
   shoulders) walks out from the dark trees.  He is extremely fierce and
   gruesome countenance.  He walks towards KING ARTHUR and PATSY, who are
   wazzing like mad.  (Salopian slang, meaning very scared.  almost to the
   point of wetting oneself, e.g. before an important football match or
   prior to a postering.  Salopian slang meaning a beating by the school
   praeposters.  Sorry about the Salopian slant to this stage direction - Ed.)
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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: vim mailing lists

2006-09-02 Thread Gautam Iyer
On Fri, Sep 01, 2006 at 10:18:35PM +0200, Bram Moolenaar wrote:

> > > > > Apparently the sorbs blacklist mechanism is still being used, causing
> > > > > trouble for some people.  I have asked the mail server maintainer to
> > > > > remove sorbs a few times now...
> > > > 
> > > > Twice recently, sorbs has bounced my mails to the list because some
> > > > server between my ISP and the vim-dev list is on its blacklist.
> > > > 
> > > > Do you have any plans to move the vim mailing lists to a new server,
> > > > where you (or someone more responsive) has administrative control?
> > > 
> > > The plan was to move the maillists to the server that is now already the
> > > Vim mail server.  And the one causing this blacklist trouble...
> > > 
> > > There is no progress in moving the maillists.  I suppose it's time to
> > > find a better place for the Vim mail server.  Instead of a server that
> > > just happens to be available and run by someone who doesn't always
> > > respond, or some big and anonymous server park like Yahoo, I think we
> > > should look for a small site that does have 24 hour support.
> > 
> > How about the sourceforge mailing lists? I know sourceforge has had
> > numerous failures in the past. But I think their mailing lists might be
> > OK.
> 
> Features missing (at least):
> - When someone is not subscribed the message should bounce, not sent to
>   the maillist owner.  (I have to manually remove spam stuff from the
>   a-a-p lists regularly).
> - Messages with just HTML, executable attachments etc. should be
>   bounced.  These rules must be configurable.
> - Loading all the old messages into the archive, so that searches find
>   them.

Bram,

I just set up a new mailing list on SF. I think the above features are
there on the version of mailman they just installed.

Gautam

-- 
'Fortissimoe' -- The musical moment produced when someone serially slaps
the faces of the first violin section.


Patch 7.0.081

2006-09-02 Thread Bram Moolenaar

Patch 7.0.081
Problem:Command line completion doesn't work for a shell command with an
absolute path.
Solution:   Don't use $PATH when there is an absolute path.
Files:  src/ex_getln.c


*** ../vim-7.0.080/src/ex_getln.c   Wed Aug 16 16:24:58 2006
--- src/ex_getln.c  Sat Sep  2 17:51:03 2006
***
*** 4521,4527 
  flags |= EW_FILE | EW_EXEC;
  
  /* For an absolute name we don't use $PATH. */
! if ((pat[0] == '.' && (vim_ispathsep(pat[1])
|| (pat[1] == '.' && vim_ispathsep(pat[2])
path = (char_u *)".";
  else
--- 4521,4529 
  flags |= EW_FILE | EW_EXEC;
  
  /* For an absolute name we don't use $PATH. */
! if (mch_isFullName(pat))
!   path = (char_u *)" ";
! else if ((pat[0] == '.' && (vim_ispathsep(pat[1])
|| (pat[1] == '.' && vim_ispathsep(pat[2])
path = (char_u *)".";
  else
***
*** 4534,4539 
--- 4536,4544 
  ga_init2(&ga, (int)sizeof(char *), 10);
  for (s = path; *s != NUL; s = e)
  {
+   if (*s == ' ')
+   ++s;/* Skip space used for absolute path name. */
+ 
  #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
e = vim_strchr(s, ';');
  #else
*** ../vim-7.0.080/src/version.cSat Sep  2 16:36:46 2006
--- src/version.c   Sat Sep  2 17:54:35 2006
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 81,
  /**/

-- 
TALL KNIGHT OF NI: Ni!
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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///


Patch 7.0.080

2006-09-02 Thread Bram Moolenaar

Patch 7.0.080
Problem:Generating auto/pathdef.c fails for CFLAGS with a backslash.
Solution:   Double backslashes in the string. (Alexey Froloff)
Files:  src/Makefile


*** ../vim-7.0.079/src/Makefile Sat Sep  2 15:31:29 2006
--- src/MakefileFri Sep  1 21:00:29 2006
***
*** 2261,2267 
  auto/osdef.h: auto/config.h osdef.sh osdef1.h.in osdef2.h.in
CC="$(CC) $(OSDEF_CFLAGS)" srcdir=$(srcdir) sh $(srcdir)/osdef.sh
  
! QUOTESED = sed -e 's/"/\\"/g' -e 's/\\"/"/' -e 's/\\";$$/";/'
  auto/pathdef.c: Makefile auto/config.mk
[EMAIL PROTECTED] creating $@
[EMAIL PROTECTED] '/* pathdef.c */' > $@
--- 2262,2268 
  auto/osdef.h: auto/config.h osdef.sh osdef1.h.in osdef2.h.in
CC="$(CC) $(OSDEF_CFLAGS)" srcdir=$(srcdir) sh $(srcdir)/osdef.sh
  
! QUOTESED = sed -e 's/[\\"]/\\&/g' -e 's/\\"/"/' -e 's/\\";$$/";/'
  auto/pathdef.c: Makefile auto/config.mk
[EMAIL PROTECTED] creating $@
[EMAIL PROTECTED] '/* pathdef.c */' > $@
*** ../vim-7.0.079/src/version.cSat Sep  2 14:54:17 2006
--- src/version.c   Sat Sep  2 16:35:50 2006
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 80,
  /**/

-- 
E  M  A  C  S
s  e  l  o  h
c  t  t  n  i
a  a t  f
pr  t
eo
 l

 /// 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: [PATCH] russian vimtutor is b0rken in UTF-8 locale

2006-09-02 Thread Alexey I. Froloff
* Bram Moolenaar  [060902 16:23]:
> Thanks.  I notice you rename tutor.ru to tutor.ru.koi8.  Is there
> anything against keeping the old name?
It's because "tutor.ru" is "default" file.  Now there's no such
thing like "default russian encoding".  I think it's better check
if current locale is supported and fall back to english if not.
Maybe I'm a little paranoid ;-)

> Just to avoid a big diff that doesn't change much.
Well, first version will work now without changing much.  Second
version was supposed to be included in next "tarballed" version.

-- 
Regards,
Sir Raorn.


signature.asc
Description: Digital signature


Patch 7.0.079

2006-09-02 Thread Bram Moolenaar

Patch 7.0.079
Problem:Russian tutor doesn't work when 'encoding' is "utf-8".
Solution:   Use tutor.ru.utf-8 as the master, and generate the other encodings
from it.  Select the right tutor depending on 'encoding'. (Alexey
Froloff)
Files:  runtime/tutor/Makefile, runtime/tutor/tutor.vim,
runtime/tutor/tutor.ru.utf-8


*** ../vim-7.0.079/runtime/tutor/Makefile   Sun Jun 13 20:35:48 2004
--- runtime/tutor/Makefile  Fri Sep  1 20:38:20 2006
***
*** 2,9 
  #
  # The Japanese tutor exists in three encodings.  Use the UTF-8 version as the
  # original and create the others with conversion.
  
! all: tutor.ja.sjis tutor.ja.euc tutor.ko.euc
  
  tutor.ja.sjis: tutor.ja.utf-8
nkf -WXs tutor.ja.utf-8 > tutor.ja.sjis
--- 2,13 
  #
  # The Japanese tutor exists in three encodings.  Use the UTF-8 version as the
  # original and create the others with conversion.
+ #
+ # Similarly for Russian and Korean
  
! all: tutor.ja.sjis tutor.ja.euc \
!   tutor.ko.euc \
!   tutor.ru tutor.ru.cp1251
  
  tutor.ja.sjis: tutor.ja.utf-8
nkf -WXs tutor.ja.utf-8 > tutor.ja.sjis
***
*** 13,15 
--- 17,25 
  
  tutor.ko.euc: tutor.ko.utf-8
iconv -f UTF-8 -t EUC-KR tutor.ko.utf-8 > tutor.ko.euc
+ 
+ tutor.ru: tutor.ru.utf-8
+   iconv -f UTF-8 -t KOI8-R tutor.ru.utf-8 > tutor.ru
+ 
+ tutor.ru.cp1251: tutor.ru.utf-8
+   iconv -f UTF-8 -t cp1251 tutor.ru.utf-8 > tutor.ru.cp1251
*** ../vim-7.0.079/runtime/tutor/tutor.vim  Sat Mar 18 22:36:12 2006
--- runtime/tutor/tutor.vim Sat Sep  2 12:06:47 2006
***
*** 1,6 
  " Vim tutor support file
  " Author: Eduardo F. Amatria <[EMAIL PROTECTED]>
! " Last Change:2006 Mar 18
  
  " This small source file is used for detecting if a translation of the
  " tutor file exist, i.e., a tutor.xx file, where xx is the language.
--- 1,6 
  " Vim tutor support file
  " Author: Eduardo F. Amatria <[EMAIL PROTECTED]>
! " Last Change:2006 Sep 02
  
  " This small source file is used for detecting if a translation of the
  " tutor file exist, i.e., a tutor.xx file, where xx is the language.
***
*** 103,113 
let s:ext = ".sk.cp1250"
  endif
  
! " The Russian tutor is available in two encodings, guess which one to use.
! " This segment is from the above lines and modified by
! " Alexey I. Froloff <[EMAIL PROTECTED]> for Russian vim tutorial
! if s:ext =~? '\.ru' && &enc =~ 1251
!   let s:ext = ".ru.cp1251"
  endif
  
  " Somehow ".ge" (Germany) is sometimes used for ".de" (Deutsch).
--- 103,117 
let s:ext = ".sk.cp1250"
  endif
  
! " The Russian tutor is available in three encodings, guess which one to use.
! if s:ext =~? '\.ru'
!   if &enc == 'utf-8'
! let s:ext = '.ru.utf-8'
!   elseif &enc =~ '1251'
! let s:ext = '.ru.cp1251'
!   elseif &enc =~ 'koi8'
! let s:ext = '.ru'
!   endif
  endif
  
  " Somehow ".ge" (Germany) is sometimes used for ".de" (Deutsch).
*** ../vim-7.0.079/runtime/tutor/tutor.ru.utf-8 Sat Sep  2 14:53:18 2006
--- runtime/tutor/tutor.ru.utf-8Fri Sep  1 20:33:59 2006
***
*** 0 
--- 1,834 
+ 
===
+ =Д о б р о   п о ж а л о в а т ь   в   у ч е б н и 
к   VIM  -  Версия 1.5 =
+ 
===
+  Vim --- это очень мощный редактор, имеющий 
множество команд, слишком
+  много для того, чтобы их все можно было 
описать в таком учебнике, как
+  этот. Этот учебник призван объяснить 
достаточное число команд для того,
+  чтобы Вы могли с легкостью 
использовать Vim в качестве редактора общего
+  назначения.
+ 
+  Вам потребуется приблизительно 25-30 
минут на освоение данного учебника в
+  зависимости от того, сколько времени Вы 
потратите на эксперименты.
+ 
+  Команды в уроках будут модифицировать 
текст. Создайте копию этого файла,
+  чтобы попрактиковаться на ней (если Вы 
запустили "vimtutor", то это уже
+  копия).
+ 
+  Важно помнить, что этот учебник 
предназначен для обучения в процессе
+  использования. Это означает, что Вы 
должны запускать команды для того,
+  чтобы как следует их изучить. Если Вы 
просто прочитаете те

Re: Syntax matching. extend inside normal inside keepend

2006-09-02 Thread Yakov Lerner

On 9/2/06, Ilya <[EMAIL PROTECTED]> wrote:

Hello.

I have a question regarding syntax matching.  I have some kind of syntax
and I have some solution to highlight it, but it does not work the way I
expect it to.

What I want:  match syntax that consists of blocks (enclosed in {}),
strings (enclosed in "") and identifiers (starts with ${ and ends with
}).  Block end should also end any string that starts inside this block.

My solution:

:syn cluster Top contains=Block,String,Identifier
:syn region Block start=+{+ end=+}+ keepend extend [EMAIL PROTECTED]
:syn region String start=+"+ end=+"+ contains=Identifier
:syn region Identifier start=+\${+ end=+}+ extend

Here is a sample that shows that this solution does not work:

{
  "string ${var} string"
}

For some reason an Identifier region ends a String region and a second
word 'string' is not highlighted as a string (and Vim says that it has
Block match there).

Question: why the String region is not restored after the Identifier
region ends?


When I removed both 'keepend' and 'extend', it
started to work as expected.

With ''kepend extend', it
apparently takes identifier-closing brace for a
block-closing brace. I don't know why.

You might also try another solution: the 'syn match'
for identifier  instead of region.

Yakov


Re: [PATCH] russian vimtutor is b0rken in UTF-8 locale

2006-09-02 Thread Bram Moolenaar

Alexey Froloff wrote:

> * Bram Moolenaar  [060902 00:28]:
> > > Better solution: keep tutor.ru.utf-8, generate .cp1251 and .koi8
> > > From it and detect all encodings in tutor.vim.  vimtutor will
> > > fall back to english in "unsupported" locales (ru_RU.ISO8859-5)
> > > for example.
> > I checked the existing Russian tutor files, and they are exactly the
> > same when converted to utf-8.  Thus we can use the utf-8 file as the
> > master and generate the others from it.
> In this case only tutor.ru.utf-8 shall be kept in source tree.  I
> guess it can't be done right now since patch will be to big.
> 
> New patch attached, should be included in next release.

Thanks.  I notice you rename tutor.ru to tutor.ru.koi8.  Is there
anything against keeping the old name?  Just to avoid a big diff that
doesn't change much.

-- 
DINGO: Wicked wicked Zoot ... she is a bad person and she must pay the
   penalty.  And here in Castle Anthrax, we have but one punishment
   ... you must tie her down on a bed ... and spank her.  Come!
GIRLS: A spanking!  A spanking!
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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: session-file problem in presence of 'set acd'

2006-09-02 Thread Bram Moolenaar

Yakov Lerner wrote:

> > Don't keep 'autochdir' set all the time, some things won't work.
> 
> Hmmm why, I always been having 'set acd' in my .vimrc for years;
> and everyhing works just fine. It's convenient. I never had problems.

At least a few plugins don't work with 'acd'.  Some of them got fixed
and/or perhaps you don't use them.

-- 
DINGO:   And after the spanking ... the oral sex.
GALAHAD: Oh, dear! Well, I...
GIRLS:   The oral sex ...  The oral sex.
GALAHAD: Well, I suppose I could stay a BIT longer.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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///


Patch 7.0.077

2006-09-02 Thread Bram Moolenaar

Patch 7.0.077
Problem:":unlet v:this_session" causes a crash. (Marius Roets)
Solution:   When trying to unlet a fixed variable give an error message.
Files:  src/eval.c


*** ../vim-7.0.076/src/eval.c   Tue Aug 29 21:59:25 2006
--- src/eval.c  Sat Sep  2 13:43:20 2006
***
*** 701,706 
--- 701,707 
  static void list_one_var_a __ARGS((char_u *prefix, char_u *name, int type, 
char_u *string));
  static void set_var __ARGS((char_u *name, typval_T *varp, int copy));
  static int var_check_ro __ARGS((int flags, char_u *name));
+ static int var_check_fixed __ARGS((int flags, char_u *name));
  static int tv_check_lock __ARGS((int lock, char_u *name));
  static void copy_tv __ARGS((typval_T *from, typval_T *to));
  static int item_copy __ARGS((typval_T *from, typval_T *to, int deep, int 
copyID));
***
*** 3364,3369 
--- 3365,3372 
hi = hash_find(ht, varname);
if (!HASHITEM_EMPTY(hi))
{
+   if (var_check_fixed(HI2DI(hi)->di_flags, name))
+   return FAIL;
if (var_check_ro(HI2DI(hi)->di_flags, name))
return FAIL;
delete_var(ht, hi);
***
*** 17818,17824 
  }
  
  /*
!  * Return TRUE if di_flags "flags" indicate read-only variable "name".
   * Also give an error message.
   */
  static int
--- 17821,17827 
  }
  
  /*
!  * Return TRUE if di_flags "flags" indicates variable "name" is read-only.
   * Also give an error message.
   */
  static int
***
*** 17834,17839 
--- 17837,17859 
  if ((flags & DI_FLAGS_RO_SBX) && sandbox)
  {
EMSG2(_(e_readonlysbx), name);
+   return TRUE;
+ }
+ return FALSE;
+ }
+ 
+ /*
+  * Return TRUE if di_flags "flags" indicates variable "name" is fixed.
+  * Also give an error message.
+  */
+ static int
+ var_check_fixed(flags, name)
+ int   flags;
+ char_u*name;
+ {
+ if (flags & DI_FLAGS_FIX)
+ {
+   EMSG2(_("E795: Cannot delete variable %s"), name);
return TRUE;
  }
  return FALSE;
*** ../vim-7.0.076/src/version.cTue Aug 29 22:35:11 2006
--- src/version.c   Sat Sep  2 13:39:36 2006
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 77,
  /**/

-- 
### Hiroshima 45, Chernobyl 86, Windows 95 ###

 /// 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///


Patch 7.0.078

2006-09-02 Thread Bram Moolenaar

Patch 7.0.078
Problem:There are two error messages E46.
Solution:   Change the number for the sandbox message to E794.
Files:  src/globals.h


*** ../vim-7.0.077/src/globals.hSun Apr 30 20:32:38 2006
--- src/globals.h   Sat Sep  2 13:12:55 2006
***
*** 1441,1447 
  EXTERN char_u e_readonly[]INIT(= N_("E45: 'readonly' option is set (add ! 
to override)"));
  #ifdef FEAT_EVAL
  EXTERN char_u e_readonlyvar[] INIT(= N_("E46: Cannot change read-only 
variable \"%s\""));
! EXTERN char_u e_readonlysbx[] INIT(= N_("E46: Cannot set variable in the 
sandbox: \"%s\""));
  #endif
  #ifdef FEAT_QUICKFIX
  EXTERN char_u e_readerrf[]INIT(= N_("E47: Error while reading 
errorfile"));
--- 1441,1447 
  EXTERN char_u e_readonly[]INIT(= N_("E45: 'readonly' option is set (add ! 
to override)"));
  #ifdef FEAT_EVAL
  EXTERN char_u e_readonlyvar[] INIT(= N_("E46: Cannot change read-only 
variable \"%s\""));
! EXTERN char_u e_readonlysbx[] INIT(= N_("E794: Cannot set variable in the 
sandbox: \"%s\""));
  #endif
  #ifdef FEAT_QUICKFIX
  EXTERN char_u e_readerrf[]INIT(= N_("E47: Error while reading 
errorfile"));
*** ../vim-7.0.077/src/version.cSat Sep  2 13:45:01 2006
--- src/version.c   Sat Sep  2 14:08:12 2006
***
*** 668,669 
--- 668,671 
  {   /* Add new patch number below this line */
+ /**/
+ 78,
  /**/

-- 
"Intelligence has much less practical application than you'd think."
  -- Scott Adams, Dilbert.

 /// 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: Fixing cweb.vim

2006-09-02 Thread Benji Fisher
On Sat, Sep 02, 2006 at 01:36:06AM +0300, Ilya wrote:
> Benji Fisher wrote:
> >On Fri, Sep 01, 2006 at 09:36:55AM +0300, Ilya wrote:
> >  
> >>David Brown wrote:
> >>
> >[...]
> >  
> >>>However, tex.vim frequently will enclose large sections of the document
> >>>within a region and the cweb.vim which the webCRegion is not part of.
> >>>
> >>>I think I can fix this by adding an appropriate containedin=... field to
> >>>the definition of webCRegion.
> >>>
> >>>What I'm having difficulty with is figuring out what to put there.  Is
> >>>there a way of finding out what region a given part of the buffer is in?
> >>>  
> >>From :help synID
> >>  
> >>   Example (echoes the name of the syntax item under the cursor): >
> >>   :echo synIDattr(synID(line("."), col("."), 1), "name")
> >>
> >
> > IIUC, synIDattr() always returns a syn-match or syn-keyword group.
> >It does not tell you whether you are in a syn-region.
> >
> >HTH  --Benji Fisher
> >  
> It does return region names for me.

 So it does, but only if there is no active match nor keyword at the
cursor.  What I should have said is that synIDattr() (or maybe I should
say synID()) reports only the "innermost" syntax item at the cursor.
For example,

:help r
:normal 6j0
:echo synIDattr(synID(line("."), col("."), 1), "name")

reports helpLesdBlank but does not mention that this syn-match (defined
with "contained") is inside a helpExample syn-region.  (Verify this by
moving the cursor to the first non-blank on the lins.)

 In brief, synID() *sometimes* reports the current syn-region, and I
do not think this is good enough for David Brown's purposes.

HTH --Benji Fisher