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

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.

In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.7)
 of 2014-04-15 on mini.funtoo
Windowing system distributor `The X.Org Foundation', version 11.0.11403000
Important settings:
  value of $LC_COLLATE: POSIX
  value of $LC_CTYPE: zh_CN.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=fcitx
  locale-coding-system: utf-8

Major mode: Lisp Interaction

Minor modes in effect:
  show-paren-mode: t
  global-eclim-mode: t
  savehist-mode: t
  recentf-mode: t
  ido-everywhere: t
  tabbar-mode: t
  global-auto-revert-mode: t
  Info-breadcrumbs-in-mode-line-mode: t
  global-company-mode: t
  company-mode: t
  global-auto-complete-mode: t
  auto-complete-mode: t
  yas/global-mode: t
  yas/minor-mode: t
  anything-dired-mode: Enable anything completion in Dired functions.
Bindings affected are C, R, S, H.
This is deprecated for Emacs24+ users, use `ac-mode' instead.
  auto-image-file-mode: t
  winner-mode: t
  display-time-mode: t
  evil-mode: t
  evil-local-mode: t
  pretty-lambda-mode: t
  shell-dirtrack-mode: t
  eldoc-mode: t
  which-function-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Recent input:
<down-mouse-1> <mouse-movement> <mouse-1> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <menu-bar> <help-menu> <send-emacs-bug-report> 
1 0 0 % SPC c p u SPC u s a g e SPC o f SPC e m a c 
s SPC w h e n SPC c o p y SPC s o m e SPC l i n e s 
SPC t o SPC o r g SPC b u f f e r <return> T h s SPC 
C-g a <backspace> i s SPC C-g s C-g C-c C-k y C-x C-c 
C-g s 1 <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <menu-bar> <help-menu> 
<send-emacs-bug-report>

Recent messages:
Checking 70 files in /home/projects/emacs/lisp/erc...
Checking 48 files in /home/projects/emacs/lisp/emulation...
Checking 153 files in /home/projects/emacs/lisp/emacs-lisp...
Checking 57 files in /home/projects/emacs/lisp/calendar...
Checking 87 files in /home/projects/emacs/lisp/calc...
Checking 95 files in /home/projects/emacs/lisp/obsolete...
Checking for load-path shadows...done
Quit [3 times]
Message modified; kill anyway? (y or n) y
(No files need saving) [2 times]
Quit

Load-path shadows:
/data/jingtao/.emacs.d/el-get/wanderlust/utils/rfc2368 hides /data/jingtao/.emacs.d/el-get/wanderlust/site-lisp/wl/rfc2368
/data/jingtao/.emacs.d/el-get/wanderlust/utils/wl-addrbook hides /data/jingtao/.emacs.d/el-get/wanderlust/site-lisp/wl/wl-addrbook
/data/jingtao/.emacs.d/el-get/wanderlust/utils/im-wl hides /data/jingtao/.emacs.d/el-get/wanderlust/site-lisp/wl/im-wl
/data/jingtao/.emacs.d/el-get/wanderlust/utils/wl-complete hides /data/jingtao/.emacs.d/el-get/wanderlust/site-lisp/wl/wl-complete
/data/jingtao/.emacs.d/el-get/wanderlust/utils/ssl hides /data/jingtao/.emacs.d/el-get/wanderlust/site-lisp/wl/ssl
/data/jingtao/.emacs.d/el-get/wanderlust/utils/wl-mailto hides /data/jingtao/.emacs.d/el-get/wanderlust/site-lisp/wl/wl-mailto
/home/jingtao/Dropbox/emacs/site-lisp/org-jira/org-jira hides /home/jingtao/Dropbox/emacs/site-lisp/org-mode/contrib/lisp/org-jira
/home/jingtao/Dropbox/emacs/site-lisp/auto-complete/auto-complete hides /data/jingtao/.emacs.d/elpa/auto-complete-20131128.233/auto-complete
/home/jingtao/Dropbox/emacs/site-lisp/auto-complete/auto-complete-config hides /data/jingtao/.emacs.d/elpa/auto-complete-20131128.233/auto-complete-config
/home/jingtao/Dropbox/emacs/site-lisp/magit/magit-wip hides /data/jingtao/.emacs.d/elpa/magit-20140218.701/magit-wip
/home/jingtao/Dropbox/emacs/site-lisp/magit/magit hides /data/jingtao/.emacs.d/elpa/magit-20140218.701/magit
/home/jingtao/Dropbox/emacs/site-lisp/magit/magit-blame hides /data/jingtao/.emacs.d/elpa/magit-20140218.701/magit-blame
/home/jingtao/Dropbox/emacs/site-lisp/magit/magit-key-mode hides /data/jingtao/.emacs.d/elpa/magit-20140218.701/magit-key-mode
/home/jingtao/Dropbox/emacs/site-lisp/git-modes/git-rebase-mode hides /data/jingtao/.emacs.d/elpa/git-rebase-mode-20140125.1553/git-rebase-mode
/home/jingtao/Dropbox/emacs/site-lisp/git-modes/git-commit-mode hides /data/jingtao/.emacs.d/elpa/git-commit-mode-20140125.1553/git-commit-mode
/home/jingtao/Dropbox/emacs/site-lisp/auto-complete/popup hides /data/jingtao/.emacs.d/elpa/popup-20140207.1702/popup
/home/jingtao/Dropbox/emacs/site-lisp/gnuplot-mode.0.6.0/gnuplot-gui hides /usr/share/emacs/site-lisp/gnuplot/gnuplot-gui
/home/jingtao/Dropbox/emacs/site-lisp/gnuplot-mode.0.6.0/gnuplot hides /usr/share/emacs/site-lisp/gnuplot/gnuplot
/home/jingtao/Dropbox/emacs/site-lisp/git-emacs/git-blame hides /usr/share/emacs/site-lisp/git/git-blame
/home/jingtao/Dropbox/emacs/site-lisp/html-helper-mode/tempo hides /home/jingtao/Dropbox/emacs/site-lisp/tempo
/home/jingtao/Dropbox/emacs/site-lisp/org-mode/contrib/lisp/htmlize hides /home/jingtao/Dropbox/emacs/site-lisp/htmlize
/usr/share/emacs/site-lisp/clisp-indent hides /home/jingtao/Dropbox/emacs/site-lisp/clisp-indent
/data/jingtao/.emacs.d/elpa/paredit-20140128.1248/paredit hides /home/jingtao/Dropbox/emacs/site-lisp/paredit
/home/jingtao/Dropbox/emacs/site-lisp/jquery-doc.el/jquery-doc hides /home/jingtao/Dropbox/emacs/site-lisp/jquery-doc
/home/jingtao/Dropbox/emacs/site-lisp/confluence-el/xml-rpc hides /home/jingtao/Dropbox/emacs/site-lisp/xml-rpc
/data/jingtao/.emacs.d/elpa/quack-0.42/quack hides /home/jingtao/Dropbox/emacs/site-lisp/quack
/usr/share/emacs/site-lisp/git/git hides /home/jingtao/Dropbox/emacs/site-lisp/git
/usr/share/emacs/site-lisp/emacs-w3m/mew-w3m hides /home/jingtao/Dropbox/emacs/site-lisp/mew-w3m
/home/jingtao/Dropbox/emacs/site-lisp/clisp-color hides /home/projects/dummy/site-lisp/clisp-color
/home/jingtao/Dropbox/emacs/site-lisp/dired-tar hides /home/projects/dummy/site-lisp/dired-tar
/home/jingtao/Dropbox/emacs/site-lisp/iterator hides /home/projects/dummy/site-lisp/iterator
/home/jingtao/Dropbox/emacs/site-lisp/traverselisp hides /home/projects/dummy/site-lisp/traverselisp
/usr/share/emacs/site-lisp/clisp-indent hides /home/projects/dummy/site-lisp/clisp-indent
/home/jingtao/Dropbox/emacs/site-lisp/dired-details hides /home/projects/dummy/site-lisp/dired-details
/home/jingtao/Dropbox/emacs/site-lisp/idomenu hides /home/projects/dummy/site-lisp/idomenu
/home/jingtao/Dropbox/emacs/site-lisp/mcomplete-history hides /home/projects/dummy/site-lisp/mcomplete-history
/home/jingtao/Dropbox/emacs/site-lisp/cl-indent-patches hides /home/projects/dummy/site-lisp/cl-indent-patches
/home/projects/dummy/site-lisp/custom hides /home/projects/emacs/lisp/custom
/home/jingtao/Dropbox/emacs/site-lisp/html-helper-mode/tempo hides /home/projects/emacs/lisp/tempo
/home/jingtao/Dropbox/emacs/site-lisp/xml hides /home/projects/emacs/lisp/xml
/data/jingtao/.emacs.d/el-get/flim/site-lisp/flim/hex-util hides /home/projects/emacs/lisp/hex-util
/home/jingtao/Dropbox/emacs/site-lisp/bs hides /home/projects/emacs/lisp/bs
/home/jingtao/Dropbox/emacs/site-lisp/cedet/common/ezimage hides /home/projects/emacs/lisp/ezimage
/data/jingtao/.emacs.d/el-get/flim/site-lisp/flim/md4 hides /home/projects/emacs/lisp/md4
/home/jingtao/Dropbox/emacs/site-lisp/image-dired hides /home/projects/emacs/lisp/image-dired
/home/jingtao/Dropbox/emacs/site-lisp/iimage hides /home/projects/emacs/lisp/iimage
/home/jingtao/Dropbox/emacs/site-lisp/inf-lisp hides /home/projects/emacs/lisp/progmodes/inf-lisp
/home/jingtao/Dropbox/emacs/site-lisp/bat-mode hides /home/projects/emacs/lisp/progmodes/bat-mode
/home/jingtao/Dropbox/emacs/site-lisp/newsticker-1.99/newst-ticker hides /home/projects/emacs/lisp/net/newst-ticker
/home/jingtao/Dropbox/emacs/site-lisp/org-jira/soap-client hides /home/projects/emacs/lisp/net/soap-client
/data/jingtao/.emacs.d/el-get/flim/site-lisp/flim/hmac-md5 hides /home/projects/emacs/lisp/net/hmac-md5
/data/jingtao/.emacs.d/el-get/flim/site-lisp/flim/sasl-ntlm hides /home/projects/emacs/lisp/net/sasl-ntlm
/home/jingtao/Dropbox/emacs/site-lisp/org-jira/soap-inspect hides /home/projects/emacs/lisp/net/soap-inspect
/data/jingtao/.emacs.d/el-get/flim/site-lisp/flim/ntlm hides /home/projects/emacs/lisp/net/ntlm
/data/jingtao/.emacs.d/el-get/flim/site-lisp/flim/sasl hides /home/projects/emacs/lisp/net/sasl
/home/jingtao/Dropbox/emacs/site-lisp/newsticker-1.99/newst-plainview hides /home/projects/emacs/lisp/net/newst-plainview
/data/jingtao/.emacs.d/el-get/flim/site-lisp/flim/sasl-digest hides /home/projects/emacs/lisp/net/sasl-digest
/home/jingtao/Dropbox/emacs/site-lisp/newsticker-1.99/newst-treeview hides /home/projects/emacs/lisp/net/newst-treeview
/home/jingtao/Dropbox/emacs/site-lisp/newsticker-1.99/newsticker hides /home/projects/emacs/lisp/net/newsticker
/home/jingtao/Dropbox/emacs/site-lisp/newsticker-1.99/newst-backend hides /home/projects/emacs/lisp/net/newst-backend
/home/jingtao/Dropbox/emacs/site-lisp/newsticker-1.99/newst-reader hides /home/projects/emacs/lisp/net/newst-reader
/data/jingtao/.emacs.d/el-get/flim/site-lisp/flim/sasl-cram hides /home/projects/emacs/lisp/net/sasl-cram
/data/jingtao/.emacs.d/el-get/flim/site-lisp/flim/hmac-def hides /home/projects/emacs/lisp/net/hmac-def
/data/jingtao/.emacs.d/el-get/wanderlust/utils/rfc2368 hides /home/projects/emacs/lisp/mail/rfc2368
/data/jingtao/.emacs.d/el-get/semi/site-lisp/semi/smime hides /home/projects/emacs/lisp/gnus/smime
/data/jingtao/.emacs.d/el-get/wanderlust/site-lisp/wl/utf7 hides /home/projects/emacs/lisp/gnus/utf7
/home/jingtao/Dropbox/emacs/site-lisp/emms/lisp/tq hides /home/projects/emacs/lisp/emacs-lisp/tq
/home/jingtao/Dropbox/emacs/site-lisp/package-x hides /home/projects/emacs/lisp/emacs-lisp/package-x
/data/jingtao/.emacs.d/el-get/semi/site-lisp/semi/pgg-def hides /home/projects/emacs/lisp/obsolete/pgg-def
/data/jingtao/.emacs.d/el-get/semi/site-lisp/semi/pgg-gpg hides /home/projects/emacs/lisp/obsolete/pgg-gpg
/data/jingtao/.emacs.d/el-get/semi/site-lisp/semi/pgg-parse hides /home/projects/emacs/lisp/obsolete/pgg-parse
/data/jingtao/.emacs.d/el-get/semi/site-lisp/semi/pgg-pgp hides /home/projects/emacs/lisp/obsolete/pgg-pgp
/data/jingtao/.emacs.d/el-get/semi/site-lisp/semi/pgg hides /home/projects/emacs/lisp/obsolete/pgg
/data/jingtao/.emacs.d/el-get/semi/site-lisp/semi/pgg-pgp5 hides /home/projects/emacs/lisp/obsolete/pgg-pgp5

Features:
(shadow mail-extr emacsbug message idna rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mail-utils eim eim-extra tramp-cache
paren virsh ab-indent-table my-g2 kindlegen cus-start cus-load baidu-pcs
my-theme help-at-pt eclimd company-emacs-eclim eclim-completion eclim
eclim-problems eclim-maven eclim-ant eclim-java eclim-project my-java
my-kbd my-erc .loaddefs el-get el-get-autoloads el-get-list-packages
el-get-notify help-mode el-get-dependencies el-get-build el-get-status
el-get-recipes el-get-byte-compile el-get-methods el-get-fossil
el-get-svn el-get-pacman el-get-github-zip el-get-github-tar
el-get-http-zip el-get-http-tar el-get-hg el-get-git-svn el-get-fink
el-get-emacswiki el-get-http el-get-emacsmirror el-get-github el-get-git
el-get-elpa el-get-darcs el-get-cvs el-get-bzr el-get-brew
el-get-builtin el-get-apt-get el-get-custom el-get-core autoload
lisp-mnt savehist-20+ keychain-environment recentf mcomplete-history
mcomplete ido-better-flex ido avoid tabbar desktop frameset saveplace
rect-mark ibuf-macs ibuf-ext ibuffer dired-extension dired-tar tramp-sh
my-sys grep-a-lot autorevert filenotify info+ newsticker-notify
company-files company-oddmuse company-keywords company-dabbrev-code
company-dabbrev company-etags company-gtags company-capf company-cmake
company-ropemacs company-xcode company-clang company-semantic
company-eclim company-template company-css company-nxml company ac-slime
auto-complete-config auto-complete popup yasnippet xdvi-search ipa
header2 lib-requires loadhist my-doc skeleton my-abbrev anything-config
w3m-bookmark bookmark rx grep dired-x dired-aux ffap anaphora org-drill
org-learn org-id hi-lock bbdb-autoloads bbdb jabber-autoloads
org-redmine json epa-file epa epg epg-config org-protocol org-crypt
ox-latex ox-icalendar ox-html ox-ascii ox-publish ox org-element appt
diary-lib diary-loaddefs org-table ob-sqlite ob-asymptote org-w3m
org-clock org-checklist org org-macro org-footnote org-pcomplete
org-list org-faces org-entities org-version ob-emacs-lisp ob ob-tangle
org-src ob-ref ob-lob ob-table ob-keys ob-exp ob-comint ob-core ob-eval
org-compat org-macs org-loaddefs find-func remember iimage image-file
my-gtd cal-china-x cal-china lunar solar cal-dst holidays hol-loaddefs
cal-menu calendar cal-loaddefs my-calendar my-maxima my-w3m winner
my-program my-english emms-player-vlc emms-player-mplayer emms-setup
emms-playlist-limit emms-volume emms-volume-amixer emms-i18n
emms-history emms-score emms-stream-info emms-metaplaylist-mode
emms-bookmarks emms-lastfm-client emms-lastfm-scrobbler w3m doc-view
jka-compr image-mode timezone w3m-hist w3m-fb bookmark-w3m w3m-ems
w3m-ccl ccl w3m-favicon w3m-image w3m-proc w3m-util xml emms-cue
emms-mode-line-icon emms-browser sort emms-playlist-sort
emms-last-played emms-player-xine emms-player-mpd tq emms-playing-time
emms-lyrics emms-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util url-parse url-vars mailcap
emms-player-simple hl-line emms-streams emms-tag-editor
emms-info-metaflac emms-mark emms-mode-line emms-cache emms-info-ogginfo
emms-info-mp3info emms-info later-do emms-playlist-mode
emms-source-playlist emms-source-file locate dired emms emms-compat
my-emms time my-emacs-spec trace evil evil-integration evil-maps
evil-commands evil-types evil-search evil-ex evil-macros evil-repeat
evil-states evil-core evil-common windmove rect evil-digraphs evil-vars
my-evil cl-indent-patches clisp-indent cl-indent clisp-color parenface
pretty-lambdada imenu+ slime-banner slime-tramp tramp tramp-compat
auth-source eieio eieio-core gnus-util mm-util mail-prsvr password-cache
tramp-loaddefs trampver shell pcomplete format-spec slime-fancy
slime-trace-dialog slime-fontifying-fu slime-package-fu slime-references
slime-compiler-notes-tree slime-presentations bridge slime-fancy-trace
slime-fancy-inspector slime-xref-browser tree-widget wid-edit
slime-media anything-slime slime-fuzzy slime-c-p-c slime-autodoc eldoc
slime-editing-commands slime-repl elp slime-parse anything-complete
anything-obsolete anything-match-plugin anything advice slime-scratch
slime byte-opt bytecomp byte-compile cconv derived edmacro kmacro gud
compile apropos etags arc-mode archive-mode noutline outline pp comint
ansi-color ring hyperspec thingatpt browse-url slime-autoloads my-lisp
color-theme-sanityinc-solarized-autoloads elnode-autoloads db-autoloads
creole-autoloads el-x-autoloads elpakit-autoloads anaphora-autoloads
httpd-autoloads info easymenu quack-autoloads package which-func imenu
site-gentoo w3m-load muse-autoloads server my-autoload assoc help-fns
easy-mmode parse-time cl-macs cl cl-loaddefs cl-lib my-utils gv my-main
my-env time-date china-util tooltip electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
gfilenotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 750367 50412)
 (symbols 48 61076 19)
 (miscs 40 145 312)
 (strings 32 133650 16576)
 (string-bytes 1 4156385)
 (vectors 16 41594)
 (vector-slots 8 940400 10499)
 (floats 8 2153 95)
 (intervals 56 576 0)
 (buffers 960 20)
 (heap 1024 47248 2541))

-- 

___________________________________
With Best Regards.
jingtao.