bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#18268: 24.3.92; Make imenu sort submenus also (fix included)


From: carlosjosepita
Subject: bug#18268: 24.3.92; Make imenu sort submenus also (fix included)
Date: Thu, 14 Aug 2014 20:18:33 -0300

When the current major mode provides submenus (say, python-mode, with
methods nested inside classes, classes being top-level), imenu always
shows them at the top of the menu and unsorted. Only sibling leaves of
the menu tree are sorted.

To fix this, just sort the output of imenu--split submenus when a custom
imenu-sort-function was required by the user:

(defun imenu--split-submenus (alist)
  "Split up each long alist that are nested within ALIST into nested alists.
Return a split and sorted copy of ALIST.  The returned alist DOES
NOT share structure with ALIST."
  (let ((menulist (mapcar (lambda (elt)
                            (if (imenu--subalist-p elt)
                                (imenu--split-menu (cdr elt) (car elt))
                              elt))
                          alist)))
    (if imenu-sort-function
        (sort menulist imenu-sort-function)
      menulist)))

Regards
--
Carlos








In GNU Emacs 24.3.92.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.12.2)
 of 2014-08-07 on memeplex
Windowing system distributor `The X.Org Foundation', version 11.0.11600000
Configured using:
 `configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong
 --param=ssp-buffer-size=4' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  shell-dirtrack-mode: t
  show-paren-mode: t
  winner-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  ido-everywhere: t
  global-auto-complete-mode: t
  auto-complete-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  global-prettify-symbols-mode: t
  prettify-symbols-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<up> <up> <up> <up> <up> <up> <up> <up> <up> C-SPC 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> C-w <return> C-x C-s <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <prior> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <S-left> <down> <down> <down> C-x d <return> <S-right> 
<down> <down> <down> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
C-e ( r e q u i r e SPC ' i m e n u - a n y w h e e 
r <backspace> <backspace> r e ) C-x C-e <up> <up> <down> 
C-e C-x C-e <S-left> <up> <down> <down> <down> d <down> 
x y e s <return> <up> <up> <up> <return> C-x C-s <down> 
<down> <down> <down> <down> C-x b s c <return> <S-right> 
<next> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <return> ( r e q 
u i r e SPC ' f i x e s ) C-x C-e C-g C-x C-s <up> 
<up> <S-left> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> M-x r e p o <tab> 
r t <tab> <return>

Recent messages:
End of buffer [3 times]
imenu-anywhere
imenu--sort-by-name
Deleting...done
(No changes need to be saved)
progn: Required feature `fixes' was not provided
Quit
Saving file /home/carlos/.emacs...
Wrote /home/carlos/.emacs
Making completion list...

Load-path shadows:
~/.emacs.d/lisp/python hides /usr/share/emacs/24.3.92/lisp/progmodes/python
~/.emacs.d/lisp/rmail hides /usr/share/emacs/24.3.92/lisp/mail/rmail

Features:
(shadow sort mail-extr emacsbug message idna rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils debug
mule-util tramp-cache tramp tramp-compat tramp-loaddefs trampver shell
image-file org-rmail org-mhe org-irc org-info org-gnus org-docview
doc-view image-mode dired org-bibtex bibtex org-bbdb org-w3m org-capture
org org-macro org-footnote org-pcomplete pcomplete org-list org-faces
org-entities noutline outline easy-mmode org-version ob-emacs-lisp ob
ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp ob-comint
ob-core ob-eval org-compat org-macs org-loaddefs format-spec cal-menu
calendar cal-loaddefs edebug misearch multi-isearch jka-compr eieio-opt
speedbar sb-image ezimage dframe network-stream auth-source eieio
byte-opt bytecomp byte-compile cconv eieio-core gnus-util mm-util
mail-prsvr password-cache starttls tls warnings vc-git jedi
python-environment epc ctable concurrent deferred python skeleton
derived pcase rx json imenu-anywhere cl-macs imenu thingatpt find-func
flymake compile comint ansi-color paren winner ring windmove advice
help-fns yasnippet help-mode cl gv ido auto-complete-config
auto-complete popup edmacro kmacro cl-loaddefs cl-lib info easymenu
package wombat-theme time-date tooltip electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
gfilenotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 361814 22370)
 (symbols 48 36390 0)
 (miscs 40 1153 1328)
 (strings 32 103033 9931)
 (string-bytes 1 2189271)
 (vectors 16 35814)
 (vector-slots 8 1446654 27798)
 (floats 8 665 911)
 (intervals 56 9261 0)
 (buffers 960 26)
 (heap 1024 67756 2517))





reply via email to

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