From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: James Cherti Newsgroups: gmane.emacs.devel Subject: Re: Disabling mouse input Date: Sat, 2 Nov 2024 09:17:21 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38656"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 02 14:24:06 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 1t7E6l-0009pT-Vy for ged-emacs-devel@m.gmane-mx.org; Sat, 02 Nov 2024 14:24:04 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t7E0X-00031o-I5; Sat, 02 Nov 2024 09:17:38 -0400 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 1t7E0Q-000313-Gz for emacs-devel@gnu.org; Sat, 02 Nov 2024 09:17:30 -0400 Original-Received: from dormouse.elm.relay.mailchannels.net ([23.83.212.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t7E0O-0001uz-G5 for emacs-devel@gnu.org; Sat, 02 Nov 2024 09:17:30 -0400 X-Sender-Id: dreamhost|x-authsender|contact@jamescherti.com Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id D8F4084229A for ; Sat, 2 Nov 2024 13:17:23 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a312.dreamhost.com (trex-13.trex.outbound.svc.cluster.local [100.105.170.43]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 7DC75842E65 for ; Sat, 2 Nov 2024 13:17:23 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1730553443; a=rsa-sha256; cv=none; b=WpeEGf/s2XFcpgbH+o4SZCIZhIwuP5P8vhCnQAgjJcY9hSfmrM7DdG0Us/343qwFmhnyb3 ToFdJqW1Tch7lqPxU9FFLX/xhjo9/2iaAu7R80GHXFf5DXdhoq5qhPeKxvwrnB3/z7ZUPM aerVNe4thK4NgQbVZhrMZT+9QEGjhqLDxrsjotWBzCD4iz1FXlOqFgInb6kHNNWOrX7oFj nkmQJ+wSq30zSHum2e8nI1ot/E1Nnw/K9AkwXQLRVe4/yNzu/Fv5IpHb0A5zbsJhQCnfu0 cu4oHJIImaW6VPCPhwRMRA60Tw2calJ/myem3h3NdZ6wYzkFpZY1/usM8ELxBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1730553443; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=qL4MYxp+pc9/6KdZGbnucd95dSrB6dpdr12baGxR/AE=; b=V4z+Su2/zqWCVrJz3cYOWDmge1+WA6rOUwdEDD5S33OYsDdUQGr2+PV3gfwFk+RBhlsQDh VeRzXCv0QYfxaj+tYNSCtrGRf131Y6PXaqN4oem2lS2jRI6ChzIfGEXd/1AywUdzcDfinV kzcl0Oq+DjJ1FaHuN7c376OSbxUsxavl1QN41m3qMVblrbmzQ3o/Ld4a2TyrCpXnEAyiPS WHkoDXuLgFxCXnfaB0kNT/cCMtFjMjnMubh2pbPhJtERh5fp/Ckld9J2Q3+BbfzdfJh/km Ik+hz99y2mljOEAaku8eXZsCY5g2vOVgsCmDO5U0a9xf0c1LMS1Xz8CGbSDVKA== ARC-Authentication-Results: i=1; rspamd-5cc7c5c758-49k9t; auth=pass smtp.auth=dreamhost smtp.mailfrom=contact@jamescherti.com X-Sender-Id: dreamhost|x-authsender|contact@jamescherti.com X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|contact@jamescherti.com X-MailChannels-Auth-Id: dreamhost X-Obese-Whistle: 37f03fcf6a333e53_1730553443731_2394655150 X-MC-Loop-Signature: 1730553443731:1730356902 X-MC-Ingress-Time: 1730553443731 Original-Received: from pdx1-sub0-mail-a312.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.105.170.43 (trex/7.0.2); Sat, 02 Nov 2024 13:17:23 +0000 Original-Received: from [192.168.5.23] (bras-base-toroon0648w-grc-11-142-198-74-25.dsl.bell.ca [142.198.74.25]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: contact@jamescherti.com) by pdx1-sub0-mail-a312.dreamhost.com (Postfix) with ESMTPSA id 4XgdYv1n4pz8H for ; Sat, 2 Nov 2024 06:17:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jamescherti.com; s=dreamhost; t=1730553443; bh=qL4MYxp+pc9/6KdZGbnucd95dSrB6dpdr12baGxR/AE=; h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding; b=DDj250J9tem557KqQrSOzwnykQDrfOFwCaaAmNQ4JeLQWsHe4HhRv1TQUDYkQXlyK 2usEFIkQjxAds3L5MHoHIAh7Hl5eR2mqzfAJES4I0aO1EKHfGKFpdhRjTJngKSqcbu FkrNn+ENsrnGZp8oeY38APcW1cF7VShRZAX4Ad8FFmowfsCcULbytnZJ2t5RUzuIN9 K1tq0Wm1y8cDTiGL+yBXFGa6RwjjhlNq3zcAmK8hE6M2NRgnzHmTkjRkSPmSEhc7Cl RQYs+k4eRu+95hrvr5O3teqbumaqo+i/Jtx84G/xO9NQjEPNDdV9P94ILH3M8cZBPR hdEiVHkTqdDfg== Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=23.83.212.50; envelope-from=contact@jamescherti.com; helo=dormouse.elm.relay.mailchannels.net 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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:325012 Archived-At: Hello Daniel, I tested your patch, and it works well. After applying it, I simply set `ignore-mouse-input` to `t`, which completely disabled the mouse. I hope this patch will be integrated into Emacs core. Like you, I prefer using the keyboard exclusively, as I find it significantly more efficient than relying on the mouse while developing software in Emacs. Currently, I'm using the disable-mouse package to disable the mouse, but it only remaps mouse key bindings, which is less elegant and efficient than setting `ignore-mouse-input` to `t`. -- James Cherti https://www.jamescherti.com/ On 2024-11-01 22:01, Daniel Radetsky wrote: > I want to disable mouse input to emacs. One reason is that, > while typing something on my laptop, I may accidentally hit > the touchpad, whereupon emacs will complain that > "C-c C-x is not a real keybind" (whereas > I had actually intended to enter C-c C-x j or something). > This is annoying, and none of the common solutions to this > problem (e.g. palm detection) seem good enough. Since I > don't want to use the mouse with emacs to begin with, I'd > rather just disable it altogether. > > Unfortunately, there doesn't seem to be a way to do that. > You can of course unbind the mouse inputs, but they will > still be generated and lead to spurious errors as above. > It's also not possible to solve this with advice since the > calls to functions which generate the mouse inputs occur in > C code. As far as I can tell, the only solution is hacking > core emacs. > > Attached is a draft patch. I imagine I'll have to add > more/better docs and other checklist items, but what I have > here will allow others to see what I've done and tell me if > I'm doing it the Right Way or the Stupid Way. > > Basically, we define a lisp var in C `ignore-mouse-input`. > If you setq it to t in emacs, you stop receiving mouse > inputs. If you setq it back to nil, you get them again. It > works for me, but unfortunately I have no idea how to write > ert tests. Maybe somebody could point me to a few of the > simple ones to study in order to get the idea. > > Also, the C code does look a bit funny, but I couldn't > figure out any automated way to check/fix it, and I'm not > actually familiar with that C style. flycheck said it looked > fine. I tried running clang-format, but it said there were > already 3000 lines worth of errors in that file before I'd > even touched it, so that's obviously out-of-date. I didn't > see anything about this in the contrib guide. In any case, I > can fix this later once I know whether, in principle, the > change is acceptable. > > --dmr