all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Anand Tamariya <atamariya@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: Java: Jump to file from stacktrace
Date: Mon, 19 Apr 2021 11:45:26 +0530	[thread overview]
Message-ID: <CADm7Y4kSRE+X8tqoFqpWghSbihew0Cn-5R-_dB7-QDGL=zJ0RQ@mail.gmail.com> (raw)
In-Reply-To: <CADm7Y4m=C5UUexZLowa7=ww_R9_=0T1GgnHZsPJjUJ4DYo2YOQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2248 bytes --]

Additionally, one can use next-error and previous-error to quickly locate
the stacktrace in the log file.

On Sun, Apr 18, 2021 at 8:21 PM Anand Tamariya <atamariya@gmail.com> wrote:

> If you need to jump into a file from stacktrace in a log, use the patch in
> compile.el . Then with an appropriate find-file function, you can easily
> jump to the location.
>
> (defun gud-compilation-find-file (_marker filename _directory &rest
> _formats)
>   "Find a buffer for file FILENAME."
>   (ede-find-file filename))
>
> (setq next-error-function 'compilation-next-error-function
>           compilation-locs (make-hash-table :test 'equal :weakness 'value)
>           compilation-find-file 'gud-compilation-find-file)
>
>
> diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
> index 6b39dcd3d5..a21be665f5 100644
> --- a/lisp/progmodes/compile.el
> +++ b/lisp/progmodes/compile.el
> @@ -802,6 +802,7 @@ compilation-disable-input
>  ;; value is a FILE-STRUCTURE as described above, with the car eq to the
> hash
>  ;; key.  This holds the tree seen from root, for storing new nodes.
>  (defvar compilation-locs ())
> +(make-variable-buffer-local 'compilation-locs)
>
>  (defvar compilation-debug nil
>    "Set this to t before creating a *compilation* buffer.
> @@ -2586,7 +2587,7 @@ compilation-next-error-function
>        (with-current-buffer
>            (if (bufferp (caar (compilation--loc->file-struct loc)))
>                (caar (compilation--loc->file-struct loc))
> -            (apply #'compilation-find-file
> +            (apply compilation-find-file
>                     marker
>                     (caar (compilation--loc->file-struct loc))
>                     (cadr (car (compilation--loc->file-struct loc)))
> @@ -2869,6 +2870,10 @@ compilation-goto-locus-delete-o
>    (remove-hook 'pre-command-hook
>                #'compilation-goto-locus-delete-o))
>  ^L
> +(defvar compilation-find-file #'compilation-find-file
> +  "Function to find a file in compilation buffer.")
> +(make-variable-buffer-local 'compilation-find-file)
> +
>  (defun compilation-find-file (marker filename directory &rest formats)
>    "Find a buffer for file FILENAME.
>  If FILENAME is not found at all, ask the user where to find it.
>

[-- Attachment #2: Type: text/html, Size: 2851 bytes --]

  reply	other threads:[~2021-04-19  6:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-18 14:51 Java: Jump to file from stacktrace Anand Tamariya
2021-04-19  6:15 ` Anand Tamariya [this message]
2021-04-19 12:41 ` Eli Zaretskii
2021-04-19 13:47   ` Anand Tamariya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADm7Y4kSRE+X8tqoFqpWghSbihew0Cn-5R-_dB7-QDGL=zJ0RQ@mail.gmail.com' \
    --to=atamariya@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.