bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18856: 24.4; *grep* output buffer not getting fontified when jit-loc


From: Eli Zaretskii
Subject: bug#18856: 24.4; *grep* output buffer not getting fontified when jit-lock-defer-time is used
Date: Wed, 29 Oct 2014 17:01:20 +0200

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: David Engster <deng@randomsample.de>,  18856@debbugs.gnu.org
> Date: Tue, 28 Oct 2014 13:38:36 -0400
> 
> > I can overcome this problem if I add a call to
> > internal-timer-start-idle at the end of compilation-handle-exit.
> > Not sure this is TRT, though.
> 
> I don't think this is right: as mentioned the issue is not specific to
> compilation, so we'd really need to call internal-timer-start-idle from
> the code that runs process-filters.
> 
> And it implies a different definition of "idle" than the one we've had
> so far, so it'd be an incompatible change.
> 
> > then I see a single event, BUFFER_SWITCH_EVENT, being reported.
> > Should input-pending-p ignore such events?
> 
> I think so, yes, because these events are not (consciously) generated by
> the user.

Is the below an OK solution for the issues discussed here?

If OK, I'd like to commit the compile.el part, the one that turns off
jit-lock-deferral in compilation buffers, to the release branch, since
it's a regression from Emacs 23.  OK?

--- src/keyboard.c~0    2014-10-19 07:08:12 +0300
+++ src/keyboard.c      2014-10-29 16:44:02 +0200
@@ -404,6 +404,7 @@ static struct timespec timer_last_idlene
 #define READABLE_EVENTS_DO_TIMERS_NOW          (1 << 0)
 #define READABLE_EVENTS_FILTER_EVENTS          (1 << 1)
 #define READABLE_EVENTS_IGNORE_SQUEEZABLES     (1 << 2)
+#define READABLE_EVENTS_IGNORE_BUFFER_SWITCH   (1 << 3)
 
 /* Function for init_keyboard to call with no args (if nonzero).  */
 static void (*keyboard_init_hook) (void);
@@ -3495,7 +3496,8 @@ readable_events (int flags)
                       && event->part == scroll_bar_handle
                       && event->modifiers == 0)
 #endif
-                 )
+                 && !((flags & READABLE_EVENTS_IGNORE_BUFFER_SWITCH)
+                      && event->kind == BUFFER_SWITCH_EVENT))
                return 1;
              event++;
               if (event == kbd_buffer + KBD_BUFFER_SIZE)
@@ -10019,10 +10021,12 @@ If CHECK-TIMERS is non-nil, timers that
   /* Process non-user-visible events (Bug#10195).  */
   process_special_events ();
 
-  return (get_input_pending ((NILP (check_timers)
-                              ? 0 : READABLE_EVENTS_DO_TIMERS_NOW)
-                            | READABLE_EVENTS_FILTER_EVENTS)
-         ? Qt : Qnil);
+  int flags =
+    READABLE_EVENTS_IGNORE_BUFFER_SWITCH | READABLE_EVENTS_FILTER_EVENTS;
+
+  if (!NILP (check_timers))
+    flags |= READABLE_EVENTS_DO_TIMERS_NOW;
+  return (get_input_pending (flags) ? Qt : Qnil);
 }
 
 DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0,


--- lisp/progmodes/compile.el~  2014-10-28 15:11:16 +0200
+++ lisp/progmodes/compile.el   2014-10-29 16:50:40 +0200
@@ -1975,6 +1975,12 @@
        compilation-page-delimiter)
   ;; (set (make-local-variable 'compilation-buffer-modtime) nil)
   (compilation-setup)
+  ;; Turn off deferred fontifications in the compilation buffer, if
+  ;; the user turned them on globally.  This is because idle timers
+  ;; aren't re-run after receiving input from a subprocess, so the
+  ;; buffer is left unfontified after the compilation exits, until
+  ;; some other input event happens.
+  (set (make-local-variable 'jit-lock-defer-time) nil)
   (setq buffer-read-only t)
   (run-mode-hooks 'compilation-mode-hook))
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]