GNU logs - #8725, boring messages


Message sent to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#8725: 23.2; imenu--split-menu should not deliver surprises
Resent-From: dino chiesa <dpchiesa@HIDDEN>
Original-Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Resent-To: owner <at> debbugs.gnu.org
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 24 May 2011 13:17:02 +0000
Resent-Message-ID: <handler.8725.B.130624300911568 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 8725
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 8725 <at> debbugs.gnu.org
X-Debbugs-Original-To: <bug-gnu-emacs@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.130624300911568
          (code B ref -1); Tue, 24 May 2011 13:17:02 +0000
Received: (at submit) by debbugs.gnu.org; 24 May 2011 13:16:49 +0000
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1QOrTc-00030W-4T
	for submit <at> debbugs.gnu.org; Tue, 24 May 2011 09:16:49 -0400
Received: from eggs.gnu.org ([140.186.70.92])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <dpchiesa@HIDDEN>) id 1QOrTZ-00030G-UL
	for submit <at> debbugs.gnu.org; Tue, 24 May 2011 09:16:46 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dpchiesa@HIDDEN>) id 1QOrTQ-0004QB-FO
	for submit <at> debbugs.gnu.org; Tue, 24 May 2011 09:16:40 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	HTML_MESSAGE, RCVD_IN_DNSWL_NONE, RECEIVED_FROM_WINDOWS_HOST,
	RFC_ABUSE_POST, T_RP_MATCHES_RCVD autolearn=no version=3.3.1
Received: from lists.gnu.org ([140.186.70.17]:40695)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dpchiesa@HIDDEN>) id 1QOrTQ-0004Q6-DZ
	for submit <at> debbugs.gnu.org; Tue, 24 May 2011 09:16:36 -0400
Received: from eggs.gnu.org ([140.186.70.92]:47750)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dpchiesa@HIDDEN>) id 1QOrTO-0006q4-Nu
	for bug-gnu-emacs@HIDDEN; Tue, 24 May 2011 09:16:36 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dpchiesa@HIDDEN>) id 1QOrTM-0004PT-So
	for bug-gnu-emacs@HIDDEN; Tue, 24 May 2011 09:16:34 -0400
Received: from blu0-omc1-s27.blu0.hotmail.com ([65.55.116.38]:20342)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dpchiesa@HIDDEN>) id 1QOrTM-0004PK-Mk
	for bug-gnu-emacs@HIDDEN; Tue, 24 May 2011 09:16:32 -0400
Received: from BLU159-W47 ([65.55.116.9]) by blu0-omc1-s27.blu0.hotmail.com
	with Microsoft SMTPSVC(6.0.3790.4675); 
	Tue, 24 May 2011 06:16:32 -0700
Message-ID: <BLU159-w47B119579809569FDD30F9CE750@HIDDEN>
Content-Type: multipart/alternative;
	boundary="_b592907e-47b1-485e-b5c4-99f01913932d_"
X-Originating-IP: [71.60.182.236]
From: dino chiesa <dpchiesa@HIDDEN>
Date: Tue, 24 May 2011 06:16:32 -0700
Importance: Normal
MIME-Version: 1.0
X-OriginalArrivalTime: 24 May 2011 13:16:32.0454 (UTC)
	FILETIME=[CCCCBE60:01CC1A14]
X-detected-operating-system: by eggs.gnu.org: Windows 2000 SP4, XP SP1+
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 140.186.70.17
X-Spam-Score: -6.0 (------)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.0 (------)

--_b592907e-47b1-485e-b5c4-99f01913932d_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


imenu--split-menu sorts the menu structure=2C placing breakout menus at
the top.  This seems arbitrary=2C surprising=2C and unnecessary. =20
=20
A reasonable sorting behavior would be to sort in the order in which the
menu items were found - that is to say=2C leave the order the way it was
on entry to the defun.  Another reasonable sorting behavior would be to
sort menu items lexicographically.  This defun does neither of those
things but rather applies the arbitrary decision to put items with
submenus at the top. Why?
=20
This is not consistent with good UI design. It makes for a confusing
menu=2C in which the order of items doesn't correspond to *anything* useful=
.
=20
Also=2C this behavior is not avoidable. Though imenu allows specification
of a sort function for menbu items=2C the arbitrary sorting described
above happens whether or not a custom sort function is provided. The
only way around this is to advise or redefine imenu--split-menu.
=20
To fix this=2C in imenu.el =2C redefine imenu--split-menu to remove the off=
ending
arbitrariness:=20
=20
    (defun imenu--split-menu (menulist title)
      (let ((menulist (copy-sequence menulist))
            keep-at-top tail)
        (if (memq imenu--rescan-item menulist)
            (setq keep-at-top (list imenu--rescan-item)
                  menulist (delq imenu--rescan-item menulist)))
        =3B=3B DPC - ban menu fascism!=20
        =3B=3B (setq tail menulist)
        =3B=3B (dolist (item tail)
        =3B=3B   (when (imenu--subalist-p item)
        =3B=3B     (push item keep-at-top)
        =3B=3B     (setq menulist (delq item menulist))))
        (if imenu-sort-function
            (setq menulist (sort menulist imenu-sort-function)))
        (if (> (length menulist) imenu-max-items)
            (setq menulist
                  (mapcar
                   (lambda (menu)
                     (cons (format "From: %s" (caar menu)) menu))
                   (imenu--split menulist imenu-max-items))))
        (cons title
              (nconc (nreverse keep-at-top) menulist))))
=20
=20
In GNU Emacs 23.2.1 (i386-mingw-nt6.1.7601)
 of 2010-05-08 on G41R2F1
Windowing system distributor `Microsoft Corp.'=2C version 6.1.7601
configured using `configure --with-gcc (3.4) --no-opt --cflags -Ic:/xpm/inc=
lude'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  value of $XMODIFIERS: nil
  locale-coding-system: cp1252
  default enable-multibyte-characters: t
Major mode: Emacs-Lisp
Minor modes in effect:
  auto-revert-mode: t
  yas/minor-mode: t
  global-hl-line-mode: t
  hl-line-mode: t
  global-auto-complete-mode: t
  auto-complete-mode: t
  tooltip-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-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
Recent input:
Recent messages:
Load-path shadows:
/users/dino/elisp/linum hides c:/emacs/lisp/linum
/users/dino/elisp/css-mode hides c:/emacs/lisp/textmodes/css-mode
Features:
(browse-url mailalias mailclient sendmail gnus-msg gnus-art mm-uu
mml2015 pgg pgg-parse pgg-def epg-config mm-view smime dig gnus-sum nnoo
gnus-group gnus-undo nnmail mail-source format-spec gnus-start gnus-spec
gnus-int gnus-range gnus-win gnus gnus-ems shadow sort mail-extr message
ecomplete rfc822 mml mml-sec password-cache mm-decode mm-bodies
mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045 qp ietf-drums
mailabbrev nnheader gnus-util netrc time-date mm-util mail-prsvr
gmm-utils wid-edit mailheader canlock sha1 hex-util hashcash mail-utils
emacsbug help-mode view js find-func dired-aux
flymake-for-jslint-for-wsh flymake-cursor flymake autopair espresso
bytecomp byte-compile ido json thingatpt etags imenu newcomment cc-mode
cc-fonts cc-menus cc-cmds multi-isearch grep compile comint ring
time-stamp sgml-mode autorevert server cperl-mode paren mic-paren
hideshow easymenu cc-styles cc-align cc-engine cc-vars cc-defs dired
regexp-opt defaultcontent yasnippet-bundle dropdown-list yasnippet
easy-mmode cl cl-19 tfs skeleton httpget hl-line advice help-fns
advice-preload auto-complete-config auto-complete edmacro kmacro popup
tooltip ediff-hook vc-hooks lisp-float-type mwheel dos-w32 disp-table
ls-lisp w32-win w32-vars tool-bar dnd fontset image fringe lisp-mode
register page menu-bar rfn-eshadow timer select scroll-bar mldrag 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
loaddefs button minibuffer faces cus-face files text-properties overlay
md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process multi-tty emacs)
 		 	   		  =

--_b592907e-47b1-485e-b5c4-99f01913932d_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<style><!--
.hmmessage P
{
margin:0px=3B
padding:0px
}
body.hmmessage
{
font-size: 10pt=3B
font-family:Tahoma
}
--></style>
</head>
<body class=3D'hmmessage'>
imenu--split-menu sorts the menu structure=2C placing breakout menus at<BR>=
the top.&nbsp=3B This seems arbitrary=2C surprising=2C and unnecessary.&nbs=
p=3B <BR>
&nbsp=3B<BR>
A reasonable sorting behavior would be to sort in the order in which the<BR=
>menu items were found - that is to say=2C leave the order the way it was<B=
R>on entry to the defun.&nbsp=3B Another reasonable sorting behavior would =
be to<BR>sort menu items lexicographically.&nbsp=3B This defun does neither=
 of those<BR>things but rather applies the arbitrary decision to put items =
with<BR>submenus at the top. Why?<BR>
&nbsp=3B<BR>
This is not consistent with good UI design. It makes for a confusing<BR>men=
u=2C in which the order of items doesn't correspond to *anything* useful.<B=
R>
&nbsp=3B<BR>
Also=2C this behavior is not avoidable. Though imenu allows specification<B=
R>of a sort function for menbu items=2C the arbitrary sorting described<BR>=
above happens whether or not a custom sort function is provided. The<BR>onl=
y way around this is to advise or redefine imenu--split-menu.<BR>
&nbsp=3B<BR>
To fix this=2C in imenu.el =2C redefine imenu--split-menu to remove the off=
ending<BR>arbitrariness: <BR>
&nbsp=3B<BR>
&nbsp=3B&nbsp=3B&nbsp=3B (defun imenu--split-menu (menulist title)<BR>&nbsp=
=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B (let ((menulist (copy-sequence menulist=
))<BR>&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=
=3B&nbsp=3B&nbsp=3B keep-at-top tail)<BR>&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&n=
bsp=3B&nbsp=3B&nbsp=3B (if (memq imenu--rescan-item menulist)<BR>&nbsp=3B&n=
bsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=
=3B (setq keep-at-top (list imenu--rescan-item)<BR>&nbsp=3B&nbsp=3B&nbsp=3B=
&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nb=
sp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B menulist (delq imenu--rescan-item men=
ulist)))<BR>&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B =3B=3B=
 DPC - ban menu fascism! <BR>&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=
=3B&nbsp=3B =3B=3B (setq tail menulist)<BR>&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B=
&nbsp=3B&nbsp=3B&nbsp=3B =3B=3B (dolist (item tail)<BR>&nbsp=3B&nbsp=3B&nbs=
p=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B =3B=3B&nbsp=3B&nbsp=3B (when (imenu--s=
ubalist-p item)<BR>&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B=
 =3B=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B (push item keep-at-top)<BR>&nbsp=3B=
&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B =3B=3B&nbsp=3B&nbsp=3B&nbs=
p=3B&nbsp=3B (setq menulist (delq item menulist))))<BR>&nbsp=3B&nbsp=3B&nbs=
p=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B (if imenu-sort-function<BR>&nbsp=3B&nb=
sp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=
=3B (setq menulist (sort menulist imenu-sort-function)))<BR>&nbsp=3B&nbsp=
=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B (if (&gt=3B (length menulist) i=
menu-max-items)<BR>&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B=
&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B (setq menulist<BR>&nbsp=3B&nbsp=3B&nbsp=3B=
&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nb=
sp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B (mapcar<BR>&nbsp=3B&nbsp=3B&nbsp=3B&n=
bsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=
=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B (lambda (menu)<BR>&nbsp=3B&nbsp=
=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B=
&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B (c=
ons (format "From: %s" (caar menu)) menu))<BR>&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=
=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B=
&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B (imenu--split menulist imenu-max-i=
tems))))<BR>&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B (cons =
title<BR>&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&n=
bsp=3B&nbsp=3B&nbsp=3B&nbsp=3B&nbsp=3B (nconc (nreverse keep-at-top) menuli=
st))))<BR>
&nbsp=3B<BR>
&nbsp=3B<BR>
In GNU Emacs 23.2.1 (i386-mingw-nt6.1.7601)<BR>&nbsp=3Bof 2010-05-08 on G41=
R2F1<BR>Windowing system distributor `Microsoft Corp.'=2C version 6.1.7601<=
BR>configured using `configure --with-gcc (3.4) --no-opt --cflags -Ic:/xpm/=
include'<BR>
Important settings:<BR>&nbsp=3B value of $LC_ALL: nil<BR>&nbsp=3B value of =
$LC_COLLATE: nil<BR>&nbsp=3B value of $LC_CTYPE: nil<BR>&nbsp=3B value of $=
LC_MESSAGES: nil<BR>&nbsp=3B value of $LC_MONETARY: nil<BR>&nbsp=3B value o=
f $LC_NUMERIC: nil<BR>&nbsp=3B value of $LC_TIME: nil<BR>&nbsp=3B value of =
$LANG: ENU<BR>&nbsp=3B value of $XMODIFIERS: nil<BR>&nbsp=3B locale-coding-=
system: cp1252<BR>&nbsp=3B default enable-multibyte-characters: t<BR>
Major mode: Emacs-Lisp<BR>
Minor modes in effect:<BR>&nbsp=3B auto-revert-mode: t<BR>&nbsp=3B yas/mino=
r-mode: t<BR>&nbsp=3B global-hl-line-mode: t<BR>&nbsp=3B hl-line-mode: t<BR=
>&nbsp=3B global-auto-complete-mode: t<BR>&nbsp=3B auto-complete-mode: t<BR=
>&nbsp=3B tooltip-mode: t<BR>&nbsp=3B mouse-wheel-mode: t<BR>&nbsp=3B menu-=
bar-mode: t<BR>&nbsp=3B file-name-shadow-mode: t<BR>&nbsp=3B global-font-lo=
ck-mode: t<BR>&nbsp=3B font-lock-mode: t<BR>&nbsp=3B blink-cursor-mode: t<B=
R>&nbsp=3B auto-encryption-mode: t<BR>&nbsp=3B auto-compression-mode: t<BR>=
&nbsp=3B line-number-mode: t<BR>&nbsp=3B transient-mark-mode: t<BR>
Recent input:<BR>Recent messages:<BR>Load-path shadows:<BR>/users/dino/elis=
p/linum hides c:/emacs/lisp/linum<BR>/users/dino/elisp/css-mode hides c:/em=
acs/lisp/textmodes/css-mode<BR>
Features:<BR>(browse-url mailalias mailclient sendmail gnus-msg gnus-art mm=
-uu<BR>mml2015 pgg pgg-parse pgg-def epg-config mm-view smime dig gnus-sum =
nnoo<BR>gnus-group gnus-undo nnmail mail-source format-spec gnus-start gnus=
-spec<BR>gnus-int gnus-range gnus-win gnus gnus-ems shadow sort mail-extr m=
essage<BR>ecomplete rfc822 mml mml-sec password-cache mm-decode mm-bodies<B=
R>mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045 qp ietf-drums<BR>mai=
labbrev nnheader gnus-util netrc time-date mm-util mail-prsvr<BR>gmm-utils =
wid-edit mailheader canlock sha1 hex-util hashcash mail-utils<BR>emacsbug h=
elp-mode view js find-func dired-aux<BR>flymake-for-jslint-for-wsh flymake-=
cursor flymake autopair espresso<BR>bytecomp byte-compile ido json thingatp=
t etags imenu newcomment cc-mode<BR>cc-fonts cc-menus cc-cmds multi-isearch=
 grep compile comint ring<BR>time-stamp sgml-mode autorevert server cperl-m=
ode paren mic-paren<BR>hideshow easymenu cc-styles cc-align cc-engine cc-va=
rs cc-defs dired<BR>regexp-opt defaultcontent yasnippet-bundle dropdown-lis=
t yasnippet<BR>easy-mmode cl cl-19 tfs skeleton httpget hl-line advice help=
-fns<BR>advice-preload auto-complete-config auto-complete edmacro kmacro po=
pup<BR>tooltip ediff-hook vc-hooks lisp-float-type mwheel dos-w32 disp-tabl=
e<BR>ls-lisp w32-win w32-vars tool-bar dnd fontset image fringe lisp-mode<B=
R>register page menu-bar rfn-eshadow timer select scroll-bar mldrag mouse<B=
R>jit-lock font-lock syntax facemenu font-core frame cham georgian<BR>utf-8=
-lang misc-lang vietnamese tibetan thai tai-viet lao korean<BR>japanese heb=
rew greek romanian slovak czech european ethiopic indian<BR>cyrillic chines=
e case-table epa-hook jka-cmpr-hook help simple abbrev<BR>loaddefs button m=
inibuffer faces cus-face files text-properties overlay<BR>md5 base64 format=
 env code-pages mule custom widget<BR>hashtable-print-readable backquote ma=
ke-network-process multi-tty emacs)<BR><BR> 		 	   		  </body>
</html>=

--_b592907e-47b1-485e-b5c4-99f01913932d_--




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: dino chiesa <dpchiesa@HIDDEN>
Subject: bug#8725: Acknowledgement (23.2; imenu--split-menu should not
 deliver surprises)
Message-ID: <handler.8725.B.130624300911568.ack <at> debbugs.gnu.org>
References: <BLU159-w47B119579809569FDD30F9CE750@HIDDEN>
X-Gnu-PR-Message: ack 8725
X-Gnu-PR-Package: emacs
Reply-To: 8725 <at> debbugs.gnu.org
Date: Tue, 24 May 2011 13:17:02 +0000

Thank you for filing a new bug report with GNU.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 8725 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
8725: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D8725
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#8725: imenu--split-menu should not deliver surprises
References: <BLU159-w47B119579809569FDD30F9CE750@HIDDEN>
In-Reply-To: <BLU159-w47B119579809569FDD30F9CE750@HIDDEN>
Resent-From: Hui Liu <liuhui.zy@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 12 Apr 2014 18:32:05 +0000
Resent-Message-ID: <handler.8725.B8725.139732751722115 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 8725
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 8725 <at> debbugs.gnu.org
Received: via spool by 8725-submit <at> debbugs.gnu.org id=B8725.139732751722115
          (code B ref 8725); Sat, 12 Apr 2014 18:32:05 +0000
Received: (at 8725) by debbugs.gnu.org; 12 Apr 2014 18:31:57 +0000
Received: from localhost ([127.0.0.1]:46421 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WZ2ia-0005kc-Iq
	for submit <at> debbugs.gnu.org; Sat, 12 Apr 2014 14:31:57 -0400
Received: from mail-qg0-f68.google.com ([209.85.192.68]:43033)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <liuhui.zy@HIDDEN>) id 1WYyMH-00065a-7R
 for 8725 <at> debbugs.gnu.org; Sat, 12 Apr 2014 09:52:38 -0400
Received: by mail-qg0-f68.google.com with SMTP id q108so2129741qgd.7
 for <8725 <at> debbugs.gnu.org>; Sat, 12 Apr 2014 06:52:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:date:message-id:subject:from:to:content-type
 :content-transfer-encoding;
 bh=/3PqopgjLGBxwo8reYi6EZ+muYd38Ppz8oyGYeVVqXA=;
 b=GLox1cMEIg+7JBvs0faVIXyHtM28O9uJGH/k0Iubs/HBim7VEbXCuJoZ+RuaEaiSs7
 fl9eVr2T+rjLGm+LlvtGTHZ1SKvv+PNJzwzISrOgMCzgBqiPR2HyWDcXXC8f/fbkVbjv
 Gt8dHKQkA1RtEl9kWdzUseY7m52AbcAm4rerH4Zc3kCYdCQ5CQz98trsT2G1Shdg3mSf
 NFRQCbcMqAkGxsC156Oc3NQFZ56WL6lBYxNTKMeW1KoZv2eiGdS4qeFB4bI1vEGJhScO
 ol8RXD6mZRI2jhHYn7mpL0siNggF47Wh+araCMALjAYuVneo2JyRdn0riW0nGkBQ6qmD
 GaoQ==
MIME-Version: 1.0
X-Received: by 10.224.4.5 with SMTP id 5mr6330036qap.85.1397310750820; Sat, 12
 Apr 2014 06:52:30 -0700 (PDT)
Received: by 10.140.34.80 with HTTP; Sat, 12 Apr 2014 06:52:30 -0700 (PDT)
Date: Sat, 12 Apr 2014 21:52:30 +0800
Message-ID: <CAB=Rzgkoibkhc3L-Vo37qdg6H-GA7Lvf+L+B08r7pviH7X2Vaw@HIDDEN>
From: Hui Liu <liuhui.zy@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Mailman-Approved-At: Sat, 12 Apr 2014 14:31:54 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

Hi. This bug still exists in 24.4.50. An example:

    emacs -Q
    M-x org-mode
    ;;; type the following text
    * section 1
    * section 2
    ** 2.1
    ** 2.2
    * section 3
    * section 4
    ** 4.1
    ** 4.2
    ;;; end
    M-x imenu-add-menubar-index

Then Imenu produces a confusing menu like this:

    section 2
    |=E2=80=942.1
    |=E2=80=942.2
    section 4
    |=E2=80=944.1
    |=E2=80=944.2
    section 1
    section 3

and the reason is Imenu put items with submenus at the top. Such
behaviour may be reasonable for programming modes, but is clearly
unnecessary for text modes.

How about making a discrimination in imenu--split-menu?

--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -537,10 +537,11 @@ The returned alist DOES NOT share structure with
MENULIST."
     (if (memq imenu--rescan-item menulist)
        (setq keep-at-top (list imenu--rescan-item)
              menulist (delq imenu--rescan-item menulist)))
-    (dolist (item menulist)
+    (unless (derived-mode-p 'text-mode)
+     (dolist (item menulist)
       (when (imenu--subalist-p item)
        (push item keep-at-top)
-       (setq menulist (delq item menulist))))
+       (setq menulist (delq item menulist)))))
     (if imenu-sort-function
        (setq menulist (sort menulist imenu-sort-function)))
     (if (> (length menulist) imenu-max-items)




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#8725: imenu--split-menu should not deliver surprises
Resent-From: Stefan Monnier <monnier@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 12 Apr 2014 20:04:01 +0000
Resent-Message-ID: <handler.8725.B8725.13973330359760 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 8725
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Hui Liu <liuhui.zy@HIDDEN>
Cc: 8725 <at> debbugs.gnu.org
Received: via spool by 8725-submit <at> debbugs.gnu.org id=B8725.13973330359760
          (code B ref 8725); Sat, 12 Apr 2014 20:04:01 +0000
Received: (at 8725) by debbugs.gnu.org; 12 Apr 2014 20:03:55 +0000
Received: from localhost ([127.0.0.1]:46490 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WZ49a-0002XL-Mo
	for submit <at> debbugs.gnu.org; Sat, 12 Apr 2014 16:03:54 -0400
Received: from pruche.dit.umontreal.ca ([132.204.246.22]:35544)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <monnier@HIDDEN>) id 1WZ49X-0002X8-Ua
 for 8725 <at> debbugs.gnu.org; Sat, 12 Apr 2014 16:03:52 -0400
Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242])
 by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id s3CK3oGc016177;
 Sat, 12 Apr 2014 16:03:50 -0400
Received: by pastel.home (Postfix, from userid 20848)
 id 254A46015D; Sat, 12 Apr 2014 16:03:50 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
Message-ID: <jwvbnw68gz1.fsf-monnier+emacsbugs@HIDDEN>
References: <BLU159-w47B119579809569FDD30F9CE750@HIDDEN>
 <CAB=Rzgkoibkhc3L-Vo37qdg6H-GA7Lvf+L+B08r7pviH7X2Vaw@HIDDEN>
Date: Sat, 12 Apr 2014 16:03:50 -0400
In-Reply-To: <CAB=Rzgkoibkhc3L-Vo37qdg6H-GA7Lvf+L+B08r7pviH7X2Vaw@HIDDEN>
 (Hui Liu's message of "Sat, 12 Apr 2014 21:52:30 +0800")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0
X-NAI-Spam-Rules: 1 Rules triggered
	RV4910=0
X-NAI-Spam-Version: 2.3.0.9378 : core <4910> : inlines <726> : streams
 <1157686> : uri <1727594>
X-Spam-Score: -1.7 (-)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> and the reason is Imenu put items with submenus at the top. Such
> behaviour may be reasonable for programming modes, but is clearly
> unnecessary for text modes.

Actually it doesn't have much to do with text-modes vs programming-modes
but with the way the menu is built.  E.g. the menu could look like

   Index
   |- ...
   Section 1
   Section 2
   Section 3

if org-mode provided an "Index" submenu, in which case it would make a lot
of sense to put it on top.  So a better option is to let the major
mode decide.


        Stefan




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#8725: imenu--split-menu should not deliver surprises
Resent-From: Hui Liu <liuhui.zy@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 13 Apr 2014 03:45:01 +0000
Resent-Message-ID: <handler.8725.B8725.139736068526567 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 8725
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Stefan Monnier <monnier@HIDDEN>
Cc: 8725 <at> debbugs.gnu.org
Received: via spool by 8725-submit <at> debbugs.gnu.org id=B8725.139736068526567
          (code B ref 8725); Sun, 13 Apr 2014 03:45:01 +0000
Received: (at 8725) by debbugs.gnu.org; 13 Apr 2014 03:44:45 +0000
Received: from localhost ([127.0.0.1]:46595 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WZBLY-0006uQ-G5
	for submit <at> debbugs.gnu.org; Sat, 12 Apr 2014 23:44:44 -0400
Received: from mail-qa0-f68.google.com ([209.85.216.68]:50038)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <liuhui.zy@HIDDEN>) id 1WZBLX-0006u8-2O
 for 8725 <at> debbugs.gnu.org; Sat, 12 Apr 2014 23:44:43 -0400
Received: by mail-qa0-f68.google.com with SMTP id cm18so2158576qab.11
 for <8725 <at> debbugs.gnu.org>; Sat, 12 Apr 2014 20:44:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:in-reply-to:references:date:message-id:subject:from:to
 :cc:content-type;
 bh=cVUYle996m2hYMKjmOz/LBzEr71AcpHsbzQsL5DdAgQ=;
 b=Tgt5kA0RZI96L6UW+DOysiIPrdF/CLLPIljlYT8sqv5Bav1NVJT2V8fF4RZGFBrEz3
 3JkybC4e3JYzLcBj0X/6E48qGsC9KFdS15/ktah2zCU7dmN2qKypx5Sh6Ny9f8FuwuDe
 a73AvzIz8f0atu3EOvBa4V3tmls8tC8qDVhKVWFO4zyTo0cfOYKbOelF6Jw1f7af8Jer
 feaCeOhTKvq5+aDaVP28IDuJj/tXHNU5lCrmycZSk68H38Fs2pqwYXefqTNyiwVOv0dA
 9RigSZQ8uMuDKhEWZWpqXsNOgZkPsvAtnh9uT/VJ/XpfcyZAjYszGrq6PKH7n0wtKzqJ
 QamQ==
MIME-Version: 1.0
X-Received: by 10.224.30.131 with SMTP id u3mr10280178qac.50.1397360677018;
 Sat, 12 Apr 2014 20:44:37 -0700 (PDT)
Received: by 10.140.34.80 with HTTP; Sat, 12 Apr 2014 20:44:36 -0700 (PDT)
In-Reply-To: <jwvbnw68gz1.fsf-monnier+emacsbugs@HIDDEN>
References: <BLU159-w47B119579809569FDD30F9CE750@HIDDEN>
 <CAB=Rzgkoibkhc3L-Vo37qdg6H-GA7Lvf+L+B08r7pviH7X2Vaw@HIDDEN>
 <jwvbnw68gz1.fsf-monnier+emacsbugs@HIDDEN>
Date: Sun, 13 Apr 2014 11:44:36 +0800
Message-ID: <CAB=Rzgn1FD40ZSrLWm1zTXt=jcPoed-qLYCB4k1K4=NrMourNw@HIDDEN>
From: Hui Liu <liuhui.zy@HIDDEN>
Content-Type: text/plain; charset=UTF-8
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

I don't think it is better because it meaninglessly increases the
depth of menus. In fact, this problem mainly occurs in writing related
modes, and it is caused by the unreasonable sort in imenu--split-menu
instead of menus provided by these modes.

Is there any reason to put items with the submenu on top
indiscriminately? At least Imenu could provide an option about whether
to do so without regard to the original order of items. Then let the
major mode decide.

2014-04-13 4:03 GMT+08:00 Stefan Monnier <monnier@HIDDEN>:
>> and the reason is Imenu put items with submenus at the top. Such
>> behaviour may be reasonable for programming modes, but is clearly
>> unnecessary for text modes.
>
> Actually it doesn't have much to do with text-modes vs programming-modes
> but with the way the menu is built.  E.g. the menu could look like
>
>    Index
>    |- ...
>    Section 1
>    Section 2
>    Section 3
>
> if org-mode provided an "Index" submenu, in which case it would make a lot
> of sense to put it on top.  So a better option is to let the major
> mode decide.
>
>
>         Stefan




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#8725: imenu--split-menu should not deliver surprises
Resent-From: Stefan Monnier <monnier@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 14 Apr 2014 02:04:02 +0000
Resent-Message-ID: <handler.8725.B8725.139744103024835 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 8725
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Hui Liu <liuhui.zy@HIDDEN>
Cc: 8725 <at> debbugs.gnu.org
Received: via spool by 8725-submit <at> debbugs.gnu.org id=B8725.139744103024835
          (code B ref 8725); Mon, 14 Apr 2014 02:04:02 +0000
Received: (at 8725) by debbugs.gnu.org; 14 Apr 2014 02:03:50 +0000
Received: from localhost ([127.0.0.1]:47624 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WZWFS-0006SU-6A
	for submit <at> debbugs.gnu.org; Sun, 13 Apr 2014 22:03:50 -0400
Received: from pruche.dit.umontreal.ca ([132.204.246.22]:60045)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <monnier@HIDDEN>) id 1WZWFP-0006SL-3a
 for 8725 <at> debbugs.gnu.org; Sun, 13 Apr 2014 22:03:47 -0400
Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242])
 by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id s3E23jBU018592;
 Sun, 13 Apr 2014 22:03:45 -0400
Received: by pastel.home (Postfix, from userid 20848)
 id 2CC5D601BB; Sun, 13 Apr 2014 22:03:45 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
Message-ID: <jwvppkk651r.fsf-monnier+emacsbugs@HIDDEN>
References: <BLU159-w47B119579809569FDD30F9CE750@HIDDEN>
 <CAB=Rzgkoibkhc3L-Vo37qdg6H-GA7Lvf+L+B08r7pviH7X2Vaw@HIDDEN>
 <jwvbnw68gz1.fsf-monnier+emacsbugs@HIDDEN>
 <CAB=Rzgn1FD40ZSrLWm1zTXt=jcPoed-qLYCB4k1K4=NrMourNw@HIDDEN>
Date: Sun, 13 Apr 2014 22:03:45 -0400
In-Reply-To: <CAB=Rzgn1FD40ZSrLWm1zTXt=jcPoed-qLYCB4k1K4=NrMourNw@HIDDEN>
 (Hui Liu's message of "Sun, 13 Apr 2014 11:44:36 +0800")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Level: 
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0.2
X-NAI-Spam-Rules: 2 Rules triggered
	GEN_SPAM_FEATRE=0.2, RV4911=0
X-NAI-Spam-Version: 2.3.0.9378 : core <4911> : inlines <726> : streams
 <1158423> : uri <1728788>
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

> At least Imenu could provide an option about whether to do so without
> regard to the original order of items. Then let the major mode decide.

We're in violent agreement.


        Stefan





Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.