emacs-libvterm icon indicating copy to clipboard operation
emacs-libvterm copied to clipboard

Is it possible for vterm to recognize `compilation-error-regexp-alist`?

Open SreenivasVRao opened this issue 3 years ago • 2 comments

Would be great if I could get highlighting on error lines within vterm. I use the compilation buffer currently, but I think vterm might be faster because I have a lot of text (1000s of lines) being output from the compilation process.

SreenivasVRao avatar Apr 02 '21 22:04 SreenivasVRao

I've never used this feature myself, but vterm has some support for being a compilation buffer. I know it's there (we have functions like vterm--compilation-setup, vterm-next-error-function, ...), but I cannot direct you on how to use this.

And if you want to simply highlight something, you can switch to vterm-copy-mode and use any function that highlights the words you want (e.g., the built in highlight-regexp).

Sbozzolo avatar Apr 02 '21 23:04 Sbozzolo

I think compilation-shell-minor-mode works with vterm. To initialise this automatically for every vterm buffer, this seems to work for me:

(use-package vterm
  :ensure t
  :hook (vterm-mode . compilation-shell-minor-mode))

That mode sets up a few bindings (in compilation-shell-minor-mode-map), like:

    (define-key map "\M-\C-m" 'compile-goto-error)
    (define-key map "\M-\C-n" 'compilation-next-error)
    (define-key map "\M-\C-p" 'compilation-previous-error)
    (define-key map "\M-{" 'compilation-previous-file)
    (define-key map "\M-}" 'compilation-next-file)

huonw avatar Mar 27 '24 05:03 huonw