unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Ways to use Emacs when programming C++ with Visual Studio?
@ 2014-10-24 20:35 Thorsten Jolitz
  2014-10-26  2:47 ` Óscar Fuentes
  0 siblings, 1 reply; 14+ messages in thread
From: Thorsten Jolitz @ 2014-10-24 20:35 UTC (permalink / raw)
  To: help-gnu-emacs


Hi List, 

I did some web research about how to (still) use Emacs (somehow) when
programming C++ with MS Visual Studio (Express). What I found was more
or less:

 - there are workarounds to activate Emacs Keybindings in VS

 - emacs(client) can be configured as editor in VS (like it can be
    e.g. configured as editor in firefox)

 - emacs can be used (after setting quite a lot of environmental
   variables) to interact with the MSVS C++ compiler via the cmd line

I'm really new to this C++ thing, so I would appreciate some tips about
this topic, what can be done, what not, what is the state-of-the-art
(some prominent links I found are really old, like 10 years or so,
talking about Emacs 19...)?

Are there actually C++ teams with both Emacs and Visual Studio users? I
could imagine that e.g. in a Scala (SBT or Maven) project some
programmers use Eclipse, others Emacs ENSIME, and they can happily
co-exist, but would a similar co-existance be possible in a C++ project
on Windows with Emacs and Visual Studio?

-- 
cheers,
Thorsten





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ways to use Emacs when programming C++ with Visual Studio?
  2014-10-24 20:35 Thorsten Jolitz
@ 2014-10-26  2:47 ` Óscar Fuentes
  2014-10-27  8:41   ` Thorsten Jolitz
  0 siblings, 1 reply; 14+ messages in thread
From: Óscar Fuentes @ 2014-10-26  2:47 UTC (permalink / raw)
  To: help-gnu-emacs

Thorsten Jolitz <tjolitz@gmail.com> writes:

[snip]

>  - emacs can be used (after setting quite a lot of environmental
>    variables) to interact with the MSVS C++ compiler via the cmd line

VS comes with batch files for setting those environment variables. You
can write a .bat that takes an arbitrary number of arguments, executes
the VS .bat that sets the environment variables and then executes those
arguments as a command. This is mine:

rem vc2013.bat
@call "c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"
%*

From Emacs you do

M-x compile vc2013.bat <command>

> I'm really new to this C++ thing, so I would appreciate some tips about
> this topic, what can be done, what not, what is the state-of-the-art
> (some prominent links I found are really old, like 10 years or so,
> talking about Emacs 19...)?
>
> Are there actually C++ teams with both Emacs and Visual Studio users? I
> could imagine that e.g. in a Scala (SBT or Maven) project some
> programmers use Eclipse, others Emacs ENSIME, and they can happily
> co-exist, but would a similar co-existance be possible in a C++ project
> on Windows with Emacs and Visual Studio?

Absolutely. I only use the VS IDE for debugging (which seldom happens.)
99% of the time is coding and everything is done from Emacs. You can use
CMake too, that creates VC project files, makefiles, etc from the same
build specification.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ways to use Emacs when programming C++ with Visual Studio?
  2014-10-26  2:47 ` Óscar Fuentes
@ 2014-10-27  8:41   ` Thorsten Jolitz
  0 siblings, 0 replies; 14+ messages in thread
From: Thorsten Jolitz @ 2014-10-27  8:41 UTC (permalink / raw)
  To: help-gnu-emacs

Óscar Fuentes <ofv@wanadoo.es> writes:

> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
> [snip]
>
>>  - emacs can be used (after setting quite a lot of environmental
>>    variables) to interact with the MSVS C++ compiler via the cmd line
>
> VS comes with batch files for setting those environment variables. You
> can write a .bat that takes an arbitrary number of arguments, executes
> the VS .bat that sets the environment variables and then executes those
> arguments as a command. This is mine:
>
> rem vc2013.bat
> @call "c:\Program Files (x86)\Microsoft Visual Studio
> 12.0\VC\bin\vcvars32.bat"
> %*
>
> From Emacs you do
>
> M-x compile vc2013.bat <command>

That looks easy enough, thanks.

>> I'm really new to this C++ thing, so I would appreciate some tips about
>> this topic, what can be done, what not, what is the state-of-the-art
>> (some prominent links I found are really old, like 10 years or so,
>> talking about Emacs 19...)?
>>
>> Are there actually C++ teams with both Emacs and Visual Studio users? I
>> could imagine that e.g. in a Scala (SBT or Maven) project some
>> programmers use Eclipse, others Emacs ENSIME, and they can happily
>> co-exist, but would a similar co-existance be possible in a C++ project
>> on Windows with Emacs and Visual Studio?
>
> Absolutely. I only use the VS IDE for debugging (which seldom happens.)
> 99% of the time is coding and everything is done from Emacs. You can use
> CMake too, that creates VC project files, makefiles, etc from the same
> build specification.

Thats really good news. Thanks again for the hints.

-- 
cheers,
Thorsten




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ways to use Emacs when programming C++ with Visual Studio?
       [not found] <mailman.11982.1414182986.1147.help-gnu-emacs@gnu.org>
@ 2014-11-07  1:09 ` Emanuel Berg
  2014-11-07 10:21   ` Thorsten Jolitz
                     ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Emanuel Berg @ 2014-11-07  1:09 UTC (permalink / raw)
  To: help-gnu-emacs

Thorsten Jolitz <tjolitz@gmail.com> writes:

> I'm really new to this C++ thing, so I would
> appreciate some tips

Here is a tip: don't do it!

I'm sure it is possible to a certain extent but it'll
just require lots of work and then at the first sign
of trouble you'll start to think somewhere along the
transition it went wrong, and you'll go back there,
and it'll all be shaky until someone says you should
use some new tool or module with VS, and then you are
*really* done for...

When I did my bachelor in CS I was sent to a hospital
where they did MS Access and that IDE and VBA and
their SQL.

So I thought, let's not be a snob, I'll do it with
Emacs and MySQL and all first so I have a almost
complete understanding of the problem start-to-finish,
then I'll just go there, do it all with their crap
tools and be done with it.

First part of that plan worked out very good, but then
to use that software, I developed an intense hatred
(no exaggeration) for everything MS, everything GUI,
everything mouse... It would literally hurt my eyes
and fingers and arm to use that stuff. Mentally the
most frustrating thing was being constantly aware all
problems would vanish in zero time, would they just
allow me to use professional tools...

When I was done, the hatred actually didn't disappear
instantly, but lingered on. But now, too much time has
passed, and all those negatives I don't suffer from
anymore (because I don't use MS Access, the mouse,
etc.), so know, my system is clean of the hatred as
well.

I even wrote about this [1], if anyone is interested
in ergonomics and the like.

Your plan is actually a lot better, because you plan
on using transition tools - if you get it to work like
instantly, fine, probably if you spend several hours
step-by-step to get it to work, I'd advice not to drop
it.

Remember, in the computer world, portable and
tool-independent solutions are everywhere. If someone
says, here we do it like this, and you must, too -
then that speaks volumes about the person saying that.
Unless you have a bunch of kids that would otherwise
starve, there is absolutely no reason to put up with
it.

[1] http://user.it.uu.se/~embe8573/about/degree/x.pdf
(check out the ToC for interface stuff)

-- 
underground experts united


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ways to use Emacs when programming C++ with Visual Studio?
  2014-11-07  1:09 ` Ways to use Emacs when programming C++ with Visual Studio? Emanuel Berg
@ 2014-11-07 10:21   ` Thorsten Jolitz
       [not found]   ` <mailman.13103.1415355713.1147.help-gnu-emacs@gnu.org>
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Thorsten Jolitz @ 2014-11-07 10:21 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg <embe8573@student.uu.se> writes:

Hi, 

> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> I'm really new to this C++ thing, so I would
>> appreciate some tips
>
> Here is a tip: don't do it! [SNIP]

thanks for the tips and the link!
Not sure if going the Emacs way is accepted, lets see ...

-- 
cheers,
Thorsten




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ways to use Emacs when programming C++ with Visual Studio?
       [not found]   ` <mailman.13103.1415355713.1147.help-gnu-emacs@gnu.org>
@ 2014-11-10  0:51     ` 3246251196ryan
  2014-11-10 10:43       ` Thorsten Jolitz
       [not found]       ` <mailman.13369.1415616253.1147.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 14+ messages in thread
From: 3246251196ryan @ 2014-11-10  0:51 UTC (permalink / raw)
  To: help-gnu-emacs

I am in the same situation. At work Windows is a must, unfortunately. We use Msvc but I am avidly a fan of GNU like things and always use emacs for all. So when I first joined I set about making emacs my ide.  Only time - like previous poster said - I use vc ide is for debugging. 

But as another poster said, it will consume time. A lot of times I have been working on a problem for work and spent a while hacking emacs to get something to work. I have needed to change some things in compile . el for instance. 

But when it's all set up its very nice. I run compilation mode through emacs etc - and with said changes to compile I can jump to the line of error etc. I use CEDET/semantic for Intellisense. Vc mode and all the rest of it. We use msys at work so that is used in shell mode.

I generally forget I am on windows because all is done on emacs whose windows I spread across two monitors and just keep at least a permanent middle split of buffers.

I would say it's worth it but expect a little annoyance and thus perseverance to hack things around to get it to work.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ways to use Emacs when programming C++ with Visual Studio?
  2014-11-10  0:51     ` 3246251196ryan
@ 2014-11-10 10:43       ` Thorsten Jolitz
       [not found]       ` <mailman.13369.1415616253.1147.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 14+ messages in thread
From: Thorsten Jolitz @ 2014-11-10 10:43 UTC (permalink / raw)
  To: help-gnu-emacs

3246251196ryan@gmail.com writes:

> I am in the same situation. At work Windows is a must,
> unfortunately. We use Msvc but I am avidly a fan of GNU like things
> and always use emacs for all. So when I first joined I set about
> making emacs my ide.  Only time - like previous poster said - I use vc
> ide is for debugging.
>
> But as another poster said, it will consume time. A lot of times I
> have been working on a problem for work and spent a while hacking
> emacs to get something to work. I have needed to change some things in
> compile . el for instance.
>
> But when it's all set up its very nice. I run compilation mode through
> emacs etc - and with said changes to compile I can jump to the line of
> error etc. I use CEDET/semantic for Intellisense. Vc mode and all the
> rest of it. We use msys at work so that is used in shell mode.
>
> I generally forget I am on windows because all is done on emacs whose
> windows I spread across two monitors and just keep at least a
> permanent middle split of buffers.
>
> I would say it's worth it but expect a little annoyance and thus
> perseverance to hack things around to get it to work.

Its promising that Emacs can be and is used in Windows/MSVS teams,
thanks for sharing your experiences. I'm definitely prepared to invest
some time and effort in this, I only have to find out if its considered
acceptable to 'do your own thing' instead of adapting to the
"environment". 

-- 
cheers,
Thorsten




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ways to use Emacs when programming C++ with Visual Studio?
       [not found]       ` <mailman.13369.1415616253.1147.help-gnu-emacs@gnu.org>
@ 2014-11-11 14:28         ` 3246251196ryan
  0 siblings, 0 replies; 14+ messages in thread
From: 3246251196ryan @ 2014-11-11 14:28 UTC (permalink / raw)
  To: help-gnu-emacs

On Monday, 10 November 2014 10:44:15 UTC, Thorsten Jolitz  wrote:
> 3246251196ryan@gmail.com writes:
> 
> > I am in the same situation. At work Windows is a must,
> > unfortunately. We use Msvc but I am avidly a fan of GNU like things
> > and always use emacs for all. So when I first joined I set about
> > making emacs my ide.  Only time - like previous poster said - I use vc
> > ide is for debugging.
> >
> > But as another poster said, it will consume time. A lot of times I
> > have been working on a problem for work and spent a while hacking
> > emacs to get something to work. I have needed to change some things in
> > compile . el for instance.
> >
> > But when it's all set up its very nice. I run compilation mode through
> > emacs etc - and with said changes to compile I can jump to the line of
> > error etc. I use CEDET/semantic for Intellisense. Vc mode and all the
> > rest of it. We use msys at work so that is used in shell mode.
> >
> > I generally forget I am on windows because all is done on emacs whose
> > windows I spread across two monitors and just keep at least a
> > permanent middle split of buffers.
> >
> > I would say it's worth it but expect a little annoyance and thus
> > perseverance to hack things around to get it to work.
> 
> Its promising that Emacs can be and is used in Windows/MSVS teams,
> thanks for sharing your experiences. I'm definitely prepared to invest
> some time and effort in this, I only have to find out if its considered
> acceptable to 'do your own thing' instead of adapting to the
> "environment". 
> 
> -- 
> cheers,
> Thorsten

There are people here who are no doubt have way more experience than me with Emacs. But if you have any questions regarding setting up emacs on windows, ask here


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ways to use Emacs when programming C++ with Visual Studio?
  2014-11-07  1:09 ` Ways to use Emacs when programming C++ with Visual Studio? Emanuel Berg
  2014-11-07 10:21   ` Thorsten Jolitz
       [not found]   ` <mailman.13103.1415355713.1147.help-gnu-emacs@gnu.org>
@ 2014-11-24 23:00   ` Ken Goldman
       [not found]   ` <mailman.14499.1416870041.1147.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 14+ messages in thread
From: Ken Goldman @ 2014-11-24 23:00 UTC (permalink / raw)
  To: help-gnu-emacs

On 11/6/2014 8:09 PM, Emanuel Berg wrote:
> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> I'm really new to this C++ thing, so I would
>> appreciate some tips

My pattern:

I use emacs for heavy coding.

I use Visual Studio for compiling, fixing minor coding errors that the 
compiler finds, and for debugging.

I use autorevert to keep the emacs buffers in sync with disk.  There's a 
similar setting in VS.

It might seem odd, but I believe in the best tool for the job.  Emacs is 
a great editor for coding.  VS is a great debugger, easier to set up and 
use (IMHO) than eclipse.








^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ways to use Emacs when programming C++ with Visual Studio?
       [not found]   ` <mailman.14499.1416870041.1147.help-gnu-emacs@gnu.org>
@ 2014-11-25 23:40     ` Mike
  2014-11-26 14:55       ` Ken Goldman
       [not found]       ` <mailman.14674.1417013766.1147.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 14+ messages in thread
From: Mike @ 2014-11-25 23:40 UTC (permalink / raw)
  To: help-gnu-emacs

On Monday, November 24, 2014 3:00:43 PM UTC-8, Ken Goldman wrote:
> On 11/6/2014 8:09 PM, Emanuel Berg wrote:
> > Thorsten Jolitz <tjolitz@gmail.com> writes:
> >
> >> I'm really new to this C++ thing, so I would
> >> appreciate some tips
> 
> My pattern:
> 
> I use emacs for heavy coding.
> 
> I use Visual Studio for compiling, fixing minor coding errors that the 
> compiler finds, and for debugging.
> 
> I use autorevert to keep the emacs buffers in sync with disk.  There's a 
> similar setting in VS.
> 
> It might seem odd, but I believe in the best tool for the job.  Emacs is 
> a great editor for coding.  VS is a great debugger, easier to set up and 
> use (IMHO) than eclipse.

I agree with you.  That was the way I would use it.  Emacs for editing, but in the debugging phase use VS and make the hopefully small changes debugging would throw up through the VS editor.
I would just keep exitting and re-starting emacs to ensure I got the edits I had made in VS.  Thanks for letting me know about autorevert.  I'll try that out.
Sometimes, even during debugging, I'd find that the edits I wanted to make were easier using Emacs.  So I'd make the changes in Emacs, then I would close every file window in VS, save all the files open in Emacs, then tell VS to rebuild everything!  Not really much fun, but as Emacs is my favorite editor by far,and VS my favorite debugger for Windows, I could not find a better way.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ways to use Emacs when programming C++ with Visual Studio?
  2014-11-25 23:40     ` Mike
@ 2014-11-26 14:55       ` Ken Goldman
  2014-12-02 20:50         ` Robert Thorpe
       [not found]       ` <mailman.14674.1417013766.1147.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 14+ messages in thread
From: Ken Goldman @ 2014-11-26 14:55 UTC (permalink / raw)
  To: help-gnu-emacs

On 11/25/2014 6:40 PM, Mike wrote:
>
> Thanks for letting me know about autorevert.
>

Besides autorevert, there's also M-x revert-buffer, which does it manually.

> So I'd make the changes in Emacs, then I would close every file
> window in VS, save all the files open in Emacs, then tell VS to
> rebuild everything! Not really much fun,

Tools - Options - Documents - Detect when file is changed outside the 
environment - auto-load changes if saved.

I assume that Microsoft added that option so their developers could use 
emacs.  :-)




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ways to use Emacs when programming C++ with Visual Studio?
       [not found]       ` <mailman.14674.1417013766.1147.help-gnu-emacs@gnu.org>
@ 2014-11-26 21:54         ` mflynn
  0 siblings, 0 replies; 14+ messages in thread
From: mflynn @ 2014-11-26 21:54 UTC (permalink / raw)
  To: help-gnu-emacs

On Wednesday, November 26, 2014 6:56:08 AM UTC-8, Ken Goldman wrote:
> On 11/25/2014 6:40 PM, Mike wrote:
> >
> > Thanks for letting me know about autorevert.
> >
> 
> Besides autorevert, there's also M-x revert-buffer, which does it manually.
> 
> > So I'd make the changes in Emacs, then I would close every file
> > window in VS, save all the files open in Emacs, then tell VS to
> > rebuild everything! Not really much fun,
> 
> Tools - Options - Documents - Detect when file is changed outside the 
> environment - auto-load changes if saved.
> 
> I assume that Microsoft added that option so their developers could use 
> emacs.  :-)

Cool.  Thanks for letting me know about that.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ways to use Emacs when programming C++ with Visual Studio?
  2014-11-26 14:55       ` Ken Goldman
@ 2014-12-02 20:50         ` Robert Thorpe
  2014-12-02 20:54           ` Óscar Fuentes
  0 siblings, 1 reply; 14+ messages in thread
From: Robert Thorpe @ 2014-12-02 20:50 UTC (permalink / raw)
  To: Ken Goldman; +Cc: help-gnu-emacs

Ken Goldman <kgoldman@us.ibm.com> writes:
> On 11/25/2014 6:40 PM, Mike wrote:
>>
>> Thanks for letting me know about autorevert.
>>
>
> Besides autorevert, there's also M-x revert-buffer, which does it manually.
>
>> So I'd make the changes in Emacs, then I would close every file
>> window in VS, save all the files open in Emacs, then tell VS to
>> rebuild everything! Not really much fun,
>
> Tools - Options - Documents - Detect when file is changed outside the 
> environment - auto-load changes if saved.
>
> I assume that Microsoft added that option so their developers could use 
> emacs.  :-)

Many years ago when I used Microsoft Visual Studio I used the same
procedure.  I did my editing in Emacs and used auto-revert mode.  I had
VS setup to revert periodically too.

I found it best to avoid global-auto-revert-mode and setup auto-revert
mode only for the relevant modes (C++ in my case).

Something to watch out for here is that Emacs believes that .h files are
C files not C++.  Microsoft don't use the .hpp file extension.  If you
use VS a lot it's best to make .h files automatically choose C++ mode.

I don't have any code for this unfortunately, I deleted it from my
.emacs years ago when I stopped using VS.

BR,
Robert Thorpe



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Ways to use Emacs when programming C++ with Visual Studio?
  2014-12-02 20:50         ` Robert Thorpe
@ 2014-12-02 20:54           ` Óscar Fuentes
  0 siblings, 0 replies; 14+ messages in thread
From: Óscar Fuentes @ 2014-12-02 20:54 UTC (permalink / raw)
  To: help-gnu-emacs

Robert Thorpe <rt@robertthorpeconsulting.com> writes:

[snip]

> Something to watch out for here is that Emacs believes that .h files are
> C files not C++.  Microsoft don't use the .hpp file extension.  If you
> use VS a lot it's best to make .h files automatically choose C++ mode.
>
> I don't have any code for this unfortunately, I deleted it from my
> .emacs years ago when I stopped using VS.

(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))





^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-12-02 20:54 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.11982.1414182986.1147.help-gnu-emacs@gnu.org>
2014-11-07  1:09 ` Ways to use Emacs when programming C++ with Visual Studio? Emanuel Berg
2014-11-07 10:21   ` Thorsten Jolitz
     [not found]   ` <mailman.13103.1415355713.1147.help-gnu-emacs@gnu.org>
2014-11-10  0:51     ` 3246251196ryan
2014-11-10 10:43       ` Thorsten Jolitz
     [not found]       ` <mailman.13369.1415616253.1147.help-gnu-emacs@gnu.org>
2014-11-11 14:28         ` 3246251196ryan
2014-11-24 23:00   ` Ken Goldman
     [not found]   ` <mailman.14499.1416870041.1147.help-gnu-emacs@gnu.org>
2014-11-25 23:40     ` Mike
2014-11-26 14:55       ` Ken Goldman
2014-12-02 20:50         ` Robert Thorpe
2014-12-02 20:54           ` Óscar Fuentes
     [not found]       ` <mailman.14674.1417013766.1147.help-gnu-emacs@gnu.org>
2014-11-26 21:54         ` mflynn
2014-10-24 20:35 Thorsten Jolitz
2014-10-26  2:47 ` Óscar Fuentes
2014-10-27  8:41   ` Thorsten Jolitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).