Subject: 28.0.50; speedbar: sorting in sublists is in reverse

From: [email-masked] (Harald Jörg)
Date: Thu, 11 Mar 2021 17:26:56 +0100

This isn't specific for "current" Emacs, it happens in Emacs 26.1, too.

How to reproduce:

 - emacs -Q
 - open a Perl file with lots of subroutines
   (e.g. https://github.com/foswiki/distro/blob/master/core/lib/Foswiki.pm)
   or a Elisp file with lots of defuns
   (e.g. lisp/progmodes/cperl-mode.el)
 - M-x speedbar

Following the default configuration, speedbar clusters the display of
subroutines into alphabetically sorted batches of 20 entries each.

While the batches are sorted alphabetically (e.g. "ge to i" comes before
"l to re" in Foswiki.pm), the entries in each of the batches are sorted
in reverse: The batch "ge to i" has a first entry of "isValidWikiWord"
and a last entry of "getApproxRevTime".

This happens in both perl-mode _and_ cperl-mode, and only in speedbar
but not in the completion list after M-x imenu, nor in the imenu index
which I added with M-x imenu-add-menubar-index.  So, either the bug is
in speedbar - or both Perl modes share the same bug.

...And, as I just found out, it isn't specific for Perl files so, I've
modified the recipe above and can add:

The situation with large elisp files (e.g. lisp/progmodes/cperl-mode.el)
might give a clue what's happening to someone who is familiar with
speedbar:

 - batches with a single word headline (e.g. "cperl-e") are sorted
   according to the positions of the entries.

 - batches with a range in the headline (e.g. "cperl-auto to cperl-d")
   have their sub-entries sorted in reverse alphabetical order.

Cheers,
haj

In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars)
 of 2021-03-02 built on hajtower
Repository revision: 9ef8a3bfca192777e7cf8b4748d188249a517582
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)

Configured features:
GIF GMP GNUTLS JPEG LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SOUND
THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM LUCID ZLIB

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

Major mode: Info

Minor modes in effect:
  shell-dirtrack-mode: t
  global-hl-line-mode: t
  recentf-mode: t
  global-auto-revert-mode: t
  show-paren-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-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
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/haj/devel/emacs-lisp/cperl-mode/cperl-mode hides /home/haj/devel/emacs/emacs/lisp/progmodes/cperl-mode

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa epg epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
vc-svn semantic/db-mode apropos semantic/bovine/c hideif cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-langs
cc-bytecomp cc-vars cc-defs semantic/bovine/c-by semantic/lex-spp
semantic/analyze/refs semantic/bovine/el semantic/db-el
semantic/bovine/gcc semantic/bovine/make semantic/bovine/make-by
make-mode semantic/bovine/scm semantic/bovine/scm-by semantic/bovine
semantic/complete semantic/decorate/mode semantic/edit semantic/html
sgml-mode dom semantic/imenu advice semantic/db-file data-debug
cedet-files semantic/mru-bookmark semantic/texi texinfo semantic/db-find
semantic/db-ref semantic/wisent/java-tags semantic/wisent/javat-wy
semantic/wisent/javascript-jv semantic/wisent/js-wy
semantic/wisent/python compile semantic/dep semantic/wisent/python-wy
python tramp-sh tramp tramp-loaddefs trampver tramp-integration files-x
tramp-compat shell pcomplete parse-time iso8601 ls-lisp format-spec
comint semantic/bovine/debug semantic/debug semantic/decorate pulse
semantic/grammar semantic/idle semantic/grammar-wy semantic/java
semantic/doc srecode/srt-mode semantic/analyze semantic/scope
semantic/analyze/fcn semantic/db srecode/template srecode/srt-wy
semantic/wisent semantic/wisent/wisent semantic/ctxt srecode/ctxt
srecode/compile srecode/dictionary srecode/fields srecode/table srecode
eieio-base semantic/sb semantic/sort semantic/format semantic/tag-ls
semantic/find semantic/util-modes semantic/util semantic semantic/tag
semantic/lex semantic/fw cedet rmail rmail-loaddefs auth-source
password-cache json map rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils cus-edit pp mule-util mode-local eieio-opt shortdoc
text-property-search cl-extra speedbar ezimage dframe thingatpt
cus-start cus-load misearch multi-isearch face-remap
cperl-object-pad-mode help-fns radix-tree cl-print debug backtrace
help-mode find-func time-date subr-x perl-mode bug-reference which-func
regex-tool cl font-lock-studio vc-git diff-mode easy-mmode vc-dispatcher
linum hl-line recentf tree-widget wid-edit autorevert filenotify paren
cperl-mode derived rx info man ansi-color etags fileloop generator xref
cl-seq project seq eieio byte-opt bytecomp byte-compile cconv eieio-core
cl-macs gv eieio-loaddefs ring imenu cl-loaddefs cl-lib iso-transl
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core term/tty-colors frame minibuffer cl-generic cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads inotify
dynamic-setting x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 439059 19058)
 (symbols 48 24683 3)
 (strings 32 85250 3038)
 (string-bytes 1 2766058)
 (vectors 16 44771)
 (vector-slots 8 638785 52530)
 (floats 8 175 110)
 (intervals 56 24822 0)
 (buffers 992 32))