From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs 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 Message-ID: <87imctbtfc.fsf@gnus.org> References: <83twcrks7q.fsf@gnu.org> <83int5jpde.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33978"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 24585@debbugs.gnu.org, Stefan Monnier To: Leo Liu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 04 14:49:04 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kEB9L-0008l2-JM for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 04 Sep 2020 14:49:03 +0200 Original-Received: from localhost ([::1]:59098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kEB9K-0006kV-EG for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 04 Sep 2020 08:49:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kEB8M-0005Sf-CY for bug-gnu-emacs@gnu.org; Fri, 04 Sep 2020 08:48:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54593) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kEB8M-0007S8-22 for bug-gnu-emacs@gnu.org; Fri, 04 Sep 2020 08:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kEB8M-00006T-0a for bug-gnu-emacs@gnu.org; Fri, 04 Sep 2020 08:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 04 Sep 2020 12:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24585 X-GNU-PR-Package: emacs Original-Received: via spool by 24585-submit@debbugs.gnu.org id=B24585.1599223637329 (code B ref 24585); Fri, 04 Sep 2020 12:48:01 +0000 Original-Received: (at 24585) by debbugs.gnu.org; 4 Sep 2020 12:47:17 +0000 Original-Received: from localhost ([127.0.0.1]:37902 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kEB7c-00005F-KP for submit@debbugs.gnu.org; Fri, 04 Sep 2020 08:47:16 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:48146) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kEB7b-0008WT-G3 for 24585@debbugs.gnu.org; Fri, 04 Sep 2020 08:47:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=GH6yfkA7rp2AdJkuC04ndqekFjBkd9ksXeYajPMSTME=; b=Pq+9RY1s1wmbn2eD3Wkw8ir1qR pTBjNoKwxakgn1unAuPmQX8QEbMsQ8xHc5RrYly+49KpwYTU6y4vAEvgjBhN0vtibcOSVyq8dP9R5 SQj1TwrUuLyZNs1v1cHSz4130Ln0F1N69CHe7noZJ9jCGs305xg+X/K1HqGZJQDQzOXA=; Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kEB7Q-0007eH-Tb; Fri, 04 Sep 2020 14:47:08 +0200 X-Now-Playing: Meg Baird & Mary Lattimore's _Ghost Forests_: "Damaged Sunset" In-Reply-To: (Leo Liu's message of "Sun, 09 Oct 2016 02:10:00 +0800") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:187121 Archived-At: Leo Liu 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