Author Topic: Configure Tool "Send to emacs" with cursor position  (Read 6058 times)

Offline glaure

  • Single posting newcomer
  • *
  • Posts: 9
Configure Tool "Send to emacs" with cursor position
« 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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Configure Tool "Send to emacs" with cursor position
« Reply #1 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).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Configure Tool "Send to emacs" with cursor position
« Reply #2 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.

Offline glaure

  • Single posting newcomer
  • *
  • Posts: 9
Re: Configure Tool "Send to emacs" with cursor position
« Reply #3 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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Configure Tool "Send to emacs" with cursor position
« Reply #4 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Configure Tool "Send to emacs" with cursor position
« Reply #5 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline glaure

  • Single posting newcomer
  • *
  • Posts: 9
Re: Configure Tool "Send to emacs" with cursor position
« Reply #6 on: February 02, 2010, 11:51:44 am »
Thank you!

I will tell you if it works in 8.02.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Configure Tool "Send to emacs" with cursor position
« Reply #7 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline glaure

  • Single posting newcomer
  • *
  • Posts: 9
Re: Configure Tool "Send to emacs" with cursor position
« Reply #8 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 :)
« Last Edit: February 02, 2010, 03:06:56 pm by glaure »