From 0f6cb7f8501a47f41e72d12b2d30f3d1dfbd4ebe Mon Sep 17 00:00:00 2001 From: Jonathan Leech-Pepin Date: Thu, 14 Feb 2013 11:59:03 -0500 Subject: [PATCH] ox-texinfo: Ensure detailed menu generation does not exceed maximum recognized depth * lisp/ox-texinfo.el (org-texinfo-max-toc-depth): Maximum depth recognized by texinfo for nodes and sectioning. Left as a constant to be updated if ever necessary. (org-texinfo--generate-detailed): Use the smaller between org-texinfo-max-toc-depth and headline levels (H: ) --- lisp/ox-texinfo.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el index 8bc352009..20fa41da9 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -369,6 +369,12 @@ file name, %b by the file base name \(i.e without extension) and :type '(repeat :tag "Shell command sequence" (string :tag "Shell command"))) +;;; Constants +(defconst org-texinfo-max-toc-depth 4 + "Maximum depth for creation of detailed menu listings. Beyond + this depth texinfo will not recognize the nodes and will cause + errors. Left as a constant in case this value ever changes.") + ;;; Internal Functions @@ -501,7 +507,8 @@ MENU is the parse-tree to work with. LEVEL is the starting level for the menu headlines and from which recursion occurs. INFO is a plist containing contextual information." (when level - (let ((max-depth (plist-get info :headline-levels))) + (let ((max-depth (min org-texinfo-max-toc-depth + (plist-get info :headline-levels)))) (when (> max-depth level) (loop for headline in menu append (let* ((title (org-texinfo--menu-headlines headline info)) -- 2.11.4.GIT