From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: Tip: tty mode-line popup menus Date: Tue, 10 Dec 2024 11:09:20 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39370"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Emacs Devel To: Stefan Kangas Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 10 11:10:13 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tKxC0-000A9Q-7o for ged-emacs-devel@m.gmane-mx.org; Tue, 10 Dec 2024 11:10:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKxBH-0004wq-4a; Tue, 10 Dec 2024 05:09:27 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tKxBF-0004v2-Ad for emacs-devel@gnu.org; Tue, 10 Dec 2024 05:09:25 -0500 Original-Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tKxBD-0003gH-Io for emacs-devel@gnu.org; Tue, 10 Dec 2024 05:09:25 -0500 Original-Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4361815b96cso1484775e9.1 for ; Tue, 10 Dec 2024 02:09:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733825362; x=1734430162; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iNQkxxWphVqy8qf7QT1Mv0YILRePB8Hon4b3L6NUYpY=; b=d+yOli02GlWEL1ccNc8ctfki5zc7x3VasTWAy7OMlMX2Uh/Naf/500B/jwy9PrlQ0I x4RgWPFHq4fdDEh/1BGQDfxhXC3SLaWp1liYhSpBAm8VX5txqx5K8X/3C2+pCPiTcACl 0kmP5gTcE1TcFl5pU5QS/CsQEkJdgK/l76ZneUhib9asl6DYIGD6HUXqCXcgcpC9O4Gf M0faVB9OKHEu5iuYhfy+hOmWLHRtNe8dV/04S677dXJ8fk662qwgjEr1ObD6ub6K7KXe A/thExRpqhzybliBlKhpWELnaPDwy4xL/psVzLt31Qc+1DpZ6JkJjDeiRarL9r/iaUU1 8GFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733825362; x=1734430162; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=iNQkxxWphVqy8qf7QT1Mv0YILRePB8Hon4b3L6NUYpY=; b=R2m1N7gvOJW2ee+wmdnI+Bbk9XWzbnuzUSwoNNgXZYfpXZ2a/3Qn3GlNFshQvTCkkL 5qRJLvKSoxv/tZTK13IJJ/VXEpcQ8ipBtNIHY7sPYdYHbc7A+W8pP3X9eB6GZaMSSwDW HKtJyMjA1WZjSVpPequf9/Q/U3vM/uLwv73hZQCD9sDQf601Snu/MQ7CWyWEnSADXbX0 Kg7wmzC9jAtl3SYpBX8qLbgZqo8gM91wyx4FF+XRfzAZj0mBatNF2eq2SCl6XKbiTWnA uGYn8YxzW07B35UXJdtS8eGV0I7nRY/cThMpy2xnWTxR3IfY7HV6scnXmiJ8TKMuAj44 DOwg== X-Gm-Message-State: AOJu0YxpmX5hg911hyJ9NilYQy7vOmUksL+Im6FTWfu8AvPaKig+wdbv 1JKgmTMe0NGV8F20CHmTfzn9M7g8TsFN/Qg7IwPbnK4hSkvU8fDQ5UZpWQ== X-Gm-Gg: ASbGncsuZTA5B2PD+SZNzj/YynnWpReU38IJQQN/qAjywjgvvh/mNRYkGQznoIQuMno TLzfZAmjm1fNPeymdK16eo7YaCnqX6V+gJ0j4Xg8xEtKFl3CtPhm2cYHWcLsELjYhe2oP+nScUY wopEaTzKCy2hAtaKoh9dPzkaNVQEjUhU82YZMlpPTo0f6MAwcCTBqc5hQxY2f/EFsSscKrPOuFp YEG2QoifNz7sLnRpfrrFFc8OUqiHvArSkosIQ4x/sstvgHGI64pVf34eSJbQ85xnx0Y4j8qJ1IG PAknq+YD1e8Kj/maDZTZegV5Y3Rt8CVaNl6ZALore0I7t+LGfUA85GSIAXvgRGU= X-Google-Smtp-Source: AGHT+IFLfUjkbZZPUWFNnx8HEb64fOcdsgIQLbJWI4vGMr9vmDQhfPmOEDuEikDwtp2CSz0pW3bghQ== X-Received: by 2002:a05:600c:384a:b0:434:ff9d:a370 with SMTP id 5b1f17b1804b1-434ffeb245fmr34733515e9.0.1733825361363; Tue, 10 Dec 2024 02:09:21 -0800 (PST) Original-Received: from pro2 (p200300e0b73a150089512521f002ebd0.dip0.t-ipconnect.de. [2003:e0:b73a:1500:8951:2521:f002:ebd0]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434eb8f18fcsm111699035e9.24.2024.12.10.02.09.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 02:09:20 -0800 (PST) In-Reply-To: ("Gerd =?utf-8?Q?M=C3=B6llmann=22'?= =?utf-8?Q?s?= message of "Tue, 10 Dec 2024 10:32:10 +0100") Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=gerd.moellmann@gmail.com; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:326278 Archived-At: Gerd M=C3=B6llmann writes: > Gerd M=C3=B6llmann writes: > >> Stefan Kangas writes: >> >>> Gerd M=C3=B6llmann writes: >>> >>>> I don't like the tty behavior. It is fiddly with a track pad, which I >>>> normally use, leading to inadvertent menu selections. Furthermore, >>>> keyboard operation of the menu seems impossible. >>>> >>>> To fix this, I've added this in my init.el: >>>> >>>> (defun my-fix-mode-line-map (map) >>>> (let* ((down-mouse (kbd " ")) >>>> (mouse (kbd " ")) >>>> (def (lookup-key map down-mouse))) >>>> (when def >>>> (define-key map down-mouse nil) >>>> (define-key map mouse def)))) >>>> >>>> (my-fix-mode-line-map mode-line-major-mode-keymap) >>>> (my-fix-mode-line-map mode-line-minor-mode-keymap) >>> >>> How about adding a defcustom for this behavior? >> >> Maybe, don't know. One problem is that I don't know where else something >> similar is done. I know only the two places above plus one in the >> Minions package, which probably simply mimicked what Emacs does in >> bindings.el. Or in other words, I don't have enough of an overview to >> design something that's really useful. >> >>> I guess many users are on laptops with trackpads these days, and would >>> find that convenient. >> >> I guess so, especially if they use tap-to-click like I do. > > BTW,=20 > > (my-fix-mode-line-map mode-line-major-mode-keymap) > > in combination with using the persistent-scratch package somehow seems > to mess up the major-mode mode-line menu. I don't yet understand how, so > be warned. Resorting to logic sometimes helps. The problem is pretty simple: Original definition in mode-line-major-mode-keymap looks like (down-mouse-1 menu-item "Menu Bar" ignore :filter #f(compiled-function (_) # ")) =3D> (keymap "IELM Mode" keymap (keymap (ielm menu-item "IELM" (keymap "IELM" ... And setting that with define-key is not the right thing, obviously. One would need a function returning the "raw" entry of a key in a keymap, No idea if Emacs has such a function. If it does, I can't find it. In essence, I have to retract that tip. It doesn't work as expected.