Subject: Re: bug#23142: 25.1.50; Kind of duplicated lines in info TOC

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 29 Jul 2019 00:52:02 +0200

Johan Claesson <[email-masked]> writes:

> Regarding the table-of-contents that is generated by typing T in
> info.  Whenever there is a new level of sections the section name
> is printed twice.  For example in the start of the elisp
> manual "Introduction" and "Conventions" are duplicated (and the
> second "Conventions" is not indented which disturbs the
> readability):
>
> Top::
> Introduction::
> Introduction
>         Caveats::
>         Lisp History::
>         Conventions::
> Conventions
>                 Some Terms::
>                 nil and t::
> [...]

Yes, that's kinda ugly.

> (defun Info-toc-insert (nodes node-list level curr-file)
>   "Insert table of contents with references to nodes."
>   ;; (let ((section "Top"))
>     (while nodes
>       (let ((node (assoc (car nodes) node-list)))
>         ;; (unless (member (nth 2 node) (list nil section))
>         ;; (insert (setq section (nth 2 node)) "\n"))
>         (insert (make-string level ?\t))
>         (insert "*Note " (car nodes) ":: \n")
>         (Info-toc-insert (nth 3 node) node-list (1+ level) curr-file)
>         (setq nodes (cdr nodes)))))

Yup, the following:

diff --git a/lisp/info.el b/lisp/info.el
index 3203c5f171..abef57f79f 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -2453,8 +2453,6 @@ Info-toc-insert
   (let ((section "Top"))
     (while nodes
       (let ((node (assoc (car nodes) node-list)))
-        (unless (member (nth 2 node) (list nil section))
-          (insert (setq section (nth 2 node)) "\n"))
         (insert (make-string level ?\t))
         (insert "*Note " (car nodes) ":: \n")
         (Info-toc-insert (nth 3 node) node-list (1+ level) curr-file)

makes the TOC much nicer.  As a test case, open the ert info file and
hit `T'.

Does anybody know what the reasoning behind adding these seemingly
doubled lines is?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no