help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++-Mode


From: Kevin Rodgers
Subject: Re: C++-Mode
Date: Wed, 08 Jan 2003 11:18:02 -0700
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Boris H. wrote:

kgold wrote:
The default for emacs using M-x compile is to call make.

While you could change the default, experienced programmers typically
create a makefile.

I know, but since I only write small programms, there's no real need for a makefile.


make has implicit rules to build an executable from its source file.  So all
you should need to do in the foo.cc buffer is `M-! make foo'.  If that works,
it's just a matter of how you want to automate it:

1. Use the `M-x compile' command, with the compile-command customized as
   described in its doc string.

2. Write your own `M-x compile-buffer' command:

(defun compile-buffer (&optional buffer)
  "Compile the file visited in BUFFER (by default, the selected buffer)."
  (interactive "bCompile buffer: ")
  (or buffer
      (setq buffer (selected-buffer)))
  (save-excursion
    (set-buffer buffer)
    (compile (format "make %s" (file-name-sans-extension
                                (file-name-nondirectory buffer-file-name))))))

In Ada-mode, there are commands ada-compile-application and ada-run-application. I want this facility in C++-mode, too.

Can those be easily adapted to C++?  If not, you can use the compile-buffer

example above; just use shell-command or term instead of compile.

--
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;";>Kevin Rodgers</a>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]