11 votes
Accepted

Changing the compilation mode current directory automatically?

Finally, I abandoned relying on the current directory as it was too intrusive and other things like ido where ending being affected... Instead, I use added my build directory to compilation-search-...
user avatar
8 votes
Accepted

Jumping to the first error -- not warning -- when compiling

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 ...
user avatar
  • 22.4k
6 votes
Accepted

Set variables based on path without using directory-local variables

Directory-local variables were actually designed for this use case as well. Read the docs, especially at the end, where it discusses dir-locals-set-directory-class. The idea here is that you can ...
user avatar
6 votes

Changing the compilation mode current directory automatically?

You can simply make a Dired buffer of the directory where you want to invoke compile command, to serve as an anchor. When you want to compile, switch to the Dired buffer and run compile command. ...
user avatar
  • 6,682
5 votes

Changing the compilation mode current directory automatically?

This alternate command should do the trick: (defun compile-in-dir (dir command) (interactive "DCompile in directory: \nsCommand: ") (let ((default-directory dir)) (compile command))) ...
user avatar
  • 2,781
4 votes
Accepted

Print elapsed time in compilation buffer

Amazing nobody's answered this yet, but I can't find an answer anywhere. Here's my solution: (make-variable-buffer-local 'my-compilation-start-time) (add-hook 'compilation-start-hook #'my-...
user avatar
4 votes

How can I add a compilation error regex for node js?

Answer came in via twitter from hero @jscalterego https://twitter.com/cowboyd/status/778287337952247808 Apparently the problem is that in the re-builder, I was using "string" regex syntax vs "read" ...
user avatar
3 votes
Accepted

How to highlight the compilation buffer?

Adding some additional HIGHLIGHT parameters to your list should do it. As stated in Emacs' documentation for the variable compilation-error-regexp-alist: Additional HIGHLIGHTs take the shape (...
user avatar
3 votes
Accepted

How to align grep output?

Here is the complete solution: (setcar (car grep-regexp-alist) "^\\(.+?\\)\\(:[ \t]*\\)\\([1-9][0-9]*\\)[ \t]*\\2") (defun eab/grep-align () (interactive) (read-only-mode -1) (toggle-...
user avatar
  • 425
3 votes
Accepted

A compilation-mode conundrum - matching and highlighting

I think this is what's going on: The shell command produces output and at the same time compile.el wants to put font-lock properties on it using a list of regexps. But how should it know, whether ...
user avatar
  • 3,276
3 votes

How do you abort an emacs M-x compile compilation

Know that you can use M-x compile to compile from within Emacs. If you do that then, in your compilation output buffer, use C-h m to see information about the mode. For example, it might tell you ...
user avatar
  • 70.3k
3 votes
Accepted

compilation sentinel: symbol's value as variable is void for quote, >, <, =, etc

You're missing parentheses around the interior of your cond expression. You also should not have the parentheses around the body forms of the condition (although this part is not what is causing your ...
user avatar
  • 416
2 votes
Accepted

Selecting an item in *compilation* buffer makes the item jump to the top

Without a left fringe, there is no place for emacs to show an arrow on the current row. In that case it scrolls down so that the buffer shows the current row on top instead. See here: If the *...
user avatar
  • 387
2 votes

Source-Links in Compilation mode not working

After some tinkering, I was able to trace the problem to emacs wrongly recognizing the column in the trace output as the line number. All I had to do was add a new regexp to compilation-error-regexp-...
user avatar
  • 273
2 votes
Accepted

compilation-mode: default-directory != src-root

At first I give a recipe for reproduction of your problem (hopefully I understood it right). Afterwards I will present a solution. Recipe for problem reproduction Put the following C++ source code ...
user avatar
  • 30.5k
2 votes
Accepted

Simultaneously compiling two or more projects with Compilation Mode

From the documentation of the compile function: To run more than one compilation at once, start one then rename the ‘compilation’ buffer to some other name with M-x rename-buffer. Then switch ...
user avatar
2 votes
Accepted

Sudo caching on compilation mode

I suppose you are using Tramp's sudo method to run the command with root permissions from Emacs. With a very recent snapshot of Tramp 2.4.1-pre (or 27.0.50), there is a new configuration parameter to ...
user avatar
2 votes
Accepted

TTY allocation in *Compilation* buffer

After a kind hint from @rpluim, I wrote this in my .emacs : (defun plain-pipe-for-process () (setq-local process-connection-type nil)) (add-hook 'compilation-mode-hook 'plain-pipe-for-process) It ...
user avatar
2 votes

How to Run a Context Sensitive Compile?

did you try with .dir-locals.el file? something along the lines ((c++-mode . ((compile-command . "make -j 4") ;; other customisation )) ;; other modes )...
user avatar
2 votes
Accepted

"not in compilation buffer" error using compilation-next-error in elisp function

Try the following: (defun write-first-error-to-file() "function copies first error in compilation buffer and writes it to specified file" (interactive) (let (beg) (set-buffer "...
user avatar
  • 20.6k
2 votes

is there a way to get two separate next-error lists so I can bind them to two different keys

Doing all the preparation to be able to do that is going to be more work than it is worth: you have to write special functions to use the buffer(s) of interest and then bind them to keys. I think it ...
user avatar
  • 20.6k
2 votes
Accepted

Compilation mode error output parse not matching

The LINE and COLUMN entries (2 and 3 in your code) refers to the subgroup of the regexp. Your regexp only contains two subgroups, so they should be 1 and 2. In addition, the first entry after the ...
user avatar
  • 5,825
1 vote
Accepted

How to move the point to next link?

tldr; C-x ` Details Picking up the comment from Vladimir Panteleev you can find key bindings to next-error with C-h w next-error Further I suggest you bind the command repeat to a key (I have ...
user avatar
  • 2,646
1 vote

How to automatically select *interpretation* buffer window

Is there a robust way to automatically make this *interpretation* buffer current after it pops up, instead of having to type C-xo (other-window)? There are several ways of varying degree of hackiness ...
user avatar
  • 11.4k
1 vote
Accepted

Emacs Compile Mode: Extra characters before filename result in bad match

A variable called compilation-error-regexp-alist-alist (I will call c-e-r-a-a) is a list of (<name> <regexp> <list of regexp match numbers...>). From the output of `M-x describe-...
user avatar
  • 1,173
1 vote

How can I add a compilation error regex for node js?

compile-goto-error didn't work for me when I tried the answer from the tweet -- it seems like the line number was being captured by the filename group. From this emacs.d I tried: (setq compilation-...
user avatar
1 vote

How to use a separate window for compilation output?

Does this do what you want? It provides a display-buffer-reuse-major-mode-window function for use with display-buffer-alist, and configures an entry which targets compilation-mode buffers. You can ...
user avatar
  • 43.9k
1 vote

How to syntax-colour py.test output?

I believe this accomplished by modifying compilation-mode-font-lock-keywords and compilation-error-regexp-alist(-alist)?. If py-test is running in a raw compilation-mode than the appropriate alists ...
user avatar
  • 4,004
1 vote
Accepted

Clickable links to py.test stack frame lines in compilation-mode

Running py.test should automatically do it. Go to any directory or python file, run M-x compile RET py.test RET, you will get colorized output and traceback with hyperlinks like this. It is better to ...
user avatar

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