[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[imenu.el] Attempt to fix broken imenu--generic-function

From: Filipp Gunbin
Subject: [imenu.el] Attempt to fix broken imenu--generic-function
Date: Tue, 17 Jul 2018 23:34:30 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (darwin)

Drew, I'm sorry, your commit 77166e0da2d58f2f6436989b7059d913be5b3439
broke imenu.  Do you have objections for this fix?

diff --git a/lisp/imenu.el b/lisp/imenu.el
index edca51e3ad..7285b10574 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -832,15 +832,14 @@ imenu--generic-function
     (dolist (item index-alist)
       (when (listp item)
        (setcdr item (sort (cdr item) 'imenu--sort-by-position))))
-    (let ((main-element (assq nil index-alist)))
-      (nconc (delq main-element (delq 'dummy index-alist))
-             (cdr main-element)))
     ;; Remove any empty menus.  That can happen because of skipping
     ;; things inside comments or strings.
-    (when (consp (car index-alist))
-      (setq index-alist  (cl-delete-if-not
-                          (lambda (it) (cdr it))
-                          index-alist)))))
+    (setq index-alist (cl-delete-if
+                       (lambda (it) (and (consp it) (null (cdr it))))
+                       index-alist))
+    (let ((main-element (assq nil index-alist)))
+      (nconc (delq main-element (delq 'dummy index-alist))
+             (cdr main-element)))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]