unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24585: 25.1; avoid hack in ggtags.el to run compilation-auto-jump timer
@ 2016-10-02  4:56 Leo Liu
  2016-10-02 20:35 ` Stefan Monnier
  0 siblings, 1 reply; 28+ messages in thread
From: Leo Liu @ 2016-10-02  4:56 UTC (permalink / raw)
  To: 24585; +Cc: Stefan Monnier


,----[ 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





^ permalink raw reply related	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2020-10-07  3:30 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).