From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Nick Helm Newsgroups: gmane.emacs.bugs Subject: bug#31371: 26.1; Menu-bar stops working after search Date: Mon, 07 May 2018 14:48:16 +1200 Message-ID: References: <20180506101411.GA3327@breton.holly.idiocy.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1525661230 23159 195.159.176.226 (7 May 2018 02:47:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 7 May 2018 02:47:10 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (darwin) Cc: 31371@debbugs.gnu.org To: Alan Third Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon May 07 04:47:05 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fFWB7-0005v5-9N for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 May 2018 04:47:05 +0200 Original-Received: from localhost ([::1]:43923 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFWDC-00051J-AP for geb-bug-gnu-emacs@m.gmane.org; Sun, 06 May 2018 22:49:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53503) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFWD5-00050u-Hf for bug-gnu-emacs@gnu.org; Sun, 06 May 2018 22:49:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fFWD0-00059o-IG for bug-gnu-emacs@gnu.org; Sun, 06 May 2018 22:49:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:43956) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fFWD0-00059O-61 for bug-gnu-emacs@gnu.org; Sun, 06 May 2018 22:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fFWCz-0007jv-Ry for bug-gnu-emacs@gnu.org; Sun, 06 May 2018 22:49:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Nick Helm Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 07 May 2018 02:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31371 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31371-submit@debbugs.gnu.org id=B31371.152566131329717 (code B ref 31371); Mon, 07 May 2018 02:49:01 +0000 Original-Received: (at 31371) by debbugs.gnu.org; 7 May 2018 02:48:33 +0000 Original-Received: from localhost ([127.0.0.1]:51853 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fFWCW-0007jE-B5 for submit@debbugs.gnu.org; Sun, 06 May 2018 22:48:33 -0400 Original-Received: from mail-sy3aus01on0111.outbound.protection.outlook.com ([104.47.117.111]:32496 helo=AUS01-SY3-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fFWCT-0007iz-CH for 31371@debbugs.gnu.org; Sun, 06 May 2018 22:48:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tenpointcomms.onmicrosoft.com; s=selector1-tenpoint-co-nz; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=/sJHsSa+MJ1me5N7nM382PkecGw7k0IV3/oBZ+oWFTE=; b=vCUZMv/XNLNKgcRpEK1rBA10IQjqQCfxW5V1V8qiVCeUdCuvmUQqbepy+f1HrqR9OOEkXfGbBA26WtmeWwGIGrhQvoGkpJDDurutBcIElu9dATfEY1hzRXLPcIcIHfc9oemY1c37McCNEGtaVvdEObE/c7zGH4JsOiPDODzC8xM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=nick@tenpoint.co.nz; Original-Received: from oberon.local (125.239.171.29) by SY2PR01MB2907.ausprd01.prod.outlook.com (2603:10c6:1:1e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.735.17; Mon, 7 May 2018 02:48:20 +0000 In-Reply-To: <20180506101411.GA3327@breton.holly.idiocy.org> (Alan Third's message of "Sun, 6 May 2018 11:14:11 +0100") X-Originating-IP: [125.239.171.29] X-ClientProxiedBy: SY2PR01CA0016.ausprd01.prod.outlook.com (2603:10c6:1:14::28) To SY2PR01MB2907.ausprd01.prod.outlook.com (2603:10c6:1:1e::20) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(7021125)(5600026)(4534165)(7022125)(4603075)(4627221)(201702281549075)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:SY2PR01MB2907; X-Microsoft-Exchange-Diagnostics: 1; SY2PR01MB2907; 3:8xP8UAzw5WC5sKJkSb8smfRTFwzmOiE1VQ6I0TEsvJ3HGkrquglNHoqQUXjvPFWtr8UOgN+0q+kO3bnt1Hlupk4zX3i6x1263imw6PNtYa1Z7XGLNpkwtmvVLB5iYrrHFG1J0XTWkdcaeIV7OQwsa0f5WO9/T82OFMgQKOD2rsNgOe/7knIdaXzC1ZZXAbbI50wsnxLm0RkWfHY3RgoBj5IdjuAI2t6c86m1RIolh7pe2Nn90eyGXVJIPXXRdWi+; 25:DTai4DMMwFcrjZBUMBKs+6c4K5s2IcW/kW/xFmOmrEx4NelL7T/+83K3l+v26QoIw17i7na99nqpKDgWs+gYjHXxamnfwNdmChTkTivtp1us+btUmLVCNqKgpLwVfQ7DHeZia834DWt7RwtaqOfgWucZW78tgNC8YqKuOl+fAeqZUbV42ji+fjRQghs18wuNzbn+9P9lZLK++cU+vM/wiXjLWXkHcH3dJXn8o412eDCgE/Qs156xbEiEkT+C675u/cpohVVtThujkIFe4cap7RcVwqGRbFuPyFiCcZ91wsAqE+pyKRuL1gL8okblGRp/2Vi2jDOkf3/c5MTRE3qSbw==; 31:jeS0S1nF8vhgVE+tETf5gp3uovSqmTDxHOLlK5M26RUvrxbCPZDX1xUaqvzH5Fd+D3WL83lWkHpfQkQQEwcP0yz4lsKJqclmgGgyQQYpHT8yrQYcIMh8xJBnKXj35A7sCdZiYToxR+PPocJFp/SvBUqP9vSxn4a/Pl+hXD+CcyRK/4HewJb/nOmi/zfpYpkbdTK5SQ/WIYiJEMchOwRE/S4jZgNvW8uBWv/0GnyVY X-MS-TrafficTypeDiagnostic: SY2PR01MB2907: X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 0 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3231254)(944501410)(52105095)(93006095)(93001095)(3002001)(149026)(6041310)(20161123564045)(20161123558120)(2016111802025)(20161123560045)(20161123562045)(6043046)(6072148)(201708071742011); SRVR:SY2PR01MB2907; BCL:0; PCL:0; RULEID:; SRVR:SY2PR01MB2907; X-Microsoft-Exchange-Diagnostics: 1; SY2PR01MB2907; 4:CpKMY4rDVpG226XfTLVobliXxrMhBFdJ3iPhMQcXvYaeWAC4sCJUIayoq1YA5fXEnLlemwufqwtTg9p8YX3lyJ/OlfSRX6KOIfkvul3Vbph80PNsftXV9Ca4PIE3evPOOHilvTFObzxSopgob20uvPpW7AItMHc+iVUmM0lhBsFj9WD7aml22PFFus8mXk+3HeckLw9mmo7qVB1KxX8XKswd9ray0UCnbbMp88z45S+ufz2W54ycyNK+FcI83al6X0jGlhGH4tvPpS3CmUvbgQ== X-Forefront-PRVS: 066517B35B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39380400002)(376002)(396003)(346002)(366004)(39830400003)(199004)(189003)(51444003)(76176011)(16526019)(229853002)(74482002)(6486002)(36756003)(6246003)(106356001)(6512007)(26005)(105586002)(6916009)(6666003)(97736004)(53936002)(186003)(52116002)(2486003)(52146003)(23676004)(50466002)(66066001)(47776003)(476003)(59450400001)(6506007)(305945005)(386003)(81156014)(8676002)(81166006)(8936002)(8746002)(478600001)(68736007)(4326008)(5660300001)(2906002)(7736002)(316002)(58126008)(446003)(11346002)(486006)(956004)(86362001)(3846002)(6116002)(2616005)(25786009); DIR:OUT; SFP:1102; SCL:1; SRVR:SY2PR01MB2907; H:oberon.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:3; Received-SPF: None (protection.outlook.com: tenpoint.co.nz does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1; SY2PR01MB2907; 23:c81vsQ3kuUoGGLFmzSM5ikhvTiEQPmXqZ8lATfM8G5/KdL65R7YfntKFW/MRPGRKqsaz1zly90nxYapfh2O7YwBRN/L8D7Pr2aMzUnitju47xUdGf2FHvQdAkro6FvHT8g8yO2o79N4Z009MgPJc/iv/GZOBYlP2bz0SuQY8uLA1KP86tsa5dOAhUZt47hnZMtH3R8Sym5hcs09s2FNT/PF8x6MboE8vN+eByfG+qKPMCQmccvVx9Ni4EvCNP3efdxfZtjbMB25tlrxCMhond+C8QfsYsWa3q4XEVrUN+fwqzD3UtRbLC0cVxIChya6PQXJ3hUieygo5I0FQe/nkb6tW6bPSDfjrrHwOEoJD+3uWbFsjfjexsOZZcDugvkWo79QyBFpIK9Uhh17qSS1PLCpdI0jekFajFalFGR4eAxm3tjiFj/zk5pTh+ClN7/nTiB4h5ax7qpzvzGz796C3lgImwAjI3D32b+KkzIHr7Ez4iII8kZGAyFARujtSy1TF5erlxFPqZfhGMm0k6Or/lMQiZ+MLHFU9i4hPIZT9Wr5jTFEjCFPNImxCs4wH48WA7r96EjRfztyzREk1pS2K4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aUW4YSxCwl5TBUEPeL11LHkX62rHCO7k8ejD64EqODEnQMEKSepx8=; 24:IJf1yzL5l3a5BwcQQn89Olpn1wfy8cJ3X4T4yJfuAka510GeWra05NxC51wQio5K3WuaWdOk74s5PqFQriW/4OWAocTEgs0F3Qg5lHjKcgY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SY2PR01MB2907; 7:LwgaslxT1AW0CF+vtAeEqhmJlAXxARel17aUeaREgaUiPdueyJUGqYTb8my4lM/dGTjuUWxd2Aw9sO7gnfVDA+rCoYXwEYpIp/fSKGys65Zvk8vkN1PGJC/bP3mY16RqlSLRiRkK9oQ5abx5p9ZoYEQJNOhjp2b8kuzQg+kxCC9VusySlGfOFozcgwC2ojz8P23+suqbyrxOCPgnPhfmOpzDKDCPxfILKjEhlRrUqsLV8cpRiJ5t5qjilBkM5+xq X-MS-Office365-Filtering-Correlation-Id: 62855a37-0b8c-4acc-cddb-08d5b3c4fe9f X-OriginatorOrg: tenpoint.co.nz X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2018 02:48:20.7609 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 62855a37-0b8c-4acc-cddb-08d5b3c4fe9f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: ed686f26-19e8-407b-91d0-7364c1c6f5cf X-MS-Exchange-Transport-CrossTenantHeadersStamped: SY2PR01MB2907 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:146054 Archived-At: On Sun, 06 May 2018 at 22:14:11 +1200, Alan Third wrote: > On Sun, May 06, 2018 at 02:15:57AM +1200, Nick Helm wrote: >>=20 >> Emacs menu-bar does not work after a help search on macOS. >>=20 >> Note that the Help menu does not reappear and the mouse does not move >> correctly (slows down) while moving over the word "Help". Subsequent >> clicks on the menu-bar do not work as expected either.=20 > > Looks like it goes into some sort of infinite loop calling > ns_update_menubar. If you go to the left so it opens some non=E2=80=90help > menu, then go back to help it works fine (I think). > > The menu code seems pretty horrible to me, so this may take some > time... I had a look as well and I see what you mean, it's a bit of a mess. It's a wild guess, but here's a theory: the problem happens because mainMenu is trying to simultaneously be part NSMenu (Help's spotlight search field and the context help topics) and part EmacsMenu (Help's standard Lisp menu items). When a user clicks on the menu bar, Emacs postpones the event via menu_will_open_state, creates all the EmacsMenu menu items from Lisp and regenerates the mouse click event with a call to ns_check_pending_open_menu in order to actually display the menu. The trouble is, NSMenu doesn't know anything about this. When the user clicks it immediately displays what it thinks is the Help menu (sans the Lisp stuff, which doesn't exist yet). When the EmacsMenu part is ready, it regenerates the click event to display the menu, but NSMenu interprets this as an instruction to hide the menu. This repeats for each dragging mouse event over the menu-bar, hence we have a loop. If this is the case, it should cause problems even by simply opening and closing the Help menu. And I think that's what we're seeing. From Emacs -Q, try opening and closing the Help menu (ignore search), then click between the visible frame and the desktop a few times. After a couple of tries, the frame cannot regain proper focus and the menu-bar doesn't operate at all. I had a fiddle around with a couple of ideas. The first removes the NSMenu parts of the Help menu by creating an empty menu object and using it to override the system's default Help. Unfortunately, this removes the search field and the context topics, but the EmacsMenu menu items then work as expected. I don't think NS Emacs has any Apple Help Book files (the only entries that appear seem to be auto-generated) so this might not be so bad. The search field is really useful for command discovery though. I also tried interrupting the call to ns_check_pending_open_menu in x_activate_menubar. If you comment the call out, the menu sort of works as expected, other than having to initially generate two events (click twice) to get the Lisp menus to appear on each frame (one click works for the appMenu and Help, but they only contain the NSMenu menu items, as expected). I tried to make the call conditional on menu_state or trackingMenu, but I haven't got it working. Maybe I don't understand why a custom menu class is necessary, but I think the right solution is to convert Help from EmacsMenu to NSMenu. And, if we're going to do that, why not convert all of mainMenu and do everything with standard NSMenu and NSMenuItem methods?=20 All of the delayed events and tracking stuff seems over-complicated and unnecessary. What am I missing?=20