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

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

bug#21747: 25.0.50; while-no-input breaks kbd event handling when called


From: Eli Zaretskii
Subject: bug#21747: 25.0.50; while-no-input breaks kbd event handling when called from post-command-hook
Date: Sat, 24 Oct 2015 17:05:10 +0300

> From: Tassilo Horn <tsdh@gnu.org>
> Cc: bruce.connor.am@gmail.com,  monnier@iro.umontreal.ca,  storm@cua.dk,  
> 21747@debbugs.gnu.org
> Date: Sat, 24 Oct 2015 15:30:11 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> My recipe for reproduction is
> >> 
> >>   1. emacs -Q
> >>   2. M-x package-initialize
> >>   3. M-x global-aggressive-indent-mode
> >>   4. C-x C-f ~/test.sh
> >>   5. type the keyword if where the i is displayed immediately
> >>      and the display of f is delayed
> >> 
> >> This does only occur for sh-mode keywords like if, while, etc. where the
> >> delaying starts with after entering the last char of the keyword.  Also,
> >> I can reproduce that problem only if test.sh doesn't exist.
> >
> > I don't understand: are you saying that the post-command-hook finished
> > its job, and yet redisplay is not entered?
> 
> Yes, or rather the function aggressive-indent--indent-if-changed which
> is in post-command-hook finished.
> 
> >> Or well, I just tried what happens when I replace the `while-no-input'
> >> with a `progn'.  Then Emacs goes into some infloop.  Attaching with gdb
> >> shows:
> >
> > There's a procedure in etc/DEBUG to determine which call-stack frame
> > infloops, please use it and tell what you found.
> 
> Ok, so with the aggressive-indent--indent-if-changed where
> while-no-input is replaced with progn, I perform my recipe until emacs
> infloops.  Then do "kill -TSTP <PID>" and repeatedly "finish" at the gdb
> prompt.  But the last frame being displayed in GDB before finish doesn't
> return anymore is not always the same.  Most of the time it is poll ()
> from /usr/lib/libc.so.6.  Here are two other results.

No, that's bogus (GC cannot infloop, you just didn't wait long enough
for that "finish" to return).

The function that infloops is re-search-backward, because it is called
with LIMIT set to zero.  The real problem is here:

  (defun sh-smie--keyword-p ()
    "Non-nil if we're at a keyword position.
  A keyword position is one where if we're looking at something that looks
  like a keyword, then it is a keyword."
    (let ((prev (funcall smie-backward-token-function)))
      (if (zerop (length prev))
          (looking-back "\\`\\|\\s(" (1- (point)))  <<<<<<<<<<<<<<<<<<
        (assoc prev smie-grammar))))

What do you expect looking-back to do here when point is at BOB?





reply via email to

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