7

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-path (add-to-list 'compilation-search-path "/path/to/build") Found on this question: How to adjust the path that Emacs' compile-goto-error gets from the ...


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 ...


6

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 keep the directory-local settings somewhere other than in the .dir-locals.el file. Another way to accomplish this same thing is to make settings directory-...


6

Emacs cannot detect why a child process is waiting. It might wait because it is calling read() on stdin, but it might just as well just perform an expensive computation while optimizing C code. However, what you can detect is whether the compilation process has written a prompt. Compilation Mode runs compilation-filter-hook whenever it has inserted output ...


5

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. compile will run its command at this directory of the Dired buffer. The advantage of this is that you don't have to M-x cd or traverse directories when you want to ...


4

This alternate command should do the trick: (defun compile-in-dir (dir command) (interactive "DCompile in directory: \nsCommand: ") (let ((default-directory dir)) (compile command))) Alternatively, after you have run the compilation using the regular compile command, you can eval (setq default-directory "~/somedir") in the *compilation* buffer. ...


3

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 (SUBMATCH FACE), where SUBMATCH is the number of a submatch and FACE is an expression which evaluates to a face name (a symbol or string). In your case, it ...


3

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" syntax, and so the regular expression was not properly formed. I'm not super well-versed on the differences between the various syntaxes. I imagine that's a ...


3

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-truncate-lines 1) (save-excursion (beginning-of-buffer) (compilation-next-error 1) (call-interactively 'set-mark-command) (end-of-buffer) (...


3

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 enough text has been produced in order to satisfy all regexp's requirements ? For example, there could be one matching the start and end of buffer, which would ...


2

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-alist-alist like described in this nice post (note that I had to restart emacs for the changes to take effect).


2

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 *compilation* buffer is shown in a window with a left fringe (see Fringes), the locus-visiting commands put an arrow in the fringe, pointing to the current error ...


2

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 into ~/tmp/subDirA/test.cc. (The file local variable compilation-post-dir is a preparation for the solution.) #include <iostream> int main() { std::...


2

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 buffers and start the new compilation. It will create a new ‘compilation’ buffer.


2

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 the sudo method, called tramp-session-timeout. It defaults to 300 seconds, and shall behave as you like.


1

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 repeat on C-5) to quickly call next-error again.


1

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 to achieve this, but here is my preferred method. The *interpretation* buffer is created by the command executable-interpret, bound to C-cC-x by default in sh-...


1

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 that the mode is compilation-mode and that C-c C-k is bound to command kill-compilation. Clicking that command name tells you: Kill the process made by the M-x ...


1

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-variable compilation-error-regexp-alist': Each elt has the form (REGEXP FILE [LINE COLUMN TYPE HYPERLINK HIGHLIGHT...]). If REGEXP matches, the FILE’th ...


1

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 then adapt the display-buffer-alist entry to target additional modes if you want this behaviour for other kinds of buffer as well. ;; Always open compilation ...


1

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 need to be added to the global font-lock-keywords & error-regexp-alists for compilation-mode. However I believe when defining a compilation derived mode with ...


1

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 use elpy as it provides better integration with test runners.


1

Kudos to @wvxvw for pointing me in the right direction. I was able to normalize the whitespace by advising ag-filter, which ag adds to compilation-filter-hook. (defun ivan/filter-whitespace (prefix-pattern) (save-excursion (forward-line 0) (let ((end (point)) beg) (goto-char compilation-filter-start) (forward-line 0) (setq beg (...


1

Ok, I solve this problem. I will share the answer. Before I had problem, I start my shell with csh but I would start in bash. So I added line with bash in my .cshrs to change it automatically each time. There was big conflict, I don't understand why but I found it based on advice of @icarus. Thank you very much. Finally I edit etc/passwd to change it ...


1

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-error-regexp-alist-alist ;; Tip: M-x re-builder to test this out (cons '(node "^[ ]+at \\(?:[^\(\n]+ \(\\)?\\([a-zA-Z\.0-9_/-]+\\):\\([0-9]+\\):\\(...


1

I use such workaround for the exact saving of point position in the compilation/grep buffer: (defun eab/compile-goto-error () (interactive) (let ((istc? truncate-lines)) (toggle-truncate-lines t) (let ((buf (current-buffer)) (line (- (count-lines (window-start) (point)) (if (eq (point) (point-at-bol)) 0 1))) ...


1

It looks like cygwin-mount.el only works for cygwin names. Emacs already comes with unmsys--file-name to convert msys names, so I used it to write an msys file name handler for expand-file-name and substitute-in-file-name (it's unclear to me how to know which operations are important, so I just followed cygwin-mount.el's lead. The code below seems to work ...


1

After experimenting with overriding $HOME and tracking some things through with bash -x as @Gilles suggested, I found my ~/.bash_profile included an isolated cd command, meaning the shell emacs spawned to compile/run commands was always left in my home directory. (Annoying, and apparently my fault, although I have no idea how that cd got there.)


1

Traceback highlighting is provided by the compile package. You can use M-x compile to run a script and get traceback highlighting. If you have an existing buffer with a traceback, you can use M-x compilation-minor-mode to highlight the tracebacks there.


1

The only thing I know of for this is setting process-adaptive-read-buffering to nil before starting the process. I don't know whether this will help with your situation or not.


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