netbeans connection when Vim is not compiled with netbeans_intg

136 views
Skip to first unread message

Xavier de Gaye

unread,
Oct 18, 2008, 4:23:21 PM10/18/08
to vim-dev, clewn, Frans Oliehoek
When an application forks a Vim that is not compiled with the
netbeans_intg feature, the application waits for Vim to establish the
socket connection and Vim silently ignores the "-nb" command line
argument. It is difficult for the user to understand what is wrong.

The attached patch causes Vim to exit with an error message when it is
invoked with "-nb" and not compiled with the netbeans_intg feature.
This is already what is happening when the diff feature is missing and
vim is invoked as vimdiff.

Xavier

netbeans_connection.diff

Bram Moolenaar

unread,
Nov 6, 2008, 11:14:25 AM11/6/08
to Xavier de Gaye, vim-dev, clewn, Frans Oliehoek

Xavier de Gaye wrote:

The idea looks right: using -nb when it's not supported should make Vim
quit.

The place where you invoke mch_exit() looks a bit weird. Not sure if
this is the best solution. And when compiled without GUI (e.g.,
starting a small version of Vim) this exit won't be reached. Would
someone only use -nb with gvim?

The message should be defined in one place, not twice.

--
hundred-and-one symptoms of being an internet addict:
193. You ask your girlfriend to drive home so you can sit back with
your PDA and download the information to your laptop

/// Bram Moolenaar -- Br...@Moolenaar.net -- 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 ///

Xavier de Gaye

unread,
Nov 6, 2008, 2:35:21 PM11/6/08
to Bram Moolenaar, vim-dev, clewn, Frans Oliehoek
On Thu, Nov 6, 2008 at 5:14 PM, Bram Moolenaar <Br...@moolenaar.net> wrote:
>
> Xavier de Gaye wrote:
>
>> When an application forks a Vim that is not compiled with the
>> netbeans_intg feature, the application waits for Vim to establish the
>> socket connection and Vim silently ignores the "-nb" command line
>> argument. It is difficult for the user to understand what is wrong.
>>
>> The attached patch causes Vim to exit with an error message when it is
>> invoked with "-nb" and not compiled with the netbeans_intg feature.
>> This is already what is happening when the diff feature is missing and
>> vim is invoked as vimdiff.
>
> The idea looks right: using -nb when it's not supported should make Vim
> quit.
>
> The place where you invoke mch_exit() looks a bit weird. Not sure if
> this is the best solution. And when compiled without GUI (e.g.,
> starting a small version of Vim) this exit won't be reached. Would
> someone only use -nb with gvim?
>
> The message should be defined in one place, not twice.

Right of course. I will try sending another patch fixing these points.

BTW do you think an implementation of netbeans over Vim console is
acceptable as a Vim patch (as opposed to an external patch such as
those in http://groups.google.com/group/vim_dev/web/vim-patches).


Xavier

Bram Moolenaar

unread,
Nov 8, 2008, 8:24:09 AM11/8/08
to Xavier de Gaye, vim-dev, clewn, Frans Oliehoek

Xavier de Gaye wrote:

> >> When an application forks a Vim that is not compiled with the
> >> netbeans_intg feature, the application waits for Vim to establish the
> >> socket connection and Vim silently ignores the "-nb" command line
> >> argument. It is difficult for the user to understand what is wrong.
> >>
> >> The attached patch causes Vim to exit with an error message when it is
> >> invoked with "-nb" and not compiled with the netbeans_intg feature.
> >> This is already what is happening when the diff feature is missing and
> >> vim is invoked as vimdiff.
> >
> > The idea looks right: using -nb when it's not supported should make Vim
> > quit.
> >
> > The place where you invoke mch_exit() looks a bit weird. Not sure if
> > this is the best solution. And when compiled without GUI (e.g.,
> > starting a small version of Vim) this exit won't be reached. Would
> > someone only use -nb with gvim?
> >
> > The message should be defined in one place, not twice.
>
> Right of course. I will try sending another patch fixing these points.

Good, thanks.

> BTW do you think an implementation of netbeans over Vim console is
> acceptable as a Vim patch (as opposed to an external patch such as
> those in http://groups.google.com/group/vim_dev/web/vim-patches).

If you can make the netbeans interface work for a Vim running in a
console, that sounds like a useful feature. I would include it if it
works properly. However, some programs using the netbeans interface
assume GUI features, such as menus. Thus it's probably only useful
for some applications.

--
hundred-and-one symptoms of being an internet addict:

207. You're given one phone call in prison and you ask them for a laptop.

Xavier de Gaye

unread,
Nov 8, 2008, 11:12:21 AM11/8/08
to Bram Moolenaar, vim-dev, clewn, Frans Oliehoek
On Sat, Nov 8, 2008 at 2:24 PM, Bram Moolenaar <Br...@moolenaar.net> wrote:
>> > ...

>> > The place where you invoke mch_exit() looks a bit weird. Not sure if
>> > this is the best solution. And when compiled without GUI (e.g.,
>> > starting a small version of Vim) this exit won't be reached. Would
>> > someone only use -nb with gvim?
>> >
>> > The message should be defined in one place, not twice.
>>
>> Right of course. I will try sending another patch fixing these points.
>
> Good, thanks.

Attached is a patch that fixes the above issues. It's on top of
version 7.2.28 (subversion revision 1226).


>> BTW do you think an implementation of netbeans over Vim console is
>> acceptable as a Vim patch (as opposed to an external patch such as
>> those in http://groups.google.com/group/vim_dev/web/vim-patches).
>
> If you can make the netbeans interface work for a Vim running in a
> console, that sounds like a useful feature. I would include it if it
> works properly. However, some programs using the netbeans interface
> assume GUI features, such as menus. Thus it's probably only useful
> for some applications.

I will give it a try.


Xavier

netbeans_connection_2.diff

sc

unread,
Nov 8, 2008, 1:10:22 PM11/8/08
to vim...@googlegroups.com
On Saturday 08 November 2008 10:12 am, Xavier de Gaye wrote:
> On Sat, Nov 8, 2008 at 2:24 PM, Bram Moolenaar <Br...@moolenaar.net> wrote:
> >> > ...
> >> > The place where you invoke mch_exit() looks a bit weird. Not sure if
> >> > this is the best solution. And when compiled without GUI (e.g.,
> >> > starting a small version of Vim) this exit won't be reached. Would
> >> > someone only use -nb with gvim?
> >> >
> >> > The message should be defined in one place, not twice.
> >>
> >> Right of course. I will try sending another patch fixing these points.
> >
> > Good, thanks.
>
> Attached is a patch that fixes the above issues. It's on top of
> version 7.2.28 (subversion revision 1226).

I hope the above is a typo -- for me subversion reports revision 1226
while vim is at 7.2.26

sc

sc

unread,
Nov 8, 2008, 1:14:31 PM11/8/08
to vim...@googlegroups.com
On Saturday 08 November 2008 10:12 am, Xavier de Gaye wrote:
> On Sat, Nov 8, 2008 at 2:24 PM, Bram Moolenaar <Br...@moolenaar.net> wrote:
> >> > ...
> >> > The place where you invoke mch_exit() looks a bit weird. Not sure if
> >> > this is the best solution. And when compiled without GUI (e.g.,
> >> > starting a small version of Vim) this exit won't be reached. Would
> >> > someone only use -nb with gvim?
> >> >
> >> > The message should be defined in one place, not twice.
> >>
> >> Right of course. I will try sending another patch fixing these points.
> >
> > Good, thanks.
>
> Attached is a patch that fixes the above issues. It's on top of
> version 7.2.28 (subversion revision 1226).

oops -- please forgive the double post -- I so often hit Send and
then engage my brain

revision 1226 did indeed update my source to 7.2.28 but as it
stands it will not compile for me (already noted in a previous
post)

sc

Xavier de Gaye

unread,
Nov 9, 2008, 5:38:18 AM11/9/08
to vim...@googlegroups.com

Right, to compile Vim I had to comment out lines 656/657 in ex_cmds.h.

Xavier

Tony Mechelynck

unread,
Nov 9, 2008, 2:18:11 PM11/9/08
to vim...@googlegroups.com

There was an error in patch 7.2.027 (corrected in 7.2.030 and improved
in 7.2.031) which caused compile errors. If you upgrade to the current
source it ought to work.


Best regards,
Tony.
--
According to Kentucky state law, every person must take a bath at least
once a year.

sc

unread,
Nov 9, 2008, 3:45:27 PM11/9/08
to vim...@googlegroups.com
On Sunday 09 November 2008 1:18 pm, Tony Mechelynck wrote:
[snip]

> There was an error in patch 7.2.027 (corrected in 7.2.030 and improved
> in 7.2.031) which caused compile errors. If you upgrade to the current
> source it ought to work.

for whatever reason, svn is lagging behind posted patches -- if, like me,
Xavier is waiting on svn, he is stuck at 7.2.28 (since Nov 6)

this is fine for us, but if a newbie comes along expecting to build the
latest and greatest vim by following instructions, he's going to wind up
with sources that won't build -- not good, unless he has the perseverence
to browse this group -- what he'll use to find Xavier's kind response to my
whining I'm not sure, I just hope the experience doesn't turn him into
an emacs user

sc

Tony Mechelynck

unread,
Nov 9, 2008, 4:13:00 PM11/9/08
to vim...@googlegroups.com

Vim SVN is always lagging (sometimes by a week or two) behind CVS. OTOH
the patches appear on the FTP server (and, I think, on CVS which I don't
use) about as fast as they are published on vim_dev. I'm not sure about
A-A-P but I think it uses CVS too. So it's just a question of which
instructions to follow.

On Windows, a newbie doesn't need to build Vim himself (he can just grab
Steve Hall's "cream-less" Vim distributions on sourceforge) so the
question arises mostly on Unix-like systems. As shown on my HowTo page,
what I use is FTP for code and rsync for runtimes: this way I remain
up-to-date. In the rare cases when the FTP site has a hiccup and the
patches don't appear there in timely fashion, I grab the vim_dev post
and check that it has "Content-Transfer-Encoding: 8bit" (or 7bit).
Quoted-printable is not as easy, it must be "doctored" by hand, but it's
doable.

Best regards,
Tony.
--
Friends, Romans, Hipsters,
Let me clue you in;
I come to put down Caesar, not to groove him.
The square kicks some cats are on stay with them;
The hip bits, like, go down under; so let it lay with Caesar. The cool
Brutus
Gave you the message: Caesar had big eyes;
If that's the sound, someone's copping a plea,
And, like, old Caesar really set them straight.
Here, copacetic with Brutus and the studs, -- for Brutus is a real cool cat;
So are they all, all cool cats, --
Come I to make this gig at Caesar's laying down.

Xavier de Gaye

unread,
Apr 26, 2009, 12:39:12 PM4/26/09
to Bram Moolenaar, vim-dev
On Sat, Nov 8, 2008 at 6:12 PM, Xavier de Gaye wrote:
> ...

>>> BTW do you think an implementation of netbeans over Vim console is
>>> acceptable as a Vim patch (as opposed to an external patch such as
>>> those in http://groups.google.com/group/vim_dev/web/vim-patches).
>>
>> If you can make the netbeans interface work for a Vim running in a
>> console, that sounds like a useful feature. I would include it if it
>> works properly. However, some programs using the netbeans interface
>> assume GUI features, such as menus. Thus it's probably only useful
>> for some applications.
>
> I will give it a try.


Attached is a patch that allows Vim to support NetBeans when run in a
terminal. The patch is based on Vim 7.2.160, subversion revision 1440.

Problem: Support the NetBeans interface when Vim is run in a
terminal on Unix.
Solution: Hook the NetBeans file descriptor to the event loop.
Add a backward compatible enhancement: the defineAnnoType
"fg" and "bg" color arguments may also be defined as color
names.
Files: runtime/doc/netbeans.txt src/netbeans.c src/ex_cmds.c
src/proto/netbeans.pro src/gui.c src/getchar.c
src/gui_w48.c src/feature.h src/main.c src/proto.h
src/gui_gtk_x11.c src/os_unix.c

List of the tests that have been run (the pyclewn testsuite is about
50 tests):
Check that a NetBeans session started in a terminal can be
continued after the ":gui" command is run.
Run pyclewn testsuite with GVim compiled with the GTK gui.
Run pyclewn testsuite with Vim in a terminal, compiled with the
GTK gui.
Run pyclewn testsuite with Vim compiled without any gui.

Issue not fixed (not worth fixing ?):
When Vim NetBeans runs in a terminal and the ':gui' command is run
and if the GUI is not one of GTK, GNOME, Motif or Win32, then
NetBeans silently stops working.


Xavier

vim7_nbconsole.patch

Bram Moolenaar

unread,
Apr 26, 2009, 5:13:31 PM4/26/09
to Xavier de Gaye, vim-dev

Xavier de Gaye wrote:

Thanks, sounds good. I'll have a better look later. I would appreciate
feedback from others.

--
FATHER: You killed eight wedding guests in all!
LAUNCELOT: Er, Well ... the thing is ... I thought your son was a lady.
FATHER: I can understand that.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

Xavier de Gaye

unread,
Jan 2, 2010, 12:40:51 PM1/2/10
to Bram Moolenaar, vim-dev


Hi Bram,

I have setup a Mercurial Queues patch at
http://pyclewn.sourceforge.net/vim-patches.html
It will be easier to test this patch and pyclewn 1.1 can now run with
Vim in a console.

The major change from the patch I sent last April, is that netbeans
version has been increased to "2.5".

Using Mercurial Queues for Vim patches, brings the following advantages:

* the patch can be kept in sync with Vim development source tree
* it is easy to test the patch with Vim development source tree
* at any time, one can remove the patch with 'hg qpop'

I will keep this patch in sync with Vim development source tree.


Xavier

Bram Moolenaar

unread,
Jan 6, 2010, 11:41:48 AM1/6/10
to Xavier de Gaye, vim-dev

Xavier de Gaye wrote:

I'll move this up in the todo list.

--
From "know your smileys":
:-)-O Smiling doctor with stethoscope

Xavier de Gaye

unread,
Jan 10, 2010, 8:47:42 AM1/10/10
to vim-dev, pyclewn
On Sat, Jan 2, 2010 at 6:40 PM, Xavier de Gaye wrote:
>
> I have setup a Mercurial Queues patch at
> http://pyclewn.sourceforge.net/vim-patches.html
> It will be easier to test this patch and pyclewn 1.1 can now run with
> Vim in a console.
>


The documentation at

http://pyclewn.sourceforge.net/vim-patches.html

has been updated with using Vim Mercurial repository instead of
a Mercurial repository built from subversion.


Xavier

Bram Moolenaar

unread,
Feb 11, 2010, 2:55:17 PM2/11/10
to Xavier de Gaye, vim-dev

Xavier de Gaye wrote:

> I have setup a Mercurial Queues patch at
> http://pyclewn.sourceforge.net/vim-patches.html
> It will be easier to test this patch and pyclewn 1.1 can now run with
> Vim in a console.
>
> The major change from the patch I sent last April, is that netbeans
> version has been increased to "2.5".
>
> Using Mercurial Queues for Vim patches, brings the following advantages:
>
> * the patch can be kept in sync with Vim development source tree
> * it is easy to test the patch with Vim development source tree
> * at any time, one can remove the patch with 'hg qpop'
>
> I will keep this patch in sync with Vim development source tree.

I had a brief look at the patch. It changes a lot of code, I'll need to
take more time to see what this actually changes.

You move the code to connect for different GUI versions to another
place, away from the disconnect code. I don't see a reason for this.
Why not keep it as it was?

--
If evolution theories are correct, humans will soon grow a third
hand for operating the mouse.

Xavier de Gaye

unread,
Feb 12, 2010, 8:27:50 AM2/12/10
to Bram Moolenaar, vim-dev
On Thu, Feb 11, 2010 at 8:55 PM, Bram Moolenaar wrote:
>
> You move the code to connect for different GUI versions to another
> place, away from the disconnect code. I don't see a reason for this.
> Why not keep it as it was?
>


Hi Bram,

netbeans_startup_done() has been split in two parts:
* netbeans_connect()
* a new function called netbeans_gui_register()

This is needed so that when the user is running netbeans in a vim
console, then netbeans is still available after the ":gui" command
is run and vim switches to the gui interface (requiring only a call
to netbeans_gui_register(), the socket being already connected).

I have put the code of netbeans_gui_register() close to
netbeans_startup_done() because they are related. But
netbeans_gui_register() can be moved up close to the disconnect code.

Xavier

Bram Moolenaar

unread,
Feb 14, 2010, 2:32:08 PM2/14/10
to Xavier de Gaye, vim-dev

Xavier de Gaye wrote:

I find it most important to keep the code for a specific GUI together,
if it's not too much hassle. So we have a block of code that's the
GUI-specific implementation of the netbeans interface. If one would add
another GUI most of the change would be to add another block here,
instead of making changes all over the place.

--
A computer without Windows is like a fish without a bicycle.

Reply all
Reply to author
Forward
0 new messages