From 9b7cd2223a3a23bddf1c476067ff12e6632d4a51 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Fri, 29 Apr 2016 00:58:54 -0400 Subject: latex-imenu-create-index-function: Ignore empty value --- lisp/km-tex.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lisp/km-tex.el') diff --git a/lisp/km-tex.el b/lisp/km-tex.el index 15447d3..f3f0727 100644 --- a/lisp/km-tex.el +++ b/lisp/km-tex.el @@ -27,7 +27,7 @@ ;; See `LaTeX-imenu-create-index-function'. (TeX-update-style) (let ((sec-re (LaTeX-outline-regexp)) - (title-re "\\*\\{0,1\\}{\\([^}]+\\)}") + (title-re "\\*\\{0,1\\}{\\([^}]*\\)}") entries) (goto-char (point-min)) (while (re-search-forward sec-re nil t) @@ -40,9 +40,10 @@ "\n" "" (match-string-no-properties 1)))))) (when (> (length title) 45) (setf (substring title 21 -21) "...")) - (push (cons (if title (format "%s (%s)" title sec) sec) - (save-excursion (beginning-of-line) (point-marker))) - entries))) + (when (> (length title) 0) + (push (cons (if title (format "%s (%s)" title sec) sec) + (save-excursion (beginning-of-line) (point-marker))) + entries)))) (nreverse entries))) (provide 'km-tex) -- cgit v1.2.3