The Stack Overflow podcast is back! Listen to an interview with our new CEO.
26

Different levels of "IDE-ness" exist for different languages, and unfortunately you're never going to get full IDE features without some configuration (if you don't like configuring things, you probably shouldn't use Emacs). CEDET aims to be a complete solution that covers all your needs for supported languages, but I've personally never gotten it working ...


16

Compilation Mode does the same thing and is built-in. Here is a demo. Basic usage: M-x compile to run the compilation command (like :make) The command is taken from the variable compile-command (like the makeprg option) M-g p and M-g n to go to the location of the previous/next error (like :cp and :cn) M-{ and M-} to go to the previous/next file with an ...


15

I used this guide to get started using Emacs as a C++ IDE. It introduces Helm and Projectile which help answer a number of your questions. To wit, Projectile manages projects. It searches up the directory tree for a Makefile, SConstruct, Git repo, SVN repo, and perhaps some other build system or version control files to automatically learn what files are ...


14

Looking quickly at the code (in library compile.el), you should be able to just kill or hide the displayed buffer by using a function on hook compilation-finish-functions. To do that, use something like this: (add-hook 'compilation-finish-functions (lambda (buf strg) (kill-buffer buf)) If you don't want to kill the buffer, then use something like this: ...


13

You are looking for the function locate-dominating-file. Here is the emacs documentation for this function: (locate-dominating-file FILE NAME) Look up the directory hierarchy from FILE for a directory containing NAME. Stop at the first parent directory containing a file NAME, and return the directory. Return nil if not found. Instead of a string,...


11

years ago on the #emacs IRC channel I got this bit of code I've been using forever. The value "2 sec" sets the amount of time the successful compilation window stays visible. ; from enberg on #emacs (setq compilation-finish-function (lambda (buf str) (if (null (string-match ".*exited abnormally.*" str)) ;;no errors, make the compilation window ...


10

The way I've done that so far is to add a call of the shape (ignore <var>) This function call will be optimized away, but before that the compiler will still count it as a use, so the "unused" warning won't be triggered.


9

Since you are asking for a full-featureed C/C++ IDE now, I might be qualified. I used all MS IDEs from vc4 to Visual Studio 2010, so I fully understand what you want. The good news is that Emacs could be 95% as good as Visual Studio, and it can do much more. but you might be not interested in the "more" part. So I will focus on your questions only. Now ...


7

You can customize the variable compile-command to change the compilation command that is used by default: (setq compile-command "make package install")


6

Below is one approach for Windows. If you're in a rust project, it'll run cargo run. Otherwise, it'll use rustc. (defun rust-save-compile-and-run () (interactive) (save-buffer) (if (locate-dominating-file (buffer-file-name) "Cargo.toml") (compile "cargo run") (compile (format "rustc %s & %s" (buffer-file-name) (...


6

After crawling the configure script, I think I have found your missing packet: libmagickwand-dev. On my machine, after installing this packet, ./configure finally says: Does Emacs use imagemagick? yes NB1: as with other features (eg libxml2-dev for eww), I do not get the purpose of --with-feature: If the libraries and ...


6

Recursive compile, no dependencies attached: (defun desperately-compile () "Traveling up the path, find a Makefile and `compile'." (interactive) (with-temp-buffer (while (and (not (file-exists-p "Makefile")) (not (equal "/" default-directory))) (cd "..")) (when (file-exists-p "Makefile") (compile "make -k"))))


6

As described on this blog post, you need a second option for that. compilation-skip-threshold (setq compilation-skip-threshold 2) Compilation motion commands skip less important messages. The value can be either 2 -- skip anything less than error, 1 -- skip anything less than warning or 0 -- don't skip any messages. Note that all messages not ...


5

Deploy different versions of Emacs at the same machine (for Emacs plugin development) If your OS is too old and you are not a super user, install the latest stable Emacs at your $HOME is the only solution. There is no performance advantage if you compile it by yourself.


5

Here my version of compile: (global-set-key (kbd "<f5>") (lambda () (interactive) (save-buffer) (setq-local compilation-read-command nil) (call-interactively 'compile))) Basically it reuses previously executed compile command; ...


5

For #4, I highly recommend exuberant-ctags and the built-in tags support, which I have used for years. Alternatively, I just recently have switched to using GNU Global and the ggtags package and have found them to be slightly superior; although, they function almost identically. Both work with nearly no configuration. For other IDE features, I also like the ...


5

Normally, Emacs considers the selected frame the only reusable frame. In other words, normally Emacs only searches the current ("selected") frame for windows that already contain the buffer-to-display ("reusable windows"). What you need is for Emacs to consider the compilation buffer's frame as a reusable frame: (push '("\\*compilation\\*" . (nil (reusable-...


5

Known extensions to AUCTeX are controlled by the variable TeX-file-extensions: TeX-file-extensions is a variable defined in ‘tex.el’. Its value is ("tex" "sty" "cls" "ltx" "texi" "txi" "texinfo" "dtx") Documentation: *File extensions used by manually generated TeX files. You can use the customize interface to add "ins" to this list or with ...


4

Management of software "projects." I want my IDE to have a sense of all of the files that make up my current project so that I can perform functions like search-and-replace within my project. (It would be nice if I could also achieve this without littering my source tree with lots of support files. Why do I need more than one centralized project ...


4

To avoid having to track down the packages that are required to build Emacs, use apt-get to install them for you. apt-get build-dep emacs Actually this may not be enough, as this just installs the libraries the Debian maintainer has chosen to link Emacs against. I think you need: apt-get install libm17n-dev libmagickcore-dev However after this I still ...


4

I had a similar idea once, but honestly? there are quite a few things that a proper build system needs, and which will require quite a lot of work. One thing you want is memorizing things you've built and building only the things you have to. This would typically call for interaction with database, version control system and writing code which builds a ...


4

You need to do two things: 1. Bind compile to a key (like f5) 2. Change the command that compile runs. To do the first add (define-key c++-mode-map [f5] #'compile) to your .emacs. This sets the key only in c++-mode; you can make it a global binding if you want by using global-map instead. For the second, the compile function just runs whatever is stored ...


4

The *compilation* buffer has nothing to do with LaTeX. You mean the process output buffer of LaTeX. You can use the following lisp code to delete the buffer window when there are no LaTeX errors. If you also want to keep the output buffer for LaTeX warnings switch off TeX-buf-close-at-warnings-only via M-x customize-option. (defcustom TeX-buf-close-at-...


3

The value of default-directory has to end with a slash.


3

Thanks to the University of Wyoming I have been able to achieve the result with: ;; Make M-x compile smarter in order to guess language (require 'compile) (defvar compile-guess-command-table '((c-mode . "gcc -Wall -g %s -o %s -lm") (c++-mode . "g++ -Wall %s -o %s -std=c++14") (fortran-mode . "gfortran -C %s -o %s") )) (defun compile-...


3

Quoting deps.mk: ## This file is included in src/Makefile if AUTO_DEPEND=no.\ So it's kind of a fallback file only used to give dependencies to make sure compilation ordering is right. You want to look in src/Makefile.in instead where you should have no difficulty finding the variable that contains all the .o files we need.


3

Here is a bare-bones minimum viable function, which I hope does what you want. (defun wjh3pane-create-3pane-layout () "Create 3-pane layout of windows in the current frame. Layout is as follows: |--------------------------------------| | source code buffer | | source code buffer | | source ...


3

Emacs switched from webkit1gtk to webkit2gtk so you'll need to install that instead. Your GTK package should be fine. PS: I agree with the linked article, although I wouldn't put it this drastically. You're better off with using a dedicated browser built upon WebKit or WebEngine. If all you're after is Emacs keybindings, EXWM might be an alternative.


3

For emacs-26 on ubuntu, the required package for --with-xwidgets is libwebkit2gtk-4.0-dev. Found in comment here, confirmed by experience.


3

Since you are using Org-mode and all you want (according to your post), is to evaluate small C code examples, I'd use ob-C and just evaluate everything using org-babel. This is not an answer on how to compile and run C code directly, but a convenient alternative using Org. Fire up an org file and try the following (taken from this awesome blog post): #+...


Only top voted, non community-wiki answers of a minimum length are eligible