GNU bug report logs -
#70622
[PATCH] New window parameter 'cursor-type'
Previous Next
Reported by: Eshel Yaron <me <at> eshelyaron.com>
Date: Sun, 28 Apr 2024 06:29:01 UTC
Severity: normal
Tags: patch
Fixed in version 30.1
Done: Eshel Yaron <me <at> eshelyaron.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> From: Eshel Yaron <me <at> eshelyaron.com>
> Cc: rudalics <at> gmx.at, 70622 <at> debbugs.gnu.org
> Date: Thu, 09 May 2024 16:19:31 +0200
>
> >> +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 :)
I know, but that's because there's no useful way of signaling an error
in the middle of redisplay. Here we have an opportunity to help the
caller to catch any mistakes before the value is applied, so why not?
> 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?
Martin suggested a way to have both, so I think we should take it.
This bug report was last modified 1 year and 96 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.