Przeglądaj źródła

ox-texinfo.el: Fix issue with long headlines and node listings

* lisp/ox-texinfo.el (org-texinfo-node-description-column): New custom
  variable.
  (org-texinfo--format-menu): Use new variable to set column for
  description in node listings.  If the headline extends past this
  column, add the description after the headline.

The default column is 32 as suggested by Thomas S. Dye,
http://article.gmane.org/gmane.emacs.orgmode/66664
Jonathan Leech-Pepin 12 lat temu
rodzic
commit
c94cae1ee6
1 zmienionych plików z 20 dodań i 9 usunięć
  1. 20 9
      lisp/ox-texinfo.el

+ 20 - 9
lisp/ox-texinfo.el

@@ -222,6 +222,16 @@ order to reproduce the default set-up:
   :group 'org-export-texinfo
   :type 'function)
 
+;;; Node listing (menu)
+
+(defcustom org-texinfo-node-description-column 32
+  "Column at which to start the description in the node
+  listings.
+
+If a node title is greater than this length, the description will
+be placed after the end of the title."
+  :group 'org-export-texinfo
+  :type 'integer)
 
 ;;; Footnotes
 ;;
@@ -609,19 +619,20 @@ Other menu items are output as:
 With the spacing between :: and description based on the length
 of the longest menu entry."
 
-  (let* ((lengths (mapcar 'car text-menu))
-         (max-length (apply 'max lengths))
-	 output)
+  (let (output)
     (setq output
           (mapcar (lambda (name)
-                    (let* ((title (nth 1 name))
-                           (desc (nth 2 name))
-                           (length (nth 0 name)))
+                    (let* ((title   (nth 1 name))
+                           (desc    (nth 2 name))
+                           (length  (nth 0 name))
+			   (column  (max
+				     length
+				     org-texinfo-node-description-column))
+			   (spacing (- column length)
+				    ))
                       (if (> length -1)
                           (concat "* " title ":: "
-                                  (make-string
-				   (- (+ 3 max-length) length)
-				   ?\s)
+                                  (make-string spacing ?\s)
                                   (if desc
                                       (concat desc)))
                         (concat "\n" title "\n"))))