Hi Tony,

That's fine, thanks. When I have some time, I'll try and have a look at the
script in detail.
If I have further questioning I'll then directly contact the maintainer.

Regards,
Julien




Internet
[EMAIL PROTECTED] - 07/18/2006 01:52 PM



To:    Julien 3 NGUYEN

cc:    drchip, vim


Subject:    Re: ftplugin not detected

[EMAIL PROTECTED] wrote:
> Hi Tony and Chip,
>
> Yes indeed. When processing with my test there was a local $HOME/.vimrc
> file.
>
> First case: without line "filetype plugin on" in $HOME/.vimrc file.
>
> Second case: with line "filetype plugin on" in $HOME/.vimrc file.
>
> In both cases: no $HOME/.vim/filetype.vim file and no file in
> $HOME/.vim/ftplugin directory.
>
> In the first case, the Ctrl-] shortcut calls the tag in my ./tags file.
The
> :verbose map <C-]> echos:
> "No mapping found"
> on the command line.
>
> In the second case, the Ctrl-] shortcut echos ":call JumpToTag_ada('')"
on
> the command line. The :verbose map <C-]> echos:
> "n  <C-]>       *@:call JumpToTag_ada('')<CR>"
> on the command line.
>
> JumpToTag() lies in the default ada ftplugin:
>
> $ grep -n -R JumpToTag_ada /usr/share/vim/
> /usr/share/vim/vim63/ftplugin/ada.vim:37:  nnoremap <unique> <buffer>
<C-]>
> :call JumpToTag_ada('')<cr>
> /usr/share/vim/vim63/ftplugin/ada.vim:40:  nnoremap <unique> <buffer>
> g<C-]>   :call JumpToTag_ada('','stj')<cr>
> /usr/share/vim/vim63/ftplugin/ada.vim:168:function!
JumpToTag_ada(word,...)
>
> So in the first case, the <C-]> was no particular mapping but the default
> behaviour which works.
> In the second case, the <C-]> is mapped to the special function
> JumpToTag_ada() from $VIMRUNTIME/ftplugin/ada.vim filetype plugin file.
>
> That function is:
>
> function! JumpToTag_ada(word,...)
>   if a:word == ''
>     " Get current word
>     let word = AdaWord()
>     if word == ''
>       return
>     endif
>   else
>     let word = a:word
>   endif
>   if a:0 > 0
>     let mode = a:1
>   else
>     let mode = 'tj'
>   endif
>
>   let v:errmsg = ''
>   execute 'silent!' mode word
>   if v:errmsg != ''
>     if v:errmsg =~ '^E426:'  " Tag not found
>       let ignorecase = &ignorecase
>       set ignorecase
>       execute mode word
>       let &ignorecase = ignorecase
>     else
>       " Repeat to give error
>       execute mode word
>     endif
>   endif
> endfunction
> if mapcheck('<C-]>','n') == ''
>   nnoremap <unique> <buffer> <C-]>    :call JumpToTag_ada('')<cr>
> endif
>
> which is supposed to call ":tj" on the word under the cursor.
> The word under the cursor is indeed the right one. I called an "word =
> AdaWord(); echo word" to be sure.
> The bug is in the function JumpToTag_ada().
>
> To convince everyone, I added the following lines in my local ada.vim
> ftplugin file (which overwrites that of $VIMRUNTIME)):
>
> function! GetToTag(...)
>     let word = AdaWord()
>     execute "tj" word
> endfunction
> noremap <unique> <buffer> <C-]> :call GetToTag()<cr>
>
> Those lines make everything work fine. So the few lines of
JumpToTag_ada()
> seem to be bugged.
> What to you think?
>
> Regards,
> Julien

Mappings defined in an ftplugin ought, for sanity, to have the <buffer>
attribute so they don't interfere with other filetypes. If the mapping
defined by the ada ftplugin remains active even when the active cursor
is in a file of a different filetype, then IMHO it's a bug in the ada
ftplugin and in that case you should contact its maintainer (look for a
comment near the top of $VIMRUNTIME/ftplugin/ada.vim).

OTOH, if you experience the disturbing behaviour _only_ when editing an
ada source file, then it could be either a "bug" or a "feature". In that
case, since I don't know ada myself, I'm not qualified to offer an opinion.


Best regards,
Tony.



This message and any attachments (the "message") is
intended solely for the addressees and is confidential. 
If you receive this message in error, please delete it and 
immediately notify the sender. Any use not in accord with 
its purpose, any dissemination or disclosure, either whole 
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message. 
BNP PARIBAS (and its subsidiaries) shall (will) not 
therefore be liable for the message if modified. 

                ---------------------------------------------

Ce message et toutes les pieces jointes (ci-apres le 
"message") sont etablis a l'intention exclusive de ses 
destinataires et sont confidentiels. Si vous recevez ce 
message par erreur, merci de le detruire et d'en avertir 
immediatement l'expediteur. Toute utilisation de ce 
message non conforme a sa destination, toute diffusion 
ou toute publication, totale ou partielle, est interdite, sauf 
autorisation expresse. L'internet ne permettant pas 
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce 
message, dans l'hypothese ou il aurait ete modifie.

Reply via email to