unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Leo Liu <sdl.web@gmail.com>
Cc: 24585@debbugs.gnu.org, Stefan Monnier <monnier@IRO.UMontreal.CA>
Subject: bug#24585: 25.1; avoid hack in ggtags.el to run compilation-auto-jump timer
Date: Fri, 04 Sep 2020 14:47:03 +0200	[thread overview]
Message-ID: <87imctbtfc.fsf@gnus.org> (raw)
In-Reply-To: <m160p2empz.fsf@gmail.com> (Leo Liu's message of "Sun, 09 Oct 2016 02:10:00 +0800")

Leo Liu <sdl.web@gmail.com> writes:

> On 2016-10-07 14:10 -0400, Stefan Monnier wrote:
>> Hmm... calling compilation--ensure-parse *should* help.
>> More specifically, if you call compilation--ensure-parse up to point-max
>> from compilation-finish-functions, I can't think of any reason why
>> compilation-error-properties should be called afterwards.  If you can
>> get a backtrace of when that happens, it would help.
>>
>> E.g. set a buffer-local var from compilation-finish-functions after
>> calling compilation--ensure-parse, and then add an assert in
>> compilation-error-properties to check that that var is not set yes.
>
> To the best of my knowledge that seems to work with change like this to
> compile.el:

[...]

This was the final message in this bug report, but looking at the patch
that supposedly fixes the problem, I don't understand how it makes a
difference: Putting (match-beginning) in a buffer-local variable
instead of passing it in directly seems like a no-op?

Checking whether the buffer is alive in compilation-auto-jump seems like
a good idea, though (any async function that switches to a buffer should
check whether it's alive first).

> -(defun compilation-auto-jump (buffer pos)
> -  (with-current-buffer buffer
> -    (goto-char pos)
> -    (let ((win (get-buffer-window buffer 0)))
> -      (if win (set-window-point win pos)))
> -    (if compilation-auto-jump-to-first-error
> -	(compile-goto-error))))
> +(defvar-local compilation-pending-auto-jump nil)
> +
> +(defun compilation-auto-jump (buffer)
> +  (when (buffer-live-p buffer)
> +    (with-current-buffer buffer
> +      (when compilation-pending-auto-jump
> +        (goto-char compilation-pending-auto-jump)
> +        (let ((win (get-buffer-window buffer 0)))
> +          (if win (set-window-point win compilation-pending-auto-jump)))
> +        (setq compilation-pending-auto-jump nil)
> +        (if compilation-auto-jump-to-first-error
> +            (compile-goto-error))))))
>
>  ;; This function is the central driver, called when font-locking to gather
>  ;; all information needed to later jump to corresponding source code.
> @@ -1126,8 +1131,8 @@ POS and RES.")
>      (when (and compilation-auto-jump-to-next
>                 (>= type compilation-skip-threshold))
>        (kill-local-variable 'compilation-auto-jump-to-next)
> -      (run-with-timer 0 nil 'compilation-auto-jump
> -                      (current-buffer) (match-beginning 0)))
> +      (setq compilation-pending-auto-jump (match-beginning 0))
> +      (run-with-timer 0 nil 'compilation-auto-jump (current-buffer)))
>
>      (compilation-internal-error-properties
>       file line end-line col end-col type fmt)))

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2020-09-04 12:47 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-02  4:56 bug#24585: 25.1; avoid hack in ggtags.el to run compilation-auto-jump timer Leo Liu
2016-10-02 20:35 ` Stefan Monnier
2016-10-03  3:01   ` Leo Liu
2016-10-03 13:24     ` Stefan Monnier
2016-10-03 15:22       ` Leo Liu
2016-10-03 18:45         ` Stefan Monnier
2016-10-04 13:08           ` Leo Liu
2016-10-04 16:18             ` Stefan Monnier
2016-10-05  7:39               ` Leo Liu
2016-10-05 10:25                 ` Eli Zaretskii
2016-10-06 16:12                   ` Leo Liu
2016-10-06 18:10                     ` Stefan Monnier
2016-10-06 18:31                       ` Leo Liu
2016-10-06 18:37                         ` Eli Zaretskii
2016-10-07  1:21                           ` Leo Liu
2016-10-07  2:27                             ` Leo Liu
2016-10-07  8:02                               ` Eli Zaretskii
2016-10-07 12:46                               ` Stefan Monnier
2016-10-07 17:07                                 ` Leo Liu
2016-10-07 18:10                                   ` Stefan Monnier
2016-10-08 18:10                                     ` Leo Liu
2020-09-04 12:47                                       ` Lars Ingebrigtsen [this message]
2020-09-04 14:29                                         ` Stefan Monnier
2020-09-04 15:02                                           ` Lars Ingebrigtsen
2020-09-04 15:45                                             ` Stefan Monnier
2020-09-05 12:32                                               ` Lars Ingebrigtsen
2020-10-07  3:30                                                 ` Lars Ingebrigtsen
2016-10-07  7:59                             ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87imctbtfc.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=24585@debbugs.gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    --cc=sdl.web@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).