[Zope] Emacs advice: Answer!

seb bacon seb@jamkit.com
06 Mar 2002 12:54:35 +0000


--=-Fzcb2pwjv1XAepEN152R
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

OK, so I've found out the answer.  Here it is for anyone who's
interested.

The answer is: etags.  I can now press M-. over a call to any function
or class call and jump to its definition anywhere in Zope.  Yay!

Here's a recipie for anyone who's interested.

The etags which came with my distro didn't have support for python, so I
donwnloaded the latest version:

  ftp://fly.cnuce.cnr.it/pub/etags.c.gz

But this is broken too, since it doesn't index indented functions.  It
was pretty simple to fix (patch applied).

Then I just did something along the lines of

$ find . -name '*.py' | xargs etags

Having done all that, I then found out there's a tool in the Tools
directory of my python distribution which does it for me >:(

http://makeashorterlink.com/?T11225F7

Anyway, highly recommended.



On Wed, 2002-03-06 at 12:15, Janko wrote:
> On 06 Mar 2002 12:00:31 +0000
> seb bacon <seb@jamkit.com> wrote:
> 
> 
> Oh sorry, no I understand. I think then you need to use etags, which should give you this function, but you need to generate a TAGS file and can then use the etags commands of emacs. This works perhaps only in the current directory.
> 
> HTHalm, (a little more :-)
> __Jankko
> 
> > On Wed, 2002-03-06 at 11:49, Thomas Guettler wrote:
> > 
> > > By the way, the ctrl-c ctrl-u solution only jump to the beginng of the 
> > > function you are in.
> > 
> > Thanks to everyone for their suggestions, but Thomas is right: I don't
> > want to jump to the beginning of the function I'm in, but to the
> > definition of the function I'm pointing at.
> > 
> > seb
> > 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )


--=-Fzcb2pwjv1XAepEN152R
Content-Disposition: attachment; filename=etags-py.patch
Content-Transfer-Encoding: quoted-printable
Content-Type: text/x-patch; charset=ISO-8859-1

*** etags.c	Wed Mar  6 12:45:25 2002
--- etags-new.c	Wed Mar  6 12:44:49 2002
***************
*** 4071,4083 ****
    register char *cp;
 =20
    LOOP_ON_INPUT_LINES (inf, lb, cp)
!     if (LOOKING_AT (cp, "def") || LOOKING_AT (cp, "class"))
!       {
! 	while (!notinname (*cp) && *cp !=3D ':')
! 	  cp++;
! 	pfnote (NULL, TRUE,
! 		lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
!       }
  }
 =20
  =0C
--- 4071,4086 ----
    register char *cp;
 =20
    LOOP_ON_INPUT_LINES (inf, lb, cp)
!     {
!       cp =3D skip_spaces (cp);
!       if (LOOKING_AT (cp, "def") || LOOKING_AT (cp, "class"))
! 	{
! 	  while (!notinname (*cp) && *cp !=3D ':')
! 	    cp++;
! 	  pfnote (NULL, TRUE,
! 		  lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
! 	}
!     }
  }
 =20
  =0C

--=-Fzcb2pwjv1XAepEN152R--