Closed gordonmcshane closed 8 years ago
This seems confusing to me. Could you clarify?
Suppose I search for functions in my git repo, so I have a buffer called *ag search text:defun dir:~/projects/ag.el/*
. With this change, if I run M-x ag-project RET defvar RET
, I have a buffer called *ag search text:defun dir:~/projects/ag.el/*
that contains a text search for "defvar". I don't think that's what users expect.
Are you manually renaming buffers, or using some other workflow?
Ahh, I hadn't thought of that.
RE: renaming buffers, yes, what I do is: ag RET some-symbol-name RET /some/path RET
which I then rename. I also do this with (compile)
, but compilation-mode
works as I expect. Say I visit *renamed compilation buffer*
and press g
. I get recompilation in that same buffer using the original parameters passed to (compile)
, however, do this in an ag-mode
buffer with ag-reuse-buffers
set to non-nil
and whatever was in the default *ag search*
is clobbered and replaced with an ag search using the parameters from *renamed ag search buffer*
instead of just re-using that same buffer. To give you a use case, I might have a few ag search buffers open that serve as a "TODO list" of deprecated function usage. As I update the code, I often will return to the ag buffer and press g to get an updated count of matches.
I guess what I was attempting to accomplish was having ag-mode
behave more like compilation-mode
in regards to (recompile)
.
Thanks, that's really helpful.
So, I think the goal here is to allow users to run recompile
in renamed buffers. I think that's definitely worth supporting, although this current PR doesn't quite achieve that. This is probably something that should work regardless of the value of ag-reuse-buffers
.
I absolutely agree that my solution falls short. If I have time, I'll revisit and see if I can't come up with something to handle the situation in a generic fashion.
I'm going to close this. If you do come up with a generic solution, I'd be very happy to merge.
*ag search*
buffer. Allows multiple renamed ag-mode buffers to have (recompile) run on them.This is very helpful behavior when you have multiple ag results buffers open, and need to re-run ag on them from time to time, but don't want to clobber
*ag search*
.