GNU bug report logs - #26421
25.1; Handling of prefix arg in menus

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Drew Adams <drew.adams@HIDDEN>; dated Sun, 9 Apr 2017 18:06:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 26421 <at> debbugs.gnu.org:


Received: (at 26421) by debbugs.gnu.org; 9 Apr 2017 18:15:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 09 14:15:10 2017
Received: from localhost ([127.0.0.1]:40045 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cxHMj-0003Uw-Q0
	for submit <at> debbugs.gnu.org; Sun, 09 Apr 2017 14:15:09 -0400
Received: from userp1040.oracle.com ([156.151.31.81]:39513)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1cxHMi-0003Ud-AM
 for 26421 <at> debbugs.gnu.org; Sun, 09 Apr 2017 14:15:08 -0400
Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234])
 by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id
 v39IF14m032054
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK)
 for <26421 <at> debbugs.gnu.org>; Sun, 9 Apr 2017 18:15:02 GMT
Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236])
 by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v39IF1rP024979
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK)
 for <26421 <at> debbugs.gnu.org>; Sun, 9 Apr 2017 18:15:01 GMT
Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16])
 by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v39IF0rp013684
 for <26421 <at> debbugs.gnu.org>; Sun, 9 Apr 2017 18:15:01 GMT
MIME-Version: 1.0
Message-ID: <9691383b-048c-4a08-8d60-57d13276c8ea@default>
Date: Sun, 9 Apr 2017 11:14:59 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: 26421 <at> debbugs.gnu.org
Subject: RE: bug#26421: 25.1; Handling of prefix arg in menus
References: <38c2c69b-7911-40dc-9eaf-b9ea644d2800@default>
In-Reply-To: <38c2c69b-7911-40dc-9eaf-b9ea644d2800@default>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 12.0.6753.5000 (x86)]
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Source-IP: aserv0022.oracle.com [141.146.126.234]
X-Spam-Score: -5.1 (-----)
X-Debbugs-Envelope-To: 26421
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://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: <https://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: -5.1 (-----)

> * 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.
>=20
> * 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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#26421; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 9 Apr 2017 18:05:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 09 14:05:03 2017
Received: from localhost ([127.0.0.1]:40035 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cxHCw-0003Fa-Ke
	for submit <at> debbugs.gnu.org; Sun, 09 Apr 2017 14:05:02 -0400
Received: from eggs.gnu.org ([208.118.235.92]:56442)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1cxHCu-0003F5-9T
 for submit <at> debbugs.gnu.org; Sun, 09 Apr 2017 14:05:01 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <drew.adams@HIDDEN>) id 1cxHCo-0004Ld-99
 for submit <at> debbugs.gnu.org; Sun, 09 Apr 2017 14:04:55 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: *
X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_50,RCVD_IN_SORBS_SPAM
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:34421)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <drew.adams@HIDDEN>)
 id 1cxHCo-0004LZ-6S
 for submit <at> debbugs.gnu.org; Sun, 09 Apr 2017 14:04:54 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:47413)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <drew.adams@HIDDEN>) id 1cxHCn-0006Gq-1H
 for bug-gnu-emacs@HIDDEN; Sun, 09 Apr 2017 14:04:54 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <drew.adams@HIDDEN>) id 1cxHCj-0004Ke-TK
 for bug-gnu-emacs@HIDDEN; Sun, 09 Apr 2017 14:04:53 -0400
Received: from aserp1040.oracle.com ([141.146.126.69]:26622)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <drew.adams@HIDDEN>)
 id 1cxHCj-0004Jg-JS
 for bug-gnu-emacs@HIDDEN; Sun, 09 Apr 2017 14:04:49 -0400
Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71])
 by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id
 v39I4kP1018418
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK)
 for <bug-gnu-emacs@HIDDEN>; Sun, 9 Apr 2017 18:04:46 GMT
Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72])
 by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v39I4jmD022304
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK)
 for <bug-gnu-emacs@HIDDEN>; Sun, 9 Apr 2017 18:04:46 GMT
Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16])
 by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v39I4jYE020134
 for <bug-gnu-emacs@HIDDEN>; Sun, 9 Apr 2017 18:04:45 GMT
MIME-Version: 1.0
Message-ID: <38c2c69b-7911-40dc-9eaf-b9ea644d2800@default>
Date: Sun, 9 Apr 2017 11:04:44 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 25.1; Handling of prefix arg in menus
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 12.0.6753.5000 (x86)]
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Source-IP: userv0021.oracle.com [156.151.31.71]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -3.5 (---)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://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: <https://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: -3.5 (---)

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
=09      :visible
=09      (progn
=09=09(message "PP: %S"
=09=09=09 (and current-prefix-arg
=09=09=09      (prefix-numeric-value current-prefix-arg)))
=09=09(and current-prefix-arg
=09=09     (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
=09      :visible
=09      (progn
=09=09(message "PP: %S"
=09=09=09 (and current-prefix-arg
=09=09=09      (prefix-numeric-value current-prefix-arg)))
=09=09(and current-prefix-arg
=09=09     (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=3D-O2
 -static -g3''




Acknowledgement sent to Drew Adams <drew.adams@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#26421; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
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.