unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11148: 23.3; x-popup-menu not behaving as documented
@ 2012-04-01 15:45 Dino Chiesa
  2012-04-01 16:19 ` Drew Adams
  2012-04-01 16:28 ` Andreas Schwab
  0 siblings, 2 replies; 5+ messages in thread
From: Dino Chiesa @ 2012-04-01 15:45 UTC (permalink / raw)
  To: 11148

[-- Attachment #1: Type: text/plain, Size: 6193 bytes --]


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)

[-- Attachment #2: Type: text/html, Size: 9330 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#11148: 23.3; x-popup-menu not behaving as documented
  2012-04-01 15:45 bug#11148: 23.3; x-popup-menu not behaving as documented Dino Chiesa
@ 2012-04-01 16:19 ` Drew Adams
  2012-04-01 20:36   ` Dino Chiesa
  2012-04-01 16:28 ` Andreas Schwab
  1 sibling, 1 reply; 5+ messages in thread
From: Drew Adams @ 2012-04-01 16:19 UTC (permalink / raw)
  To: 'Dino Chiesa', 11148

> (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.






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#11148: 23.3; x-popup-menu not behaving as documented
  2012-04-01 15:45 bug#11148: 23.3; x-popup-menu not behaving as documented Dino Chiesa
  2012-04-01 16:19 ` Drew Adams
@ 2012-04-01 16:28 ` Andreas Schwab
  1 sibling, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2012-04-01 16:28 UTC (permalink / raw)
  To: Dino Chiesa; +Cc: 11148

"Dino Chiesa" <dpchiesa@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@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#11148: 23.3; x-popup-menu not behaving as documented
  2012-04-01 16:19 ` Drew Adams
@ 2012-04-01 20:36   ` Dino Chiesa
  2012-09-22  3:30     ` Chong Yidong
  0 siblings, 1 reply; 5+ messages in thread
From: Dino Chiesa @ 2012-04-01 20:36 UTC (permalink / raw)
  To: Drew Adams, 11148

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@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.






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#11148: 23.3; x-popup-menu not behaving as documented
  2012-04-01 20:36   ` Dino Chiesa
@ 2012-09-22  3:30     ` Chong Yidong
  0 siblings, 0 replies; 5+ messages in thread
From: Chong Yidong @ 2012-09-22  3:30 UTC (permalink / raw)
  To: Dino Chiesa; +Cc: 11148

"Dino Chiesa" <dpchiesa@hotmail.com> writes:

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

Fixed in trunk, thanks.






^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-09-22  3:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-01 15:45 bug#11148: 23.3; x-popup-menu not behaving as documented Dino Chiesa
2012-04-01 16:19 ` Drew Adams
2012-04-01 20:36   ` Dino Chiesa
2012-09-22  3:30     ` Chong Yidong
2012-04-01 16:28 ` Andreas Schwab

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).