Closed dlyr closed 4 years ago
Maybe I do not catch everything on the current behavior, but on my side this seems to work as I like to ;)
While compile
is nice and I've been meaning to look at it (I didn't realize it was such a simple call),
this patch is mostly about reversing the behavior I want and at the same time has issues (e.g., you should almost certainly not (setq compilation-buffer-name-function ..)
.. this is what LET
is for).
The acceptable approach would be:
As such this will not be merged; however if you want to make something like the above, let me know. I can also do this and @ you for the (compile)
stuff if you'd like.
Fair,
So actually what I would like to have is a next-error function, and auto scroll.
If you see how to handle that with your package that's perfect.
I could also maintain my fork with compile until I see some issue.
As far as I understand compile package, the setq is to have compile package stuff use the new buffer name, until you set it again, to compile another project for instance. Another way is to call compilation-start
which takes the name-function as optional argument.
Generally in lispy languages you avoid setq
/setf
especially for dynamic variables (that is, things created with defvar
). This is because you can easily set them with let
:
(let ((compilation-buffer-name-function #'cmake-build--build-buffer-name))
(compile ...)
This has the same effect, but the binding is only in effect during the let
block.
Err.. also, what do you mean "auto-scroll" .. does the compile buffer not scroll for you during compilation? (Because it does for me...) Or is this part of the next-error
stuff?
I didn't know for the let things (i'm far from a lisp guru ;)) and definitely give it a try. Yes the autoscroll is that the compilation buffer do not scroll automatically. I do not dig too far to check why, it may be some of my other config that interfere. If it's not the case I will give you feedback in an issue (but I do not have the time right now). Thanks for you quick answer.
(you're right auto scroll works perfectly with master version ... dunno why I could not get it working) (the let alternative you propose works also perfectly) (so the things that I miss is easy jump to error, and kill-compilation, but maybe it's already there I just do not know how to have it)
OK I added these things.
The compile window scrolling thing was a bit of an annoyance, and it's still unclear what the cause is, but if you switch to the window, temporarily or permanently, then call COMPILE
, scrolling works. This lead to me implementing a "switch to the compile buffer" option too, which I'm even using now.
Note I also use the t
flag to use comint mode with compile .. I'm not entirely sure what this is, except if it's not active, I can't hit C-c C-c to stop the build, which is bad. ;)
Not sure it's your question, but to kill the compilation I use
'kill-compilation
Thank you both for working on this - this was also on my TODO list, but you beat me into it.
Re, https://github.com/rpav/cmake-build.el/commit/624220b27028e13e9d58af316a1de6aa39164f93, would it be possible not to touch compilation-scroll-output
in cmake-build--compile
? It's a user configuration, IMHO, the package should honor it. For example, I have it set to 'first-error and intend to keep it this way with cmake-build too.
Fixed. That was an artifact of experimenting to get it to work at all really.
Also use the compile split window with auto scroll instead of the customized one. Still use custom name.
One issue is that next-error tracks the last started compilation output.