GNU bug report logs -
#26421
25.1; Handling of prefix arg in menus
Previous Next
To reply to this bug, email your comments to 26421 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#26421
; Package
emacs
.
(Sun, 09 Apr 2017 18:06:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Drew Adams <drew.adams <at> oracle.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 09 Apr 2017 18:06:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
emacs -Q
Evaluate this code:
(defvar menu-bar-foo-menu (make-sparse-keymap "Foo"))
(define-key global-map [menu-bar foo] (cons "Foo" menu-bar-foo-menu))
(define-key menu-bar-foo-menu [toto]
'(menu-item "Toto" forward-char
:visible
(progn
(message "PP: %S"
(and current-prefix-arg
(prefix-numeric-value current-prefix-arg)))
(and current-prefix-arg
(prefix-numeric-value current-prefix-arg)))))
(defvar bar-menu (make-sparse-keymap "Bar"))
(define-key menu-bar-foo-menu [bar] (cons "Bar" bar-menu))
(define-key bar-menu [foobar]
'(menu-item "XXX" forward-char
:visible
(progn
(message "PP: %S"
(and current-prefix-arg
(prefix-numeric-value current-prefix-arg)))
(and current-prefix-arg
(prefix-numeric-value current-prefix-arg)))))
Open *Messages* in another frame, so you can see messages there.
In the original frame, access menu Foo and submenu Bar, using (1) no
prefix arg, (2) a prefix arg introduced using `C-u', and (3) a prefix
arg introduced in another way, such as `M-2'.
The actual prefix arg you give is not employed in the :visible code
(same thing for :enable). Instead:
* For no prefix arg given, or for any prefix arg given other than by
using explicit `C-u', the value used by :visible is nil.
* For a prefix arg given using explicit `C-u', the value used by
:visible is 4.
That is, in the former case you see always "PP: nil" output, and for the
latter you see always "PP: 4" output.
This means that you cannot use the prefix arg in a menu-item test.
This should not be the case. (This problem is not new.)
In GNU Emacs 25.1.1 (x86_64-w64-mingw32)
of 2016-11-15
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --without-dbus --without-compress-install 'CFLAGS=-O2
-static -g3''
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#26421
; Package
emacs
.
(Sun, 09 Apr 2017 18:16:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 26421 <at> debbugs.gnu.org (full text, mbox):
> * For no prefix arg given, or for any prefix arg given other than by
> using explicit `C-u', the value used by :visible is nil.
>
> * For a prefix arg given using explicit `C-u', the value used by
> :visible is 4.
I should have added that for the value is nil also for plain `C-u',
that is, `C-u' not followed by anything. But 4 is the value for
plain `C-u C-u' etc.
IOW:
If `C-u' is followed by another key then the value is 4.
If `C-u' is not followed by another key then the value is nil.
This bug report was last modified 8 years and 66 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.