1

I want to be able to use grep to find matching lines and to be able to jump through them using next-error and previous-error however I don't feel the need to have the match list on screen and it takes up considerable space. I would like to find a way to get similar functionality without having to have the window visible.

I managed to avoid showing the window using (setq-default display-buffer-alist '(("\\*grep\\*" (display-buffer-no-window)))) however when the buffer is not in a visible window I get an error when using next-error.

Debugger entered--Lisp error: (wrong-type-argument window-live-p nil)
  #<subr select-window>(nil nil)
  ad-Advice-select-window(#<subr select-window> nil)
  apply(ad-Advice-select-window #<subr select-window> nil)
  select-window(nil)
  rustc-scroll-down-after-next-error()
  run-hooks(next-error-hook)
  next-error-found(#<buffer *grep*> #<buffer controller.rs>)
  next-error(nil)
  funcall-interactively(next-error nil)
  call-interactively(next-error nil nil)
  command-execute(next-error)

Manually making the window visible then running next-error works, so it isn't broken but something assumes the window is visible for some reason.

  • 2
    Please provide a link to the library where you got rustc-scroll-down-after-next-error, or if you wrote it yourself, then provide the code for that function. – lawlist Dec 26 '19 at 17:40
  • Ah, this is from rust-mode. I guess this might be a bug in that code. I'll investigate and file a bug report. github.com/rust-lang/rust-mode/blob/… – Kevin Cox Jan 2 at 18:49
0

You say that for you next-error doesn't work unless the buffer with the "error" messages is visible (i.e., in a visible window). I don't see that.

Can you repro the problem starting with emacs -Q (no init file)? If not, bisect your init file to find the culprit.

When I use emacs -Q (with any Emacs version), and then I grep or whatever, to get some "error" messages in a buffer, and then I delete the window showing that buffer, next-error works just fine.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.