From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#70622: [PATCH] New window parameter 'cursor-type' Date: Fri, 10 May 2024 19:20:05 +0300 Message-ID: <86cypt4p1m.fsf@gnu.org> References: <864jbmuf39.fsf@gnu.org> <8634r5tsit.fsf@gnu.org> <86y18wsmqy.fsf@gnu.org> <86cyq8sfif.fsf@gnu.org> <0519d8d8-2a3d-411a-a5bb-b556e0fb86db@gmx.at> <868r0ws9u1.fsf@gnu.org> <867cgfqcbn.fsf@gnu.org> <86jzk377kx.fsf@gnu.org> <86v83n5iry.fsf@gnu.org> <283e9319-8863-44e7-be72-995b8b36c37e@gmx.at> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8804"; mail-complaints-to="usenet@ciao.gmane.io" Cc: me@eshelyaron.com, 70622@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 10 18:21:18 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1s5Szl-00027X-Ud for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 10 May 2024 18:21:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5Sza-00040y-2O; Fri, 10 May 2024 12:21:06 -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 1s5SzX-00040f-Pj for bug-gnu-emacs@gnu.org; Fri, 10 May 2024 12:21:03 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s5SzX-0006Ju-F6 for bug-gnu-emacs@gnu.org; Fri, 10 May 2024 12:21:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s5SzW-00041a-7T for bug-gnu-emacs@gnu.org; Fri, 10 May 2024 12:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 May 2024 16:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70622 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70622-submit@debbugs.gnu.org id=B70622.171535801315413 (code B ref 70622); Fri, 10 May 2024 16:21:02 +0000 Original-Received: (at 70622) by debbugs.gnu.org; 10 May 2024 16:20:13 +0000 Original-Received: from localhost ([127.0.0.1]:42809 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s5Syj-00040X-BT for submit@debbugs.gnu.org; Fri, 10 May 2024 12:20:13 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:33890) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s5Syh-00040M-EI for 70622@debbugs.gnu.org; Fri, 10 May 2024 12:20:12 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s5Syd-0005FK-AY; Fri, 10 May 2024 12:20:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=oMkBYR0XDrZbx7hScctwETk6RfzQdHT5PTns0WryA6c=; b=kA1E2wGNxXbR zfYgHvC1pLs+jw0OCiF8HaFN6JcCt1HXkifzlmPYSGXVP/Uly23RQsgSDL2mJXJTU2mXZrl1UO3SY Di639OSV/X0vcLilNZr8uqOKB+9csIZFWRZkBHuxO4tH305dJnp/uhXRPnpmDhDsxuKbh5sAsEshA YBVhgnnhjoH+bejihsIm5QGUF69O+HUqvMTZqWUR5p9m1vPYAQ+/gpL1ky3YKv+8Nhm/viXKxEn5R uQzpcR8lqeFixV2fUU6nMJ6JNEzDRpLLiZMITk2pyTXtxcuKgV54zcKj8ph8G6u6OGpThav2SGEpa GjuQSsGv9CBnPUI5zU2VBw==; In-Reply-To: <283e9319-8863-44e7-be72-995b8b36c37e@gmx.at> (message from martin rudalics on Fri, 10 May 2024 10:58:58 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:284822 Archived-At: > Date: Fri, 10 May 2024 10:58:58 +0200 > Cc: 70622@debbugs.gnu.org > From: martin rudalics > > >>> +DEFUN ("set-window-cursor-type", Fset_window_cursor_type, > >>> + Sset_window_cursor_type, 2, 2, 0, > >>> + doc: /* Set the `cursor-type' of WINDOW to TYPE. > >>> + > >>> +This setting takes precedence over the variable `cursor-type', and TYPE > >>> +has the same format as the value of that variable. WINDOW nil means use > >>> +the selected window. */) > >>> + (Lisp_Object window, Lisp_Object type) > >>> +{ > >>> + struct window *w = decode_live_window (window); > >>> + > >>> + wset_cursor_type (w, type); > >> > >> Shouldn't we validate the value of TYPE before plugging it into the > >> window? I know we will validate it at display time, but maybe it's a > >> good idea to do that here as well, and signal an error up front? > > > > AFAICT there are no invalid values, since we take "any other value" to > > mean the same as 'hollow' (see C-h v cursor-type), so I think not > > validating anything should be perfectly valid :) > > > >> Martin, WDYT? > > I think Eshel is right. Any reasons? > > Maybe, but that's a bit tricky because we need to consider whether or > > not the window is selected and what cursor-in-non-selected-windows has > > to say to figure out what the cursor will actually look like. Currently > > this function just provides Lisp with access to the window slot, so we > > have all the needed information available in Lisp. I suggest keeping > > 'window-cursor-type' simple and, if the need arises, providing a Lisp > > function that calculates the effective cursor type for a given window. > > WDYT? > > If needed, the function can be given a second argument that allows to > retrieve either the value specified for this window or the effective > value used. SGTM, thanks.