[PATCH] implemented netbeans_intg

219 views
Skip to first unread message

Kazuki Sakamoto

unread,
Jun 25, 2009, 8:13:19 AM6/25/09
to vim...@googlegroups.com
Hi,

I have implemented `+netbeans_intg' for MacVim.
clewn has finally worked with MacVim!

http://clewn.sourceforge.net/

$ clewn
(gdb)

$ MacVim.app/Contents/MacOS/Vim -g -nb:localhost:3219

sakamoto

0001-implemented-netbeans_intg.patch
clewn.jpg

björn

unread,
Jun 25, 2009, 11:25:48 AM6/25/09
to vim...@googlegroups.com
2009/6/25 Kazuki Sakamoto:

Hi Sakamoto,

That's great! I think a lot of people will appreciate this.

I haven't tested the code yet but the patch looks good. I only have a
few (trivial) comments at the moment:

1. What happens if setNetbeansSocket: is called twice with "socket ==
-1"? Same thing if called with two different values for "socket"? (I
guess the way it is set up this will never happen but it doesn't hurt
to be a bit paranoid and make this more robust by freeing all
structures and setting them to nil before CFSocketCreate...() and
making sure you don't call CFRelease() twice on the same structure.)

2. Check whitespace in feature.h/netbeans.c -- you should use "set et"
in the core Vim source code files (at the moment there are spaces in
some places where there should be tabs).

Thanks for the patch,
Björn

björn

unread,
Jun 25, 2009, 11:27:55 AM6/25/09
to vim...@googlegroups.com
> 2. Check whitespace in feature.h/netbeans.c -- you should use "set et"
> in the core Vim source code files

Sorry, that was meant to read "set noet".

Björn

Kazuki Sakamoto

unread,
Jun 25, 2009, 5:45:07 PM6/25/09
to vim...@googlegroups.com
Hi Björn,

On Fri, Jun 26, 2009 at 12:25 AM, björn<bjorn.w...@gmail.com> wrote:

> That's great!  I think a lot of people will appreciate this.

Thanks! I am happy to hear that.

> I haven't tested the code yet but the patch looks good.  I only have a
> few (trivial) comments at the moment:
> 1. What happens if setNetbeansSocket: is called twice with "socket ==
> -1"?  Same thing if called with two different values for "socket"?  (I
> guess the way it is set up this will never happen but it doesn't hurt
> to be a bit paranoid and make this more robust by freeing all
> structures and setting them to nil before CFSocketCreate...() and
> making sure you don't call CFRelease() twice on the same structure.)

Ok, I have made sure it.

> 2. Check whitespace in feature.h/netbeans.c -- you should use "set et"
> in the core Vim source code files (at the moment there are spaces in
> some places where there should be tabs).

> Sorry, that was meant to read "set noet".

understand. I have fixed about whitespace as other lines.


By the way, we might need to implement `+balloon_eval' as well.
src/gui_beval.c

sakamoto

0001-implemented-netbeans_intg_2.patch

Nico Weber

unread,
Jun 25, 2009, 10:49:04 PM6/25/09
to vim...@googlegroups.com
Hi,

On 25.06.2009, at 14:45, Kazuki Sakamoto wrote:

> Hi Björn,
>
> On Fri, Jun 26, 2009 at 12:25 AM, björn<bjorn.w...@gmail.com>
> wrote:
>
>> That's great! I think a lot of people will appreciate this.
>
> Thanks! I am happy to hear that.

I'm very excited about this patch, too. Once it's in, it would be
great if there was a MacVim wiki page that has a few screenshots that
show what's possible with this patch, and links to the documentation
on how to set this up.

> By the way, we might need to implement `+balloon_eval' as well.
> src/gui_beval.c

I started looking at this a while ago, but then got sidetracked
working on the other "one background process per gui window/tab" mac
app :-/

My main "discovery" back then was that Cocoa's toolkit support
(there's a function to set a tooltip on a view) isn't quite good
enough for +baloon_eval: It doesn't support more than one tooltip at
once, and it's not easy to specify where it should appear.

However, it looks like the tooltip code from Camino could be used for
this. That's also what Chromium uses:

http://src.chromium.org/viewvc/chrome/trunk/src/third_party/mozilla/include/ToolTip.h
http://src.chromium.org/viewvc/chrome/trunk/src/third_party/mozilla/include/ToolTip.mm

If you want to take a shot at this, I can send you a few more notes
(i.e. where the code changes need to be made), but judging from your
netbean patch, it looks like you can figure that out yourself :-)

Nico

björn

unread,
Jun 26, 2009, 12:29:50 PM6/26/09
to vim...@googlegroups.com
Hi Sakamoto,

Thanks for the updated patch -- I have merged and pushed it now. I
did still change around -[MMBackend setNetbeansSocket:] a little bit
to fit the general programming style I use for setters in MacVim.
Please look over it and let me know if you have any objections. Other
than that I only made some cosmetic changes. All in all the patch
looks really good -- you seem to have come up with a very clean way to
integrate this with the inputQueue handling and everything. :-)

>
> By the way, we might need to implement `+balloon_eval' as well.
> src/gui_beval.c

I think that would be great -- do you think you'll look into it?


To test the patch out I installed clewn myself and this turned out to
be a bit of a pain. For everybody else who'd like to try this patch
out, here's what I did:

1. Download clewn from http://clewn.sourceforge.net
2. Open Terminal and cd to dir where you unpacked clewn, then

$ vimdir=$HOME/.vim ./configure --prefix=$HOME
$ make

and notice that this fails. It may fail on the configure step if you
don't have the readline library installed, but I already had that (if
you don't have it, you can get it from MacPorts with "sudo port
install readline").

The reason "make" fails is that the Makefile hasn't got the right
paths to the readline headers and library. Edit the Makefile as
follows: Add

-I/opt/local/include

to DEFAULT_INCLUDES on line 63 (assuming readline is installed with
MacPorts, otherwise change "/opt/local/include" for wherever readline
is). Next make sure it finds the library. Add

-L/opt/local/lib

to LDFLAGS on line 119 (again, assuming MacPorts was used to install readline).

After those changes you are good to go:

$ make
$ make install

That takes care of the installation of clewn.

3. Try it out, e.g. go to the src/ directory of MacVim and

$ clewn -ga './Vim'

In another Terminal window ("path/to/" should be the path to the
MacVim.app binary you built with netbeans support):

$ path/to/MacVim.app/Contents/MacOS/Vim -g -nb:localhost:3219

Back in the clewn Terminal window, type "break main" then "run" and
the source for main.c should appear in the MacVim window that opened
in the step above with a "=>" on the line where GDB has halted (at the
beginning of main()).

4. Use C-n for "next", S for "step", F for "finish", etc. See ":h
clewn" for more info.


That's it. Yes, I found that very complicated to get going.
Hopefully somebody could make a tutorial on how this should be done
and I can add it to the MacVim Google code page. It is supposed to be
possible to have clewn automatically open Vim for you, but I haven't
gotten that far yet.

Björn

Nico Weber

unread,
Jul 6, 2009, 3:01:34 PM7/6/09
to vim...@googlegroups.com
> My main "discovery" back then was that Cocoa's toolkit support
> (there's a function to set a tooltip on a view) isn't quite good
> enough for +baloon_eval: It doesn't support more than one tooltip at
> once, and it's not easy to specify where it should appear.
>
> However, it looks like the tooltip code from Camino could be used for
> this. That's also what Chromium uses:
>
> http://src.chromium.org/viewvc/chrome/trunk/src/third_party/mozilla/include/ToolTip.h
> http://src.chromium.org/viewvc/chrome/trunk/src/third_party/mozilla/include/ToolTip.mm

FWIW, looks like Chromium is back to native tooltips: http://codereview.chromium.org/150188

Nico

Bram Moolenaar

unread,
Jul 10, 2010, 2:15:47 PM7/10/10
to Kazuki Sakamoto, vim...@googlegroups.com

Kazuki Sakamoto wrote:

I finally had time to have a look at this patch. Most of the changes
are to files not in the normal Vim distribution. And most of the
changes to src/netbeans.c are rejected, other changes interfere.

Thus I won't include this now. If you would like Vim 7.3 to include
some of these changes, please send a new patch.

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

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

Reply all
Reply to author
Forward
0 new messages