Add simpler binds for calendar month/year navigation

* lisp/calendar/calendar.el (calendar-mode-map): Add keybindings
'{' and '}' for month navigation, '[' and ']' for year
navigation (bug#78753).
* doc/emacs/calendar.texi (Calendar Unit Motion): Document
them.
This commit is contained in:
Paul Nelson 2025-06-10 11:33:05 +02:00 committed by Juri Linkov
parent 81a3e4e511
commit fbb77abc81
3 changed files with 20 additions and 0 deletions

View file

@ -84,12 +84,16 @@ Move point one week forward (@code{calendar-forward-week}).
@item C-p
Move point one week backward (@code{calendar-backward-week}).
@item M-@}
@itemx @}
Move point one month forward (@code{calendar-forward-month}).
@item M-@{
@itemx @{
Move point one month backward (@code{calendar-backward-month}).
@item C-x ]
@itemx ]
Move point one year forward (@code{calendar-forward-year}).
@item C-x [
@itemx [
Move point one year backward (@code{calendar-backward-year}).
@end table
@ -114,12 +118,16 @@ week. @kbd{C-f} (@code{calendar-forward-day}) and @kbd{C-b}
@kbd{C-p}, just as they normally are in other modes.
@kindex M-@} @r{(Calendar mode)}
@kindex @} @r{(Calendar mode)}
@findex calendar-forward-month
@kindex M-@{ @r{(Calendar mode)}
@kindex @{ @r{(Calendar mode)}
@findex calendar-backward-month
@kindex C-x ] @r{(Calendar mode)}
@kindex ] @r{(Calendar mode)}
@findex calendar-forward-year
@kindex C-x [ @r{(Calendar mode)}
@kindex [ @r{(Calendar mode)}
@findex calendar-backward-year
The commands for motion by months and years work like those for
weeks, but move a larger distance. The month commands @kbd{M-@}}
@ -137,6 +145,9 @@ to the beginning or end of a paragraph, whereas these month and year
commands move by an entire month or an entire year, keeping the same
date within the month or year.
You can also use the simpler to type keystrokes @kbd{@}} and @kbd{@{}
to navigate by month, and @kbd{]} and @kbd{[} to navigate by year.
All these commands accept a numeric argument as a repeat count.
For convenience, the digit keys and the minus sign specify numeric
arguments in Calendar mode even without the Meta modifier. For example,

View file

@ -2169,6 +2169,11 @@ is bound to 'C-l' in the calendar buffer.
You can now use the mouse wheel to scroll the calendar by 3 months.
With the shift modifier, it scrolls by one month. With the meta
modifier, it scrolls by year.
*** Simpler month and year navigation binds in calendar.
The month and year navigation binds 'M-}', 'M-{', 'C-x ]' and 'C-x ['
now admit the alternatives '}', '{', ']' and '['.
* New Modes and Packages in Emacs 31.1

View file

@ -1603,7 +1603,9 @@ Otherwise, use the selected window of EVENT's frame."
(define-key map "\C-b" 'calendar-backward-day)
(define-key map "\C-p" 'calendar-backward-week)
(define-key map "\e{" 'calendar-backward-month)
(define-key map "{" 'calendar-backward-month)
(define-key map "\C-x[" 'calendar-backward-year)
(define-key map "[" 'calendar-backward-year)
(define-key map "\C-f" 'calendar-forward-day)
(define-key map "\C-n" 'calendar-forward-week)
(define-key map [left] 'calendar-backward-day)
@ -1611,7 +1613,9 @@ Otherwise, use the selected window of EVENT's frame."
(define-key map [right] 'calendar-forward-day)
(define-key map [down] 'calendar-forward-week)
(define-key map "\e}" 'calendar-forward-month)
(define-key map "}" 'calendar-forward-month)
(define-key map "\C-x]" 'calendar-forward-year)
(define-key map "]" 'calendar-forward-year)
(define-key map "\C-a" 'calendar-beginning-of-week)
(define-key map "\C-e" 'calendar-end-of-week)
(define-key map "\ea" 'calendar-beginning-of-month)