From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Leo Liu Newsgroups: gmane.emacs.bugs Subject: bug#24585: 25.1; avoid hack in ggtags.el to run compilation-auto-jump timer Date: Sun, 02 Oct 2016 12:56:40 +0800 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1475384324 23926 195.159.176.226 (2 Oct 2016 04:58:44 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 2 Oct 2016 04:58:44 +0000 (UTC) Cc: Stefan Monnier To: 24585@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 02 06:58:39 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bqYqy-0003KQ-G9 for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Oct 2016 06:58:20 +0200 Original-Received: from localhost ([::1]:58044 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqYqw-0001tE-56 for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Oct 2016 00:58:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52336) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqYql-0001t9-KF for bug-gnu-emacs@gnu.org; Sun, 02 Oct 2016 00:58:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bqYqh-0000uI-1g for bug-gnu-emacs@gnu.org; Sun, 02 Oct 2016 00:58:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35248) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqYqg-0000uE-Tv for bug-gnu-emacs@gnu.org; Sun, 02 Oct 2016 00:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bqYqg-0008HX-6y; Sun, 02 Oct 2016 00:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Leo Liu Original-Sender: "Debbugs-submit" Resent-CC: monnier@iro.umontreal.ca, bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 Oct 2016 04:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 24585 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: Stefan Monnier Original-Received: via spool by submit@debbugs.gnu.org id=B.147538422231745 (code B ref -1); Sun, 02 Oct 2016 04:58:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Oct 2016 04:57:02 +0000 Original-Received: from localhost ([127.0.0.1]:41436 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bqYph-0008Fu-Su for submit@debbugs.gnu.org; Sun, 02 Oct 2016 00:57:02 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:33057) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bqYpf-0008Fc-Op for submit@debbugs.gnu.org; Sun, 02 Oct 2016 00:57:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bqYpZ-0000Yk-Ey for submit@debbugs.gnu.org; Sun, 02 Oct 2016 00:56:54 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:58948) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqYpZ-0000YW-BZ for submit@debbugs.gnu.org; Sun, 02 Oct 2016 00:56:53 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqYpW-0001jY-T6 for bug-gnu-emacs@gnu.org; Sun, 02 Oct 2016 00:56:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bqYpS-0000Wy-PO for bug-gnu-emacs@gnu.org; Sun, 02 Oct 2016 00:56:49 -0400 Original-Received: from mail-pa0-x241.google.com ([2607:f8b0:400e:c03::241]:34436) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqYpS-0000Wn-IT for bug-gnu-emacs@gnu.org; Sun, 02 Oct 2016 00:56:46 -0400 Original-Received: by mail-pa0-x241.google.com with SMTP id r9so6065752paz.1 for ; Sat, 01 Oct 2016 21:56:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version; bh=8+qrl9pL48acv/U/4VhuC+WNEDOBd26dMgzQ51AV4go=; b=eRNW60ZLEg8X+pFn0zdkCTzBcwP3kgTmX+wuWT4/jeftY/RVXvSwa/4onD7Jr/oOHc 1Oip5unZjcQPYihLbjDBNDe/gCeWyy44rVqPQ0xSU3ae0i1NBeD/WayAeiFomGMypyYF tQ9/YlnPqOa58KRYJ7YPiCQQC60QeyS6DQcfdfyyPZVlBP6WzNzXeU3sVzsv/ZEXa4yU zybFPTOjOjtR0rO1HtiywffI1AR87RNWJXuXWw7oFm0y/C8q8oH1WEUl6VbTki4VZL4v HWWwAPeSWBNHW5QkdCKPC93y8EDeuXOxPc9jRAMvzgZbCOraHwvmaXHzgyfINw08YjTj C9HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=8+qrl9pL48acv/U/4VhuC+WNEDOBd26dMgzQ51AV4go=; b=bs3lFrUFXxDEBA259U2oqN8WzpRNKWRsk6znfVGENP/v1QvxD1u1U3VXLJ8G5+Rv5h FSltmQe6PPaQUtneQzf1+sV1I/tHoFSdTKOUF2V6iIVMLRU6Tsl3E4d/MdbZV0+EUqP0 Nn8lq2URMquyvbvKQH+kXF/nQuaPsgx8q0GnpS9OuDXaDz3wlFpovCYzOfhD2kNmVmsr SDMufQBTQghzobQ6a9n4mwZwtNIPqrJFJpj8TgyOiPxAd4PJJQ6D7XE6NcBMQGz+Wnl1 8unEPlnPU4Y2KPhCMhRUdyL2Zg4TOYYdhXYQ5WidKlHGl8/IyQsX+jxjFuSrf1siO++m DZmw== X-Gm-Message-State: AA6/9RmN5zf6sEky3qGs7eW3QZIJrRoDgIVV1TOfftqD/6SfWLd/qfavEhfWtgsmuhmaaw== X-Received: by 10.66.132.79 with SMTP id os15mr13583272pab.84.1475384205057; Sat, 01 Oct 2016 21:56:45 -0700 (PDT) Original-Received: from zeuss-MacBook-Pro.local ([139.59.241.182]) by smtp.gmail.com with ESMTPSA id e21sm37952939pfb.96.2016.10.01.21.56.43 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 01 Oct 2016 21:56:44 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:123884 Archived-At: ,----[ Stefan Monnier ] | > + ;; Manually run the `compilation-auto-jump' timer. Hackish but | > + ;; everything else seems unreliable. See: | > + ;; | > + ;; - http://debbugs.gnu.org/13829 | > + ;; - http://debbugs.gnu.org/23987 | > + ;; - https://github.com/leoliu/ggtags/issues/89 | > + ;; | > + (pcase (cl-find 'compilation-auto-jump timer-list :key #'timer--function) | > + (`nil ) | > + (timer (timer-event-handler timer))) | | I think this deserves a bug report, where we try to figure out how to | make it possible for ggtags.el to work properly without resorting to such | a hideous and brittle hack. | | A hack will probably have to stay for compatibility with older Emacsen, | but we should come up with a better solution for the future. `---- The hack is due to difficulty in making sure one timer is run before another that run nearly at the same time. And it's made harder because timer.el prepends a timer to existing timers running at the same time, which looks like a mistake. I think the hack in ggtags.el may be removed by the following patch to correct the said mistake: diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index c01ea497..337e1049 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el @@ -130,9 +130,9 @@ floating point number." (setq delta (time-add delta (list 0 0 (or usecs 0) (or psecs 0))))) (time-add time delta))) -(defun timer--time-less-p (t1 t2) +(defun timer--time-less-or-equal-p (t1 t2) "Say whether time value T1 is less than time value T2." - (time-less-p (timer--time t1) (timer--time t2))) + (not (time-less-p (timer--time t2) (timer--time t1)))) (defun timer-inc-time (timer secs &optional usecs psecs) "Increment the time set in TIMER by SECS seconds, USECS microseconds, @@ -172,7 +172,7 @@ fire repeatedly that many seconds apart." (let ((timers (if idle timer-idle-list timer-list)) last) ;; Skip all timers to trigger before the new one. - (while (and timers (timer--time-less-p (car timers) timer)) + (while (and timers (timer--time-less-or-equal-p (car timers) timer)) (setq last timers timers (cdr timers))) (if reuse-cell