unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [imenu.el] Attempt to fix broken imenu--generic-function
@ 2018-07-17 20:34 Filipp Gunbin
  2018-07-17 20:55 ` Drew Adams
  0 siblings, 1 reply; 8+ messages in thread
From: Filipp Gunbin @ 2018-07-17 20:34 UTC (permalink / raw)
  To: drew.adams; +Cc: emacs-devel

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)))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-07-18 13:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-17 20:34 [imenu.el] Attempt to fix broken imenu--generic-function Filipp Gunbin
2018-07-17 20:55 ` Drew Adams
2018-07-17 22:14   ` Filipp Gunbin
2018-07-17 23:18     ` Drew Adams
2018-07-18  2:38       ` Eli Zaretskii
2018-07-18 13:12       ` Filipp Gunbin
     [not found]     ` <<03bf24b4-7040-451d-9a98-e02315b33f91@default>
     [not found]       ` <<83a7qp6zg5.fsf@gnu.org>
2018-07-18  4:36         ` Drew Adams
2018-07-18  5:01           ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).