diff options
author | Kyle Meyer <kyle@kyleam.com> | 2016-04-29 00:58:54 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2016-04-29 00:58:54 -0400 |
commit | 9b7cd2223a3a23bddf1c476067ff12e6632d4a51 (patch) | |
tree | 6de0cdeae60b9d0c5342d783b130819cb235b09e | |
parent | e7da7f59f6cb942feda98b873f5588a625dd73e1 (diff) | |
download | emacs.d-9b7cd2223a3a23bddf1c476067ff12e6632d4a51.tar.gz |
latex-imenu-create-index-function: Ignore empty value
-rw-r--r-- | lisp/km-tex.el | 9 |
1 files changed, 5 insertions, 4 deletions
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) |