浏览代码

texinfo: Fix off-by-one error

* lisp/ox-texinfo.el (org-texinfo--menu-entries): Fix off-by-one
error.

This is a follow-up to f99f26306c57d2342069880eac4dca324d7579ec.

Reported-by: Jonas Bernoulli <jonas@bernoul.li>
<http://lists.gnu.org/r/emacs-orgmode/2021-05/msg01290.html>
Nicolas Goaziou 3 年之前
父节点
当前提交
093c94e31b
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      lisp/ox-texinfo.el

+ 3 - 3
lisp/ox-texinfo.el

@@ -1232,13 +1232,13 @@ holding contextual information."
 			       :texinfo-entries-cache)))
 	 (cached-entries (gethash scope cache 'no-cache)))
     (if (not (eq cached-entries 'no-cache)) cached-entries
-      (let ((sections (org-texinfo--sectioning-structure info)))
+      (let* ((sections (org-texinfo--sectioning-structure info))
+             (max-depth (length sections)))
         (puthash scope
 	         (cl-remove-if
 		  (lambda (h)
 		    (or (org-not-nil (org-export-get-node-property :COPYING h t))
-                        (>= (org-export-get-relative-level h info)
-                            (length sections))))
+                        (< max-depth (org-export-get-relative-level h info))))
 		  (org-export-collect-headlines info 1 scope))
 	         cache)))))