Scheme language: why is ? not in word definition

0 views
Skip to first unread message

Sven

unread,
Jan 3, 2010, 11:24:23 AM1/3/10
to vim_use
Hi all.

If I use * or C-W+] in a Scheme program file, the character ? is not
included
in the selected word.
What am I doing wrong? (vim 7.2.323)

Sven

Gary Johnson

unread,
Jan 3, 2010, 4:01:58 PM1/3/10
to vim_use

I don't know. ? should be added to 'iskeyword' in
$VIMRUNTIME/ftplugin/lisp.vim, which is sourced by
$VIMRUNTIME/ftplugin/scheme.vim. Do you have filetype plugins
enabled, e.g., with

filetype plugin on

in your ~/.vimrc? What does

:verbose set ft?

show when you edit a Scheme file?

Regards,
Gary


hart...@gmail.com

unread,
Jan 4, 2010, 1:28:14 AM1/4/10
to vim...@googlegroups.com
Hi.

Sun, 3 Jan 2010 13:01:58 -0800, garyjohn wrote:
>> If I use * or C-W+] in a Scheme program file, the character ? is not
>> included in the selected word.

Sorry, my description was wrong:
* works, but C-W+] (e.g. on "noun?") leads to:

E426: tag not found: noun\?

Note the escape \.

> I don't know. ? should be added to 'iskeyword' in
> $VIMRUNTIME/ftplugin/lisp.vim, which is sourced by
> $VIMRUNTIME/ftplugin/scheme.vim.

Yes, iskeyword is correctly set:

:verbose set isk (in a Scheme buffer)

iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_
Last set from /usr/local/share/vim/vim72/syntax/scheme.vim


Greetings
Sven

Gary Johnson

unread,
Jan 4, 2010, 2:16:01 AM1/4/10
to vim...@googlegroups.com
On 2010-01-04, hart...@gmail.com wrote:
> Hi.
>
> Sun, 3 Jan 2010 13:01:58 -0800, garyjohn wrote:
> >> If I use * or C-W+] in a Scheme program file, the character ? is not
> >> included in the selected word.
>
> Sorry, my description was wrong:
> * works, but C-W+] (e.g. on "noun?") leads to:
>
> E426: tag not found: noun\?
>
> Note the escape \.

It does that for C-], too, but as you say, it seems to do the right
thing for *. I don't know why. Maybe a bug?

Regards,
Gary


Sergey Khorev

unread,
Jan 5, 2010, 8:26:17 AM1/5/10
to vim...@googlegroups.com, vim_dev, Bram Moolenaar
Hi,

> It does that for C-], too, but as you say, it seems to do the right
> thing for *.  I don't know why.  Maybe a bug?

Yes, for some reason Vim always escapes some special characters even
if we are not going to pass them to a shell or regexp-using command.
So ":tag ident?" will work but ^] on "ident?" won't.

Below is a patch to fix that.

*** ../vim72.323/src/normal.c Thu Dec 24 19:20:14 2009
--- src/normal.c Tue Jan 5 16:19:38 2010
***************
*** 5409,5414 ****
--- 5409,5415 ----
char_u *aux_ptr;
int isman;
int isman_s;
+ int tag_cmd = FALSE;

if (cap->cmdchar == 'g') /* "g*", "g#", "g]" and "gCTRL-]" */
{
***************
*** 5515,5520 ****
--- 5516,5522 ----
break;

case ']':
+ tag_cmd = TRUE;
#ifdef FEAT_CSCOPE
if (p_cst)
STRCPY(buf, "cstag ");
***************
*** 5526,5535 ****
default:
if (curbuf->b_help)
STRCPY(buf, "he! ");
- else if (g_cmd)
- STRCPY(buf, "tj ");
else
! sprintf((char *)buf, "%ldta ", cap->count0);
}

/*
--- 5528,5541 ----
default:
if (curbuf->b_help)
STRCPY(buf, "he! ");
else
! {
! tag_cmd = TRUE;
! if (g_cmd)
! STRCPY(buf, "tj ");
! else
! sprintf((char *)buf, "%ldta ", cap->count0);
! }
}

/*
***************
*** 5562,5567 ****
--- 5568,5575 ----
aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
else if (cmdchar == '#')
aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
+ else if (tag_cmd)
+ aux_ptr = (char_u *)"\\|\"\n[";
else
/* Don't escape spaces and Tabs in a tag with a backslash */
aux_ptr = (char_u *)"\\|\"\n*?[";

hart...@gmail.com

unread,
Jan 6, 2010, 3:18:04 AM1/6/10
to vim...@googlegroups.com, sergey...@gmail.com, br...@moolenaar.net
Tue, 5 Jan 2010 16:26:17 +0300, sergey.khorev wrote:

> Yes, for some reason Vim always escapes some special characters even
> if we are not going to pass them to a shell or regexp-using command.
> So ":tag ident?" will work but ^] on "ident?" won't.
> Below is a patch to fix that.

Thanks for the patch. It works perfectly for me and
makes Scheme programmers happy VIM users again :-)

Reply all
Reply to author
Forward
0 new messages