Subject: bug#17267: 24.3.50; 100% cpu usage of emacs when copy some lines to org buffer

From: Eli Zaretskii <[email-masked]>
Date: Tue, 15 Apr 2014 12:30:21 +0300

> From: Jingtao Xu <[email-masked]>
> Date: Tue, 15 Apr 2014 15:46:13 +0800
> 
> 
> I wrote one elisp function to collect the code changes of a svn diff file:
> =============================================================================================
> (defun my-svn-codes-changes (&optional proj)
>   (interactive)
>   (if (null proj)
>     (setf proj (my-select-project)))
>   (with-current-buffer (find-file-noselect (my-path proj (concat (my-p-id proj) ".diff")))
>     (fundamental-mode)
>     (goto-char (point-min))
>     (let (result-list cur-file cur-file-changes)
>       (while (search-forward "Index: " nil t)
>         (setf cur-file (buffer-substring-no-properties (point) (line-end-position)))
>         (next-line 3)
>         ;;(loop repeat 3 do (next-line))
>         (let ((start-pos (line-beginning-position))
>               (end-pos (point-max)))
>           (when (search-forward "Index: " nil t)
>             (previous-line)
>             (setf end-pos (line-end-position)))
>           (setf cur-file-changes (buffer-substring-no-properties start-pos end-pos))
>           (push (cons cur-file cur-file-changes) result-list)
>           (goto-char end-pos)))
>       (reverse result-list))))
> =============================================================================================
> It works fine in emacs 24.3.1,but in emacs 24.3.50,it will enter into an infinite loop and never return.
> 
> I debugged emacs source code and find the infinite loop seems to happen in c function handle_stop,of file xdisp.c.
> emacs nerver return from this function,and in handle_stop,when it call function handle_invisible_prop,it will
> return HANDLED_RECOMPUTE_PROPS.

Sorry, I don't see any obvious relation between the above function and
the part of xdisp.c where you see the infloop.  Is it possible for you
to construct a reproducible recipe for this bug, starting with "emacs -Q",
including any external files necessary for reproducing the bug?  If so,
please post the recipe and the files here.

Thanks.