Subject: Re: bug#78298: [PATCH] Scroll with mouse wheel in calendar

From: Eli Zaretskii <[email-masked]>
Date: Fri, 16 May 2025 14:23:41 +0300

> From: Manuel Giraud <[email-masked]>
> Cc: Juri Linkov <[email-masked]>,  Eli Zaretskii <[email-masked]>,
>   [email-masked]
> Date: Fri, 16 May 2025 10:52:36 +0200
> 
> Michael Heerdegen <[email-masked]> writes:
> 
> [...]
> 
> > | Debugger entered--Lisp error: (void-variable displayed-month)
> 
> Ok.  So AFAIU, one (overlooked) difference between backward/forward
> commands and scroll commands is that the latter are taking care of an
> event parameter that is used to execute the command in the context of
> the calendar buffer.
> 
> So after all, I think we should be using this "scroll framework" to
> scroll years also.  Here is an updated patch that could be applied on
> top of master.

Thanks, but please explain in the doc strings what is meant by "left"
and "right" in this case (AFAIU, it means "back" and "forward",
respectively).  Using "left" and "right" might be confusing in
bidirectional context, so we had better spelled that out explicitly.

(I originally thought of changing the command names, but since we
already have calendar-scroll-left/right, I guess replacing that with
"forward" and "back" could adversely affect discoverability.)

> +(defun calendar-scroll-left-year (arg &optional event)
> +  "Scroll the displayed calendar window left by 12*ARG months.
> +If ARG is negative the calendar is scrolled right.

Bother: the first and the 2nd sentences contradict each other.  Are we
scrolling the window or the text shown in the window?  Their
directions are opposite.

> +;;;###cal-autoload
> +(defun calendar-scroll-right-year (arg &optional event)
> +  "Scroll the displayed calendar window right by 12*ARG months.
> +If ARG is negative the calendar is scrolled left.  Maintains the relative
> +position of the cursor with respect to the calendar as well as possible.
> +EVENT is an event like `last-nonmenu-event'."

Same here.