[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117720: Fix a bug in texinfo-make-menu.
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] trunk r117720: Fix a bug in texinfo-make-menu. |
Date: |
Thu, 21 Aug 2014 15:07:50 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117720
revision-id: address@hidden
parent: address@hidden
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Thu 2014-08-21 18:07:13 +0300
message:
Fix a bug in texinfo-make-menu.
lisp/textmodes/texnfo-upd.el (texinfo-specific-section-type): Don't
recognize a Top node if there are other sectioning commands
earlier in the Texinfo file. This fixes a bug in
texinfo-make-menu and avoids inflooping in
texinfo-all-menus-update when they are invoked on texinfo.texi.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/textmodes/texnfo-upd.el
texnfoupd.el-20091113204419-o5vbwnq5f7feedwu-145
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-08-21 08:40:29 +0000
+++ b/lisp/ChangeLog 2014-08-21 15:07:13 +0000
@@ -1,3 +1,11 @@
+2014-08-21 Eli Zaretskii <address@hidden>
+
+ * textmodes/texnfo-upd.el (texinfo-specific-section-type): Don't
+ recognize a Top node if there are other sectioning commands
+ earlier in the Texinfo file. This fixes a bug in
+ texinfo-make-menu and avoids inflooping in
+ texinfo-all-menus-update when they are invoked on texinfo.texi.
+
2014-08-21 Martin Rudalics <address@hidden>
* window.el (window--side-window-p): New function.
=== modified file 'lisp/textmodes/texnfo-upd.el'
--- a/lisp/textmodes/texnfo-upd.el 2014-01-01 07:43:34 +0000
+++ b/lisp/textmodes/texnfo-upd.el 2014-08-21 15:07:13 +0000
@@ -1145,24 +1145,40 @@
Searches forward for a section. Hence, point must be before the
section whose type will be found. Does not move point. Signal an
error if the node is not the top node and a section is not found."
- (let ((case-fold-search t))
- (save-excursion
- (cond
- ((re-search-forward "address@hidden [ \t]*top[ \t]*\\(,\\|$\\)"
- ;; Following search limit by cph but causes a bug
- ;;(line-end-position)
- nil
- t)
- "top")
- ((re-search-forward texinfo-section-types-regexp nil t)
- (buffer-substring-no-properties
- (progn (beginning-of-line) ; copy its name
- (1+ (point)))
- (progn (forward-word 1)
- (point))))
- (t
- (error
- "texinfo-specific-section-type: Chapter or section not found"))))))
+ (let* ((case-fold-search t)
+ ;; The Texinfo manual has a second Top node inside @verbatim
+ ;; near the end, which dupes us into thinking we are at top
+ ;; level, no matter where we are when invoked. We don't
+ ;; really grok @verbatim, so we cheat: only consider us to be
+ ;; at top level if the position of the Top node we found is
+ ;; before any other sectioning command.
+ (top-pos (save-excursion
+ (re-search-forward "address@hidden [ \t]*top[
\t]*\\(,\\|$\\)"
+ ;; Following search limit causes a bug
+ ;;(line-end-position)
+ nil
+ t)))
+ (sec-pos (save-excursion
+ (re-search-forward texinfo-section-types-regexp nil t)))
+ sec-name)
+ (if sec-pos
+ (save-excursion
+ (goto-char sec-pos)
+ (setq sec-name (buffer-substring-no-properties
+ (progn (beginning-of-line) ; copy its name
+ (1+ (point)))
+ (progn (forward-word 1)
+ (point))))))
+ (cond
+ ((or sec-pos top-pos)
+ (if (and top-pos sec-pos)
+ (if (< top-pos sec-pos)
+ "top"
+ sec-name)
+ (or sec-name "top")))
+ (t
+ (error
+ "texinfo-specific-section-type: Chapter or section not found")))))
(defun texinfo-hierarchic-level ()
"Return the general hierarchical level of the next node in a texinfo file.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117720: Fix a bug in texinfo-make-menu.,
Eli Zaretskii <=