[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Infinite, non-breakable loop in imenu [PATCH]
From: |
Kim F. Storm |
Subject: |
Infinite, non-breakable loop in imenu [PATCH] |
Date: |
Sat, 13 Nov 2004 00:01:58 +0100 (CET) |
Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:
emacs -q
Eval:
(add-hook 'texinfo-mode-hook '(lambda () (imenu-add-to-menubar
"Texinfo-Sections")))
C-x C-f lispref/syntax.texi RET
Emacs is non-responsive, basta!
It seems related to this change:
2004-10-26 Daniel Pfeiffer <address@hidden>
* imenu.el (imenu--generic-function): Skip matches in comments.
The problem is that imenu--generic-function loops because it starts
the re-search-backward in the same position on every pass.
And for some reason, C-g doesn't break the loop.
Here is a fix for both problems. It works for me, but please review.
*** imenu.el 04 Nov 2004 15:50:52 +0100 1.103
--- imenu.el 12 Nov 2004 23:59:15 +0100
***************
*** 808,821 ****
(index (nth 2 pat))
(function (nth 3 pat))
(rest (nthcdr 4 pat))
cs)
;; Go backwards for convenience of adding items in order.
! (goto-char (point-max))
! (while (re-search-backward regexp nil t)
(goto-char (match-end index))
- (setq beg (match-beginning index))
(if (setq cs (save-match-data (comment-beginning)))
! (goto-char cs) ; skip this one, it's in a comment
(goto-char beg)
(imenu-progress-message prev-pos nil t)
;; Add this sort of submenu only when we've found an
--- 808,825 ----
(index (nth 2 pat))
(function (nth 3 pat))
(rest (nthcdr 4 pat))
+ (next-pos (point-max))
cs)
;; Go backwards for convenience of adding items in order.
! (while (and (> next-pos (point-min))
! (not quit-flag)
! (progn (goto-char next-pos)
! (re-search-backward regexp nil t)))
! (setq beg (match-beginning index)
! next-pos (max (point) (1- beg)))
(goto-char (match-end index))
(if (setq cs (save-match-data (comment-beginning)))
! (setq next-pos (min next-pos cs)) ; skip this one, it's
in a comment
(goto-char beg)
(imenu-progress-message prev-pos nil t)
;; Add this sort of submenu only when we've found an
In GNU Emacs 21.3.50.63 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2004-11-12 on kfs-l.imdomain.dk
Distributor `The XFree86 Project, Inc', version 11.0.40300000
configured using `configure 'CFLAGS=-DUSE_LSB_TAGS=1 -g -Wall''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8
default-enable-multibyte-characters: t
--
Kim F. Storm http://www.cua.dk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Infinite, non-breakable loop in imenu [PATCH],
Kim F. Storm <=