From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jared Finder via "Emacs development discussions." Newsgroups: gmane.emacs.devel Subject: Re: Making TTY menus more visual Date: Wed, 07 Oct 2020 23:39:07 -0700 Message-ID: <0168b49ea0f2b5533f6e20c6ad73eb0c@finder.org> References: <087df85a965fac6555a755c1bbebf1ea@finder.org> <83r1qhf5ii.fsf@gnu.org> <83wo07g0bf.fsf@gnu.org> <85afa5c0a0a789c6047e92f6ecfa9fcc@finder.org> <72bbff31bcf46be917c9e8d8236cad75@finder.org> <838scmfq4f.fsf@gnu.org> <83y2kme50p.fsf@gnu.org> <033517da1ce6762b3d3c656dad4d8f98@finder.org> <835z7pdvcp.fsf@gnu.org> Reply-To: Jared Finder Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2125"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Roundcube Webmail/1.3.15 Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Oct 08 08:40:39 2020 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 1kQPbS-0000Sj-64 for ged-emacs-devel@m.gmane-mx.org; Thu, 08 Oct 2020 08:40:38 +0200 Original-Received: from localhost ([::1]:41482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQPbR-000230-8K for ged-emacs-devel@m.gmane-mx.org; Thu, 08 Oct 2020 02:40:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQPa9-0001Ul-M5 for emacs-devel@gnu.org; Thu, 08 Oct 2020 02:39:18 -0400 Original-Received: from greenhill.hpalace.com ([2600:3c01::f03c:91ff:fe73:2daa]:34770) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQPa6-0008Eq-U1; Thu, 08 Oct 2020 02:39:17 -0400 Original-Received: from mail.finder.org (greenhill.hpalace.com [IPv6:2600:3c01::f03c:91ff:fe73:2daa]) by greenhill.hpalace.com (Postfix) with ESMTPSA id A4F877EC; Thu, 8 Oct 2020 06:39:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=finder.org; s=2018; t=1602139148; bh=b1JWSr5Q/WQrQaL9WgT9EpQD3Syz4J8lr0WZpfE+KrI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QstT4bRnOzNfd7qKfJfFOX+LtTVKeMEIwahKCpgP1j3CzTz4YLVw6QfzLXtHYc+z5 huTmK1XM/EpTQo2fFjmxKv3y5awZwCobVdFW5uNE8ev0F8JcJxtOo4q3oOrav3GpcG 40hnJEvtCrQzvhtytvKmatywA89ZblxynPDUM8dTKifvD6syNcSMNqwB7eH6O8Erb0 McFHW2iT6cl1cj++TsbBlfxtoUH7CAoHXC6uw2TWJhv4KOwlZ0Q0GBDxMZx4huBye1 sctNtV+ABoTh+em/LnHnZbo4WVgvpp9ndLXNZbL+jIbNJJsT98byMOXahKJ7aGgtvc +ITU9ARfsHS3w== In-Reply-To: <835z7pdvcp.fsf@gnu.org> X-Sender: jared@finder.org Received-SPF: pass client-ip=2600:3c01::f03c:91ff:fe73:2daa; envelope-from=jared@finder.org; helo=greenhill.hpalace.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.devel:257198 Archived-At: On 2020-10-04 11:45 pm, Eli Zaretskii wrote: >> Date: Sun, 04 Oct 2020 22:36:21 -0700 >> From: Jared Finder >> Cc: emacs-devel@gnu.org >> >> > This is okay as a general idea, but it would be more clean to make >> > Fmouse_position call a new C function (extracted from the first part >> > of Fmouse_position's code) that just computes the mouse coordinates. >> > Then Fmouse_position's would call mouse-position-function after the >> > new C function returns. Then in term.c we could call just that new C >> > function. This is because it is inappropriate for mouse_get_xy to >> > call mouse-position-function when a menu is being processed. >> >> That won't work. Making mouse_get_xy call mouse-position-function is >> the >> purpose of this change. mouse-position-function is how xterm-mouse >> injects its calculated mouse positions to the TTY menus. From >> searching >> the Emacs codebase for usage of mouse-position-function, it appears >> that >> xterm-mouse is the only client. Of course external libraries could use >> it too, but I assume they would have the same goal. > > Okay, but mouse-position-function can be used for any number of > purposes. That it's currently used only by xterm-mouse in the Emacs > sources doesn't mean it isn't used elsewhere. The functions in that > variable are not necessarily meant to be called in the context of TTY > menus; that would be an incompatible change. So I still think we > shouldn't call mouse-position-function in general in the TTY menu > case, only when xterm-mouse is active. Please change the code to call > mouse-position-function only in that single case. > > Perhaps a slightly more general way of doing that would be to > introduce another variable that a package must set for > mouse-position-function to be called in the context of TTY menus; > xterm-mouse will then bind that variable (or the TTY menu code in > menu-bar.el could do that for xterm-mouse). This way, we don't > hard-code xterm-mouse in the C sources. I'm going to push back here one more time. You have more expertise here than I, so if this isn't convincing, I can implement such a variable (it's easy enough). I'm pushing back because I can not envision a use case for mouse-position-function that would break for TTY menus but otherwise work for every other type of normal mouse input. Adding this extra step that must be done by all clients seems like adding needless complexity. I did a much more exhaustive search of Emacs code and remain convinced that the only use of mouse-position-function is for cases just like xt-mouse.el: I did a search of MELPA to see if there was any use of mouse-position-function. I found nothing. I searched GitHub for any usage and only found usages aligned with xt-mouse, specifically: * xt-mouse.el, loadhist.el from Gnu Emacs repo forks. * t-mouse.el from (old) Gnu Emacs repo forks. * ext-mouse.el, a modification of an old version of xt-mouse.el that adds dragging support. * hyperbole.el from Gnu Elpa, which uses this to fix a bug in old versions of Gnu Emacs. * A handful of other files that do not actually set mouse-position-function, they instead deal with other aspects (e.g. syntax highlighting built-in symbols) I realize this isn't an exhaustive list of all possible code, but I suspect it is a very representative list. Let me know your thoughts. As I said, I think you have more expertise here so I will defer to your call. -- MJF