unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Filipp Gunbin <fgunbin@fastmail.fm>
To: drew.adams@oracle.com
Cc: emacs-devel@gnu.org
Subject: [imenu.el] Attempt to fix broken imenu--generic-function
Date: Tue, 17 Jul 2018 23:34:30 +0300	[thread overview]
Message-ID: <m2efg161pl.fsf@fgunbin.playteam.ru> (raw)

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	other threads:[~2018-07-17 20:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-17 20:34 Filipp Gunbin [this message]
2018-07-17 20:55 ` [imenu.el] Attempt to fix broken imenu--generic-function 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2efg161pl.fsf@fgunbin.playteam.ru \
    --to=fgunbin@fastmail.fm \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).