GNU bug report logs - #11148
23.3; x-popup-menu not behaving as documented

Previous Next

Package: emacs;

Reported by: "Dino Chiesa" <dpchiesa <at> hotmail.com>

Date: Sun, 1 Apr 2012 15:46:02 UTC

Severity: normal

Found in version 23.3

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11148 in the body.
You can then email your comments to 11148 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11148; Package emacs. (Sun, 01 Apr 2012 15:46:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Dino Chiesa" <dpchiesa <at> hotmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 01 Apr 2012 15:46:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Dino Chiesa" <dpchiesa <at> hotmail.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 23.3; x-popup-menu not behaving as documented
Date: Sun, 1 Apr 2012 08:45:12 -0700
[Message part 1 (text/plain, inline)]
These tests were performed on Windows. 

As documented here
http://www.gnu.org/software/emacs/manual/html_node/elisp/Simple-Menu-Items.html#Simple-Menu-Items

if the binding on a menu item is nil, then the mnenu item is
unselectable.

But this elisp code: 

    (x-popup-menu t (list "TITLE" (list
                                "PANE"  
                                (list "menu item 1" nil)
                                (list "menu item 2" nil))))

...shows a menu in which both items are selectable. 

This bug may be relevant to bug #11138. One of the proposed fixes for
#11138 at the time of this report is to render a multi-line dialog box
as a menu, with each "line" in the message displayed as an unselectable
menu item.  But this brief test seems to indicate that the
"unselectable" menu items are not really unselectable, at least on Windows.
In that case the proposed fix would be unsatisfactory.

I'd like to also raise a documentation bug, as well: there ought to be
examples showing how to use x-popup-menu, on the page I cited above. 
A few simple examples will make this method much more usable.

In particular, if the result I reported here is due to incorrect usage on my part, 
providing examples in the documentation is the way to fix it. Even if I am using 
this function correctly, this example (and others) ought to be put into the 
documentation to illustrate the proper use of "unselectable" menu items. 

Thanks.


In GNU Emacs 23.3.1 (i386-mingw-nt6.1.7601)
of 2011-03-10 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 6.1.7601
configured using `configure --with-gcc (4.5) --no-opt --cflags -Ic:/imagesupport/include'

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: Lisp Interaction

Minor modes in effect:
  auto-revert-mode: t
  recentf-mode: t
  yas/global-mode: t
  yas/minor-mode: t
  shell-dirtrack-mode: t
  global-hl-line-mode: t
  hl-line-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:
o o f " C-p C-a <escape> SPC C-n C-n C-n C-c C-e C-p 
C-p C-e <escape> <backspace> <backspace> C-n <escape> 
b <escape> d <backspace> C-d C-d C-d C-d C-d C-d C-p 
C-p C-a <escape> SPC <escape> C-f C-c C-e C-p C-p C-a 
<escape> SPC C-n C-n C-n C-w C-y C-y C-p C-p C-p C-k 
C-k C-k C-k C-p C-e <backspace> <backspace> <backspace> 
<escape> C-b C-n C-e <escape> b <escape> b C-p C-b 
SPC i t e m SPC <escape> d f <backspace> 1 C-n <escape> 
b <backspace> i t e m SPC 2 <escape> d <escape> b C-b 
C-b C-b C-b C-b SPC C-p C-p C-p C-a <escape> SPC <escape> 
C-f C-c C-e C-p C-b : C-n C-a <escape> SPC C-n C-w 
C-y C-y <escape> b <escape> b <escape> b <escape> b 
C-p C-p C-n C-n - - s p a c e <escape> d <escape> d 
<escape> d C-n <escape> SPC C-p C-p C-e <backspace> 
<backspace> C-n C-n C-p C-b C-b <return> C-p C-p C-p 
C-e C-b <backspace> C-n C-e <backspace> C-n <backspace> 
C-n C-a <tab> C-e ) C-n <escape> SPC <escape> C-b C-c 
C-e C-p C-n C-n C-n C-n C-k C-k C-y C-n C-y C-n C-n 
<escape> SPC <escape> C-b C-c C-e C-n C-n C-n C-n C-e 
C-n C-b C-b C-b <backspace> 3 C-n C-n C-k C-k C-k C-k 
C-k C-k <return> <escape> SPC <escape> C-b C-c C-e 
<escape> SPC C-n C-n C-n C-n C-n C-n C-n C-w C-y C-p 
C-p C-p C-p C-p C-p C-p <tab> <escape> SPC <escape> 
C-f <escape> C-r C-p C-p C-p C-p C-p C-p C-b C-b C-b 
C-b <return> C-a C-p <escape> SPC <escape> C-f <escape> 
C-r C-u C-x TAB <escape> x r e p o r t - g n u - b 
<tab> <backspace> <backspace> <backspace> <backspace> 
<backspace> <tab> <return>

Recent messages:
Quit
Mark set [4 times]
Mark activated
Quit
Mark set [3 times]
Quit
Mark set
Quit
Mark set [2 times]
Mark activated [2 times]

Load-path shadows:
/users/dino/elisp/refill hides c:/emacs/lisp/textmodes/refill

Features:
(shadow sort mail-extr message ecomplete rfc822 mml mml-sec
password-cache mm-decode mm-bodies mm-encode mailabbrev nnheader
gnus-util netrc gmm-utils mailheader canlock sha1 hex-util hashcash
emacsbug newcomment dabbrev tabify cc-mode cc-fonts cc-menus cc-cmds
parse-time timezone dired-aux ansi-color multi-isearch finder-inf
time-stamp mail-utils url-cache url-http tls mail-parse rfc2231 rfc2047
rfc2045 qp ietf-drums time-date url-gw url-auth url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-util
url-parse url-vars mm-util mail-prsvr mailcap autorevert server
thesaurus recentf tree-widget synonyms-autoloads package lorem
cperl-mode smarter-compile js-mode-fixups jsshell-bundle jsshell
flyphpcs hideshow cc-styles cc-align cc-engine cc-vars cc-defs
flymake-cursor byte-opt warnings bytecomp byte-compile flymake compile
flymake-fixups dired-fixups dired regexp-opt defaultcontent thingatpt
csslint yasnippet dropdown-list derived easy-mmode help-mode view assoc
cl cl-19 powershell shell comint ring tfs skeleton edmacro kmacro
httpget hl-line advice help-fns advice-preload cus-edit easymenu
cus-start cus-load wid-edit 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)
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11148; Package emacs. (Sun, 01 Apr 2012 16:20:01 GMT) Full text and rfc822 format available.

Message #8 received at 11148 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Dino Chiesa'" <dpchiesa <at> hotmail.com>, <11148 <at> debbugs.gnu.org>
Subject: RE: bug#11148: 23.3; x-popup-menu not behaving as documented
Date: Sun, 1 Apr 2012 09:19:29 -0700
> (x-popup-menu
>   t
>   (list "TITLE"
>         (list "PANE" (list "menu item 1" nil)
>         (list "menu item 2" nil))))
> ...shows a menu in which both items are selectable. 
>
> This bug may be relevant to bug #11138. One of the proposed fixes for
> #11138 at the time of this report is to render a multi-line dialog box
> as a menu, with each "line" in the message displayed as an unselectable
> menu item.
> 
> But this brief test seems to indicate that the "unselectable"
> menu items are not really unselectable, at least on Windows.
> In that case the proposed fix would be unsatisfactory.

First, I don't really care how bug #11138 is fixed.

My point in suggesting splitting a message at \n chars was that the bug can be
fixed - even if in a rudimentary way by treating the message's separate lines as
separate menu lines (since the code on MS Windows currently treats a
`message-box' as a popup menu).

Here is what I mean (one way), using the bug report's multiline message:

(defun foo (event)
  (interactive "e")
  (let ((choice  (x-popup-menu
                 	 event
                   '("Message"
                     ("" "First line in a long-ish message.")
                     ("" "This is line number 2 in the message.")
                     ("" ("OK"))))))
    (and choice  (call-interactively choice))))

(global-set-key [double-mouse-2] 'foo)
(global-set-key [mouse-2] nil)

Double-click mouse-2.  The message's lines are indeed handled as unselectable
menu items (yes, on MS Windows).

Is that the best looking implementation of a message dialog box?  Not IMO.

But given the desire to implement a message box using `x-popup-menu', that shows
at least that it can be done.  Is that better than the current implementation,
which jams the multiple lines of the message together?  Maybe.

Certainly we can hope for a better implementation.  Stefan suggested using a
tooltip frame, for instance.  And maybe (?) at least some of the implementation
could be moved from C to Lisp.
	 
> I'd like to also raise a documentation bug, as well: there ought to be
> examples showing how to use x-popup-menu, on the page I cited above. 
> A few simple examples will make this method much more usable.

Agreed, especially since there are a few different ways to use `x-popup-menu':
keymap, list of keymaps, or menu of multiple panes, the last of these being
radically different from the first two and unique wrt the rest of Emacs.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11148; Package emacs. (Sun, 01 Apr 2012 16:29:02 GMT) Full text and rfc822 format available.

Message #11 received at 11148 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: "Dino Chiesa" <dpchiesa <at> hotmail.com>
Cc: 11148 <at> debbugs.gnu.org
Subject: Re: bug#11148: 23.3; x-popup-menu not behaving as documented
Date: Sun, 01 Apr 2012 18:28:13 +0200
"Dino Chiesa" <dpchiesa <at> hotmail.com> writes:

> if the binding on a menu item is nil, then the mnenu item is
> unselectable.
>
> But this elisp code: 
>
>     (x-popup-menu t (list "TITLE" (list
>                                 "PANE"  
>                                 (list "menu item 1" nil)
>                                 (list "menu item 2" nil))))

That menu is not a keymap, so the alternative representation is
selected, where unselectable items are represented by strings, not
conses.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11148; Package emacs. (Sun, 01 Apr 2012 20:37:01 GMT) Full text and rfc822 format available.

Message #14 received at 11148 <at> debbugs.gnu.org (full text, mbox):

From: "Dino Chiesa" <dpchiesa <at> hotmail.com>
To: "Drew Adams" <drew.adams <at> oracle.com>,
	<11148 <at> debbugs.gnu.org>
Subject: Re: bug#11148: 23.3; x-popup-menu not behaving as documented
Date: Sun, 1 Apr 2012 13:36:48 -0700
K, thanks for the reply.
I'll let you guys figure out what you want to do about 11138;

It may be that doc changes are the way to fix 11148.\
-Dino

-----Original Message----- 
From: Drew Adams
Sent: Sunday, April 01, 2012 9:19 AM
To: 'Dino Chiesa' ; 11148 <at> debbugs.gnu.org
Subject: RE: bug#11148: 23.3; x-popup-menu not behaving as documented

> (x-popup-menu
>   t
>   (list "TITLE"
>         (list "PANE" (list "menu item 1" nil)
>         (list "menu item 2" nil))))
> ...shows a menu in which both items are selectable.
>
> This bug may be relevant to bug #11138. One of the proposed fixes for
> #11138 at the time of this report is to render a multi-line dialog box
> as a menu, with each "line" in the message displayed as an unselectable
> menu item.
>
> But this brief test seems to indicate that the "unselectable"
> menu items are not really unselectable, at least on Windows.
> In that case the proposed fix would be unsatisfactory.

First, I don't really care how bug #11138 is fixed.

My point in suggesting splitting a message at \n chars was that the bug can 
be
fixed - even if in a rudimentary way by treating the message's separate 
lines as
separate menu lines (since the code on MS Windows currently treats a
`message-box' as a popup menu).

Here is what I mean (one way), using the bug report's multiline message:

(defun foo (event)
 (interactive "e")
 (let ((choice  (x-popup-menu
                event
                  '("Message"
                    ("" "First line in a long-ish message.")
                    ("" "This is line number 2 in the message.")
                    ("" ("OK"))))))
   (and choice  (call-interactively choice))))

(global-set-key [double-mouse-2] 'foo)
(global-set-key [mouse-2] nil)

Double-click mouse-2.  The message's lines are indeed handled as 
unselectable
menu items (yes, on MS Windows).

Is that the best looking implementation of a message dialog box?  Not IMO.

But given the desire to implement a message box using `x-popup-menu', that 
shows
at least that it can be done.  Is that better than the current 
implementation,
which jams the multiple lines of the message together?  Maybe.

Certainly we can hope for a better implementation.  Stefan suggested using a
tooltip frame, for instance.  And maybe (?) at least some of the 
implementation
could be moved from C to Lisp.

> I'd like to also raise a documentation bug, as well: there ought to be
> examples showing how to use x-popup-menu, on the page I cited above.
> A few simple examples will make this method much more usable.

Agreed, especially since there are a few different ways to use 
`x-popup-menu':
keymap, list of keymaps, or menu of multiple panes, the last of these being
radically different from the first two and unique wrt the rest of Emacs.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11148; Package emacs. (Sat, 22 Sep 2012 03:32:02 GMT) Full text and rfc822 format available.

Message #17 received at 11148 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: "Dino Chiesa" <dpchiesa <at> hotmail.com>
Cc: 11148 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#11148: 23.3; x-popup-menu not behaving as documented
Date: Sat, 22 Sep 2012 11:30:00 +0800
"Dino Chiesa" <dpchiesa <at> hotmail.com> writes:

> It may be that doc changes are the way to fix 11148.

Fixed in trunk, thanks.





bug closed, send any further explanations to 11148 <at> debbugs.gnu.org and "Dino Chiesa" <dpchiesa <at> hotmail.com> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 22 Sep 2012 03:32:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 20 Oct 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 213 days ago.

Previous Next


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