[ANN] vimgdb 1.11

2007-05-30 Thread Xavier de Gaye
Hi all

Vimgdb 1.11 is a port of vimgb to Vim 7.1.

Vimgdb is a vim patch implemented as a vim optional feature that
provides full gdb support in the vim editor: breakpoints, watch
variables, gdb command completion, assembly windows, etc.

You can get vimgdb from http://clewn.sourceforge.net.

Xavier


--
http://clewn.sourceforge.net   gdb support in Vim


Re: [RFC] Add a new getAnno function to the netbeans protocol

2006-11-11 Thread Xavier de Gaye

--- Bram Moolenaar [EMAIL PROTECTED] wrote:
 Xavier de Gaye wrote:

  During the compile-debug-edit development cycle, the signs placed in
  the Vim buffers by the IDE with the netbeans protocol can have their
  line numbers changed when the buffers are edited (a Vim sign sticks with
  the line it has been set upon, and moves with it).
 
  It would be nice to allow the IDE to query Vim for these updated line
  numbers, so that when the IDE restarts gdb after a new make and the IDE
  is capable of restoring the breakpoints set on a previous session, the
  breakpoints and their corresponding signs can be automatically set by
  the IDE to their new position.
 
  The netbeans function documentation can be:
 
  ===
  10.4 Functions and Replies  *nb-functions*
 
  getAnno serNum  Return the line number of the annotation in the buffer
  Arguments:
 serNum  serial number of this placed annotation
  The reply is:
  lnum = line number of the annotation
  ===
 
 
  The implementation can be based on the existing sign_list_placed()
  function in buffer.c. I can propose a patch if this request for change
  is acceptable.

 It makes sense.  The only alternative is to listen to insert and
 delete messages to keep track of the position, which probably requires
 keeping a copy of the text.


Problem:Retrieving from Vim the signs positions set by the IDE
after they have been moved in the buffer.
Solution:   Add the netbeans getAnno function for getting the new
signs positions after a file has been edited.
Files:  src/netbeans.c


The following patch uses the E652 and E653 error codes that are
documented in netbeans.tx, but not used yet.

The patch has been tested with clewn in debug mode.



Index: runtime/doc/netbeans.txt
===
*** runtime/doc/netbeans.txt(revision 179)
--- runtime/doc/netbeans.txt(working copy)
***
*** 1,4 
! *netbeans.txt*  For Vim version 7.0.  Last change: 2006 Mar 09


  VIM REFERENCE MANUALby Gordon Prieur
--- 1,4 
! *netbeans.txt*  For Vim version 7.0.  Last change: 2006 Nov 08


  VIM REFERENCE MANUALby Gordon Prieur
***
*** 605,610 
--- 605,619 

  getMark   Not implemented.

+ getAnno serNum
+   Return the line number of the annotation in the buffer.
+   Argument:
+   serNum  serial number of this placed annotation
+   The reply may be:
+   123 lnumline number of the annotation
+   123 invalid annotation serial number
+   New in version 2.3.
+
  getModified   When a buffer is specified: Return zero if the buffer does not
have changes, one if it does have changes.
When no buffer is specified (buffer number zero): Return the


Index: src/netbeans.c
===
*** src/netbeans.c  (revision 179)
--- src/netbeans.c  (working copy)
***
*** 1271,1276 
--- 1271,1312 
nb_reply_text(cmdno, text);
  /* =*/
}
+   else if (streq((char *)cmd, getAnno))
+   {
+   int nilreply = 1;
+ #ifdef FEAT_SIGNS
+   int serNum;
+   long linenum;
+
+   if (buf == NULL || buf-bufp == NULL)
+   {
+   nbdebug((null bufp in getAnno));
+   EMSG(E652: null bufp in getAnno);
+   retval = FAIL;
+   }
+   else
+   {
+   cp = (char *)args;
+   serNum = strtol(cp, cp, 10);
+
+   linenum = (long)buf_findsign(buf-bufp, serNum);
+   if (linenum != 0)
+   {
+   nb_reply_nr(cmdno, linenum);
+   nilreply = 0;
+   }
+   else
+   {
+   nbdebug((invalid annotation number in getAnno));
+   EMSG(E653: invalid annotation number in getAnno);
+   retval = FAIL;
+   }
+   }
+ #endif
+   if (nilreply)
+   nb_reply_nil(cmdno);
+ /* =*/
+   }
else if (streq((char *)cmd, getLength))
{
long len = 0;



--
http://clewn.sourceforge.net   gdb support in Vim


Current buffer name after :python os.chdir()

2006-11-07 Thread Xavier de Gaye

Assuming the current buffer is the file 'foobar' in the current
directory. After running the following Vim commands:

:python import os
:python os.chdir(subdir)

the current buffer name is not changed as it is when you run
the Vim command ':cd subdir' (but the output of ':pwd' is Ok),
and when the following command is run afterwards:

:write

Vim writes the buffer to the file 'subdir/foobar', instead of the
original file.

This happens with Vim 7.0 compiled with Python 2.5.

Xavier

--
http://clewn.sourceforge.net   gdb support in Vim


[RFC] Add a new getAnno function to the netbeans protocol

2006-11-07 Thread Xavier de Gaye

During the compile-debug-edit development cycle, the signs placed in
the Vim buffers by the IDE with the netbeans protocol can have their
line numbers changed when the buffers are edited (a Vim sign sticks with
the line it has been set upon, and moves with it).

It would be nice to allow the IDE to query Vim for these updated line
numbers, so that when the IDE restarts gdb after a new make and the IDE
is capable of restoring the breakpoints set on a previous session, the
breakpoints and their corresponding signs can be automatically set by
the IDE to their new position.

The netbeans function documentation can be:

===
10.4 Functions and Replies  *nb-functions*

getAnno serNum  Return the line number of the annotation in the buffer
Arguments:
   serNum  serial number of this placed annotation
The reply is:
lnum = line number of the annotation
===


The implementation can be based on the existing sign_list_placed()
function in buffer.c. I can propose a patch if this request for change
is acceptable.

Xavier


--
http://clewn.sourceforge.net   gdb support in Vim


Re: Current buffer name after :python os.chdir()

2006-11-07 Thread Xavier de Gaye

--- Bram Moolenaar [EMAIL PROTECTED] wrote:

 Xavier de Gaye wrote:

  Assuming the current buffer is the file 'foobar' in the current
  directory. After running the following Vim commands:
 
  :python import os
  :python os.chdir(subdir)
 
  the current buffer name is not changed as it is when you run
  the Vim command ':cd subdir' (but the output of ':pwd' is Ok),
  and when the following command is run afterwards:
 
  :write
 
  Vim writes the buffer to the file 'subdir/foobar', instead of the
  original file.
 
  This happens with Vim 7.0 compiled with Python 2.5.

 Well, you should not use Python to change directory.  But it may happen
 unintentionally...  Checking the current directory after each :python
 command is a bit inefficient, but that's probably what needs to be done
 then.  An alternative is to always chdir back to where we were to undo
 the side effect of the Python command.


I am trying to use Vim as a python interpreter. So, I have mapped:

:map F4 :exe pyfile  . expand(%)CR

I edit some python stuff in a foobar file, and hit F4 to run it.

When the foobar file content is:

import os
os.chdir(subdir)

I run into the above problem.

It is probably safer to run python as:

:map F4 :exe !python  . expand(%)CR

But you lose the capability to do some investigation on the variables
contents after the script has run.

Xavier

--
http://clewn.sourceforge.net   gdb support in Vim


[ANN] Clewn and vimGdb 1.9

2006-08-27 Thread Xavier de Gaye

Hi all

Clewn and vimGdb 1.9 have been released.

The clewn project implements full gdb support in the vim editor:
breakpoints, watch variables, gdb command completion, assembly
windows, etc.

You can get clewn and vimGdb from http://clewn.sourceforge.net.


New features:

The 'restart' command allows to fork from clewn a fresh instance of
gdb while retaining the existing netbeans connection to vim.

Configuring the mapping of a vim key to a gdb command with clewn is
much simpler. Only one entry in the .clewn_keys file is needed now.
This requires vim 7.0 or above.

New command line arguments for clewn:
  -vc gvim_cmd  - gvim shell command or pathname to gvim
  -va gvim_args - gvim command line arguments
  -gc gdb_cmd   - gdb shell command or pathname to gdb
  -ga gdb_args  - gdb command line arguments


Changes:

When clewn exits, a 'saveAndExit' netbeans command is sent to vim.
This command performs the equivalent of closing vim with :confirm
qall.

When doing remote debugging with clewn, the parameter of the '-x'
command line argument, lists the pathname substitutions to be applied
from target to host and vice-versa.


Bug fixes:

Fix regression in level 2 mode with gdb 5.3, the breakpoints signs
cannot be set in vim.

Fix completion in the gdb console after having sourced the mswin.vim
macro.

Fix getting Command terminated for programs started by VIM, instead
of the shell exit status.


Xavier


--
http://clewn.sourceforge.net   gdb support in Vim


Forget the buf_T reference when processing a 'close' netbeans command

2006-08-03 Thread Xavier de Gaye
Bug description:
===
Vim version 7.0

When receiving a netbeans 'close' command, vim does delete the
specified buffer, but the buffer's reference (buf_list[bufno].bufp
called here 'this_memory_address') is still kept in buf_list[].
It may happen that this_memory_address is once again returned by
malloc when allocating a new buffer later. In this case, the function
nb_getbufno(this_memory_address) will return the closed netbeans
buffer number instead of the newly allocated one since it is always
before in the list.

See the test case below.

Issue:
How can a netbeans IDE implementation recognize when it talks to a vim
version where the bug is fixed (since 'close' can't be used when it
is not fixed) ?
With a new netbeans version number ?


Proposed Fix:

*** netbeans.c.orig 2006-06-17 18:49:19.0 +0200
--- netbeans.c  2006-08-03 23:25:04.0 +0200
***
*** 1986,1991 
--- 1986,1993 
if (buf-bufp != NULL)
do_buffer(DOBUF_WIPE, DOBUF_FIRST, FORWARD,
 buf-bufp-b_fnum, TRUE);
+   buf-bufp = NULL;
+   buf-initDone = FALSE;
doupdate = 1;
  /* =*/
}



===
Test case:
=
start 'clewn -d'
open 2 files in vim:
:e cltest_main.c
:e cltest_callit.c
from clewn, 'close' the first one (bufno 2 in the example below) with
the clewn debug command:
 (gdb) @ 2 close
open a third file in vim:
:e cltest_callit_2.c
hit key 'S' in this last buffer
result:
vim reports bufno 2, (the closed buffer), as the buffer where the
key was pressed instead of bufno 4, (the last buffer)
this is not always the case, but it is easy to reproduce on my
linux box



[EMAIL PROTECTED] clewn_test]$ clewn -d
...
... Clewn running GDB in level 3 mode
...

`run' commands do input and output on the terminal /dev/pts/1

NetBeans listens on localhost:3219

The netbeans socket to Vim is not connected yet...
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type show copying to see the conditions.
There is absolutely no warranty for GDB.  Type show warranty for details.
This GDB was configured as i686-pc-linux-gnu.
NetBeans connected to 127.0.0.1:34015

AUTH changeme
0:version=0 2.3
0:startupDone=0
0:setExitDelay!1 0
NBS_READY in conn_setup()
0:fileOpened=0 /home/xavier/tmp/clewn_test/cltest_main.c T F
2:putBufferNumber!2 /home/xavier/tmp/clewn_test/cltest_main.c
2:stopDocumentListen!3
2:defineAnnoType!4 1 1  = 0 15710005
2:version!5 Clewn version 1.1  
  

  .
0:fileOpened=0 /home/xavier/tmp/clewn_test/cltest_callit.c T F
3:putBufferNumber!6 /home/xavier/tmp/clewn_test/cltest_callit.c
3:stopDocumentListen!7
3:defineAnnoType!8 1 1  = 0 15710005
(gdb) @ 2 close -  closing bufno 2
2:close!9
2:fileOpened=0 /home/xavier/tmp/clewn_test/cltest_callit_2.c T F
4:putBufferNumber!10 /home/xavier/tmp/clewn_test/cltest_callit_2.c
4:stopDocumentListen!11
4:defineAnnoType!12 1 1  = 0 15710005
2:newDotAndMark=12 89 89-  hitting key 'S' in new buffer 
(bufno 4)
2:keyCommand=12 S
2:keyAtPos=12 S 89 10/0
(gdb) step
The program is not being run.
(gdb)

--
http://clewn.sourceforge.net   gdb support in Vim


[ANN] Clewn and vimGdb 1.8.1

2006-07-23 Thread Xavier de Gaye
Hi all,

Clewn and vimGdb 1.8.1 have been released.

The clewn project implements full gdb support in the vim editor:
breakpoints, watch variables, gdb command completion, assembly windows,
etc.

You can get clewn and vimGdb from http://clewn.sourceforge.net.


Bug fixes:

Fixed jumping back to last gdb frame sign after displaying a balloon
evaluation (clewn) or after clearing a breakpoint.

Fixed extra new line after gdb 'step' command.

Clewn: the gdb `run' commands do input and output on the clewn terminal.


Xavier

--
http://clewn.sourceforge.net   gdb support in Vim


[ANN] Clewn and vimGdb 1.8.1

2006-07-23 Thread Xavier de Gaye
Hi all,

Clewn and vimGdb 1.8.1 have been released.

The clewn project implements full gdb support in the vim editor:
breakpoints, watch variables, gdb command completion, assembly windows,
etc.

You can get clewn and vimGdb from http://clewn.sourceforge.net.


Bug fixes:

Fixed jumping back to last gdb frame sign after displaying a balloon
evaluation (clewn) or after clearing a breakpoint.

Fixed extra new line after gdb 'step' command.

Clewn: the gdb `run' commands do input and output on the clewn terminal.


Xavier

--
http://clewn.sourceforge.net   gdb support in Vim


Re: Firefox and VIM?

2006-07-19 Thread Xavier de Gaye

I am using the firefox extension Editus Externus by Philip Nilsson.
This is a great tool.

Download it from firefox using Tools:Extensions:Get more extensions
at https://addons.mozilla.org/firefox/1195/ and don't forget to set
'--nofork' as Argument in the Preferences.

--- Andreas Poisel [EMAIL PROTECTED] wrote:

 * Yakov Lerner [EMAIL PROTECTED] [060719 00:50]:
  Right, mozex for firefox is at https://addons.mozilla.org/firefox/40/
  But it seems not maintained for a long time
 
 Try the ViewSourceWith
 (http://dafizilla.sourceforge.net/viewsourcewith/) extension.  It
 supports editing textareas with a configurable external editor.
 
 -- 
 Regards, Andi
 


--
http://clewn.sourceforge.net   gdb support in Vim


[ANN] Clewn and vimGdb 1.8

2006-06-18 Thread Xavier de Gaye

Hi all

Clewn and vimGdb 1.8 have been released.

The clewn project implements full gdb support in the vim editor:
breakpoints, watch variables, gdb command completion, assembly
windows, etc.

You can get clewn and vimGdb from http://clewn.sourceforge.net.


New features:

vimGdb is ported to Vim 7.0.

clewn: when $cdir (for compilation directory) is present in the
'directory' gdb variable, clewn locates the source file by using the
debugging information stored in the program that is being debugged.

vimGdb: the position of the gdb window on the screen is setup
according to the values of the Vim options 'splitbelow' and
'splitright'


Bug fixes:

Fixed parsing of a long gdb 'directory' list.

Fixed browsing the gdb frame stack after an assertion failure, when
assembly support is enabled.

Fixed out of sync frame stack after printing an expression that causes
the evaluation of one of the debugged program functions.


Xavier

--
http://clewn.sourceforge.net   gdb support in Vim


Re: Netbeans Interface

2006-06-01 Thread Xavier de Gaye


--- Sebastian Menge [EMAIL PROTECTED] wrote:

 Under *netbeans-configure* it is said, that only gvim is supported.

 Does that mean i never can use the netbeans-interface in a terminal
 (since the dependency on gvim is hardcoded in netbeans.c)?

 Or does it mean that i have to compile my own vim with disabled
 gui-support and enabled netbeans?

Netbeans can only be used with gvim compiled either with GTK, Motif, or
with the Windows version of gvim. It cannot be used with plain vim
running in a terminal.

Xavier


--
http://clewn.sourceforge.net   gdb support in Vim


Re: Netbeans Interface

2006-06-01 Thread Xavier de Gaye

--- Sebastian Menge [EMAIL PROTECTED] wrote:
 Am Donnerstag, den 01.06.2006, 12:49 -0700 schrieb Xavier de Gaye:
  Netbeans can only be used with gvim compiled either with GTK, Motif, or
  with the Windows version of gvim. It cannot be used with plain vim
  running in a terminal.

 No workaround? The communication itself does not need the gui.

 Im no c-programmer, but that sounds, as if one would have to change
 little in netbeans.c .. !?

Vim, when run in a terminal is designed to work in a very poor
environment, and there is only one thread of execution.  On the other
hand, the netbeans interface has been designed with a GUI in mind (since
it was meant to be used by IDEs) and registers a call-back that is used
to process the received netbeans messages.  So, to port the netbeans
interface to Vim in terminal mode is not simple. One would have probably
to setup a hook in the main loop (RealWaitForChar() in os_unix.c), that
is, right in the deep heart of Vim.
Too bad.

Xavier


--
http://clewn.sourceforge.net   gdb support in Vim


console menus priority

2006-04-12 Thread Xavier de Gaye
When running Vim 7.0d on FC3 as:

$ gvim -u cfg.vim

with cgf.vim as:

=
 some sample menus with priorities
an 01.100 To.up C-WRC-L
an 01.200 To.down   C-WrC-L

an 02.100 Session.getsession:source ~/.vim/wk/
an 02.200 Session.mksession :mksession! ~/.vim/wk/

 setup for console menus
set guioptions=acgirLtMe
set wildmenu
set cpo-=
set wcm=C-Z
map F4 :emenu C-Z
=

The console menus (displayed after hitting F4), are ordered using
alphabetical order instead of the configured priorities. This is a
different behavior from the behavior in vim6.4.

After setting 'set guioptions+=m', one can see that the GUI menus
priorities are set correctly with the configured priorities, though.


--
http://clewn.sourceforge.net   gdb support in Vim


[vim 7.0d bug] Gtk asserts errors when hitting F10

2006-04-11 Thread Xavier de Gaye
I am running Vim 7.0d on FC3.

1 - the file 'no_m.vim' contains only the following line where 'm' has
been removed from the default guioptions option:

set guioptions=agirLtT


2 - run gvim with the following invocation:

$ gvim -u no_m.vim -U NONE


3 - hit F10:

The following messages are displayed on the terminal where gvim has
been started, the window manager (icewm) is stuck: you can't select
any other window, and the only way to get out of this is to hit an
item in the teared-off menu:

(gvim:15874): Gdk-CRITICAL **: file gdkwindow-x11.c: line 2732 
(gdk_window_get_origin): assertion
`window != NU
LL' failed

(gvim:15874): Gdk-CRITICAL **: file gdkwindow-x11.c: line 2732 
(gdk_window_get_origin): assertion
`window != NU
LL' failed

(gvim:15874): Gtk-WARNING **: Menu not on screen

(gvim:15874): Gtk-CRITICAL **: file gtkwidget.c: line 3360 (gtk_widget_event): 
assertion
`WIDGET_REALIZED_FOR_E
VENT (widget, event)' failed

etc..



--
http://clewn.sourceforge.net   gdb support in Vim