Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: glaure on February 02, 2010, 09:32:14 am

Title: Configure Tool "Send to emacs" with cursor position
Post by: glaure on February 02, 2010, 09:32:14 am
Hi,

I love using emacs as my main editor. Usually I integrate emacs as external tool in the IDE.
For example in Visual Studio: emacsclientw -n +$(CurLine):$(CurCol) $(ItemPath)

In Code::Blocks I use the following:
Executeable: /usr/bin/emacsclient
Parameters: -n ${ACTIVE_EDITOR_FILENAME}

What I miss is the option to send the current cursor position in emacs.
Is there a hidden Macro or Variable I can use?

Bye Gunther
Title: Re: Configure Tool "Send to emacs" with cursor position
Post by: MortenMacFly on February 02, 2010, 10:15:55 am
Is there a hidden Macro or Variable I can use?
No, it's not implemented, but I can do this quickly. The question is: Shall that be zero index based (so the first line/column is zero) or human readable, so one index based (thus the first line/column is really 1).
Title: Re: Configure Tool "Send to emacs" with cursor position
Post by: Jenna on February 02, 2010, 10:21:10 am
Is there a hidden Macro or Variable I can use?
No, it's not implemented, but I can do this quickly. The question is: Shall that be zero index based (so the first line/column is zero) or human readable, so one index based (thus the first line/column is really 1).

I suggest to use the same values as scintilla does, otherwise it might confuse the user.
Title: Re: Configure Tool "Send to emacs" with cursor position
Post by: glaure on February 02, 2010, 10:28:23 am
I am looking into wxScintilla too :)
Just checked with emacs. The cursor positions start with 1. So 1:1 means left upper corner.

Is it possible that you may send me a patch file of your changes? I am still forced to use the 8.02 release.
But I looked into the source code and think I could integrate this feature here too.

Thanks Gunther
Title: Re: Configure Tool "Send to emacs" with cursor position
Post by: MortenMacFly on February 02, 2010, 10:59:01 am
I suggest to use the same values as scintilla does, otherwise it might confuse the user.
I don't think so. External applications (which we target hereby) will usually have a human readable interface although they might be zero based internally. This is not really related to wxScintilla. However, I can do both... not very convenient, but I can think of use cases where you either need the one or the other. ;-)

It's already implemented in my local copy... just doing some testing... Then I can provide a patch and submit to trunk.
Title: Re: Configure Tool "Send to emacs" with cursor position
Post by: MortenMacFly on February 02, 2010, 11:27:29 am
It's already implemented in my local copy... just doing some testing... Then I can provide a patch and submit to trunk.
Done. however, a patch is not good as I have also done some code cleanup. Please do a comparison of r6129 and r6130 online using:
http://svn.berlios.de/wsvn/codeblocks/?op=log&rev=0&sc=0&isdir=1

The relevant parts are all where you find "m_ActiveEditorLine" and "m_ActiveEditorColumn" in the header and implementation file.
Title: Re: Configure Tool "Send to emacs" with cursor position
Post by: glaure on February 02, 2010, 11:51:44 am
Thank you!

I will tell you if it works in 8.02.
Title: Re: Configure Tool "Send to emacs" with cursor position
Post by: MortenMacFly on February 02, 2010, 01:05:53 pm
I will tell you if it works in 8.02.
BTW: I would really suggest you update your code base if possible. 08/02 is *very* outdated.
Title: Re: Configure Tool "Send to emacs" with cursor position
Post by: glaure on February 02, 2010, 01:21:14 pm
I agree. But this is a productive company environment. There is no chance that I force a role-out of a C::B nightly build. (Only would get my ass kicked or worse :) )


Edit:
Morten it works perfect! I am a happy developer now :)