Mercurial > emacs
annotate lisp/calendar/cal-move.el @ 94649:6a4a5b1ca5a1
*** empty log message ***
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Mon, 05 May 2008 22:50:58 +0000 |
parents | eaaf578ce48f |
children | e49abd957e81 |
rev | line source |
---|---|
13053 | 1 ;;; cal-move.el --- calendar functions for movement in the calendar |
2 | |
79703 | 3 ;; Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
67465
a55ee709ec8d
Update copyright pending Emacs 22.
Glenn Morris <rgm@gnu.org>
parents:
65919
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
13053 | 5 |
6 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu> | |
65919
5c09efcfc1d9
Update maintainer email address.
Glenn Morris <rgm@gnu.org>
parents:
64085
diff
changeset
|
7 ;; Maintainer: Glenn Morris <rgm@gnu.org> |
13053 | 8 ;; Keywords: calendar |
9 ;; Human-Keywords: calendar | |
10 | |
11 ;; This file is part of GNU Emacs. | |
12 | |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
14 ;; it under the terms of the GNU General Public License as published by | |
78216
93e11478c954
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
15 ;; the Free Software Foundation; either version 3, or (at your option) |
13053 | 16 ;; any later version. |
17 | |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; You should have received a copy of the GNU General Public License | |
14169 | 24 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
26 ;; Boston, MA 02110-1301, USA. | |
13053 | 27 |
28 ;;; Commentary: | |
29 | |
93486
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
30 ;; See calendar.el. |
13053 | 31 |
32 ;;; Code: | |
33 | |
92916
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
34 (require 'calendar) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
35 |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
36 ;;;###cal-autoload |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
37 (defun calendar-cursor-to-nearest-date () |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
38 "Move the cursor to the closest date. |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
39 The position of the cursor is unchanged if it is already on a date. |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
40 Returns the list (month day year) giving the cursor position." |
93329
6139daabcf5f
(calendar-cursor-to-nearest-date): Remove un-needed local `date'.
Glenn Morris <rgm@gnu.org>
parents:
92916
diff
changeset
|
41 (or (calendar-cursor-to-date) |
6139daabcf5f
(calendar-cursor-to-nearest-date): Remove un-needed local `date'.
Glenn Morris <rgm@gnu.org>
parents:
92916
diff
changeset
|
42 (let ((column (current-column))) |
92916
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
43 (when (> 3 (count-lines (point-min) (point))) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
44 (goto-line 3) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
45 (move-to-column column)) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
46 (if (not (looking-at "[0-9]")) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
47 (if (and (not (looking-at " *$")) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
48 (or (< column 25) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
49 (and (> column 27) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
50 (< column 50)) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
51 (and (> column 52) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
52 (< column 75)))) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
53 (progn |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
54 (re-search-forward "[0-9]" nil t) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
55 (backward-char 1)) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
56 (re-search-backward "[0-9]" nil t))) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
57 (calendar-cursor-to-date)))) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
58 |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
59 (defvar displayed-month) ; from calendar-generate |
52112
e7d0572ccca5
(displayed-month, displayed-year): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents:
31670
diff
changeset
|
60 (defvar displayed-year) |
e7d0572ccca5
(displayed-month, displayed-year): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents:
31670
diff
changeset
|
61 |
92916
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
62 ;;;###cal-autoload |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
63 (defun calendar-cursor-to-visible-date (date) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
64 "Move the cursor to DATE that is on the screen." |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
65 (let ((month (calendar-extract-month date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
66 (day (calendar-extract-day date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
67 (year (calendar-extract-year date))) |
92916
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
68 (goto-line (+ 3 |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
69 (/ (+ day -1 |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
70 (mod |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
71 (- (calendar-day-of-week (list month 1 year)) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
72 calendar-week-start-day) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
73 7)) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
74 7))) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
75 (move-to-column (+ 6 |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
76 (* 25 |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
77 (1+ (calendar-interval |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
78 displayed-month displayed-year month year))) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
79 (* 3 (mod |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
80 (- (calendar-day-of-week date) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
81 calendar-week-start-day) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
82 7)))))) |
19892 | 83 |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
84 ;;;###cal-autoload |
13053 | 85 (defun calendar-goto-today () |
86 "Reposition the calendar window so the current date is visible." | |
87 (interactive) | |
92916
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
88 (let ((today (calendar-current-date))) ; the date might have changed |
13053 | 89 (if (not (calendar-date-is-visible-p today)) |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
90 (calendar-generate-window) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
91 (calendar-update-mode-line) |
25411
0d68ae69cd8c
Call the new hook in every movement function.
Richard M. Stallman <rms@gnu.org>
parents:
24337
diff
changeset
|
92 (calendar-cursor-to-visible-date today))) |
0d68ae69cd8c
Call the new hook in every movement function.
Richard M. Stallman <rms@gnu.org>
parents:
24337
diff
changeset
|
93 (run-hooks 'calendar-move-hook)) |
13053 | 94 |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
95 ;;;###cal-autoload |
13053 | 96 (defun calendar-forward-month (arg) |
97 "Move the cursor forward ARG months. | |
98 Movement is backward if ARG is negative." | |
99 (interactive "p") | |
100 (calendar-cursor-to-nearest-date) | |
101 (let* ((cursor-date (calendar-cursor-to-date t)) | |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
102 (month (calendar-extract-month cursor-date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
103 (day (calendar-extract-day cursor-date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
104 (year (calendar-extract-year cursor-date)) |
93486
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
105 (last (progn |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
106 (calendar-increment-month month year arg) |
93486
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
107 (calendar-last-day-of-month month year))) |
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
108 (day (min last day)) |
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
109 ;; Put the new month on the screen, if needed, and go to the new date. |
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
110 (new-cursor-date (list month day year))) |
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
111 (if (not (calendar-date-is-visible-p new-cursor-date)) |
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
112 (calendar-other-month month year)) |
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
113 (calendar-cursor-to-visible-date new-cursor-date)) |
25411
0d68ae69cd8c
Call the new hook in every movement function.
Richard M. Stallman <rms@gnu.org>
parents:
24337
diff
changeset
|
114 (run-hooks 'calendar-move-hook)) |
13053 | 115 |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
116 ;;;###cal-autoload |
13053 | 117 (defun calendar-forward-year (arg) |
118 "Move the cursor forward by ARG years. | |
119 Movement is backward if ARG is negative." | |
120 (interactive "p") | |
121 (calendar-forward-month (* 12 arg))) | |
122 | |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
123 ;;;###cal-autoload |
13053 | 124 (defun calendar-backward-month (arg) |
125 "Move the cursor backward by ARG months. | |
126 Movement is forward if ARG is negative." | |
127 (interactive "p") | |
128 (calendar-forward-month (- arg))) | |
129 | |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
130 ;;;###cal-autoload |
13053 | 131 (defun calendar-backward-year (arg) |
132 "Move the cursor backward ARG years. | |
133 Movement is forward is ARG is negative." | |
134 (interactive "p") | |
135 (calendar-forward-month (* -12 arg))) | |
136 | |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
137 ;;;###cal-autoload |
82150
0d322d300115
(calendar-scroll-left, calendar-scroll-right):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82148
diff
changeset
|
138 (defun calendar-scroll-left (&optional arg event) |
13053 | 139 "Scroll the displayed calendar left by ARG months. |
140 If ARG is negative the calendar is scrolled right. Maintains the relative | |
92634
decf6dfe9876
(calendar-scroll-left, calendar-scroll-right): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
92590
diff
changeset
|
141 position of the cursor with respect to the calendar as well as possible. |
decf6dfe9876
(calendar-scroll-left, calendar-scroll-right): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
92590
diff
changeset
|
142 EVENT is an event like `last-nonmenu-event'." |
82150
0d322d300115
(calendar-scroll-left, calendar-scroll-right):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82148
diff
changeset
|
143 (interactive (list (prefix-numeric-value current-prefix-arg) |
0d322d300115
(calendar-scroll-left, calendar-scroll-right):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82148
diff
changeset
|
144 last-nonmenu-event)) |
31670 | 145 (unless arg (setq arg 1)) |
82150
0d322d300115
(calendar-scroll-left, calendar-scroll-right):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82148
diff
changeset
|
146 (save-selected-window |
94312
eaaf578ce48f
(calendar-scroll-left): Handle case when event-start is nil.
Glenn Morris <rgm@gnu.org>
parents:
93844
diff
changeset
|
147 ;; Nil if called from menu-bar. |
eaaf578ce48f
(calendar-scroll-left): Handle case when event-start is nil.
Glenn Morris <rgm@gnu.org>
parents:
93844
diff
changeset
|
148 (if (setq event (event-start event)) (select-window (posn-window event))) |
82150
0d322d300115
(calendar-scroll-left, calendar-scroll-right):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82148
diff
changeset
|
149 (calendar-cursor-to-nearest-date) |
92916
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
150 (unless (zerop arg) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
151 (let ((old-date (calendar-cursor-to-date)) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
152 (today (calendar-current-date)) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
153 (month displayed-month) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
154 (year displayed-year)) |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
155 (calendar-increment-month month year arg) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
156 (calendar-generate-window month year) |
92916
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
157 (calendar-cursor-to-visible-date |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
158 (cond |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
159 ((calendar-date-is-visible-p old-date) old-date) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
160 ((calendar-date-is-visible-p today) today) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
161 (t (list month 1 year)))))) |
82150
0d322d300115
(calendar-scroll-left, calendar-scroll-right):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82148
diff
changeset
|
162 (run-hooks 'calendar-move-hook))) |
13053 | 163 |
92916
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
164 (define-obsolete-function-alias |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
165 'scroll-calendar-left 'calendar-scroll-left "23.1") |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
166 |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
167 ;;;###cal-autoload |
82150
0d322d300115
(calendar-scroll-left, calendar-scroll-right):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82148
diff
changeset
|
168 (defun calendar-scroll-right (&optional arg event) |
13053 | 169 "Scroll the displayed calendar window right by ARG months. |
170 If ARG is negative the calendar is scrolled left. Maintains the relative | |
92634
decf6dfe9876
(calendar-scroll-left, calendar-scroll-right): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
92590
diff
changeset
|
171 position of the cursor with respect to the calendar as well as possible. |
decf6dfe9876
(calendar-scroll-left, calendar-scroll-right): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
92590
diff
changeset
|
172 EVENT is an event like `last-nonmenu-event'." |
82150
0d322d300115
(calendar-scroll-left, calendar-scroll-right):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82148
diff
changeset
|
173 (interactive (list (prefix-numeric-value current-prefix-arg) |
0d322d300115
(calendar-scroll-left, calendar-scroll-right):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82148
diff
changeset
|
174 last-nonmenu-event)) |
0d322d300115
(calendar-scroll-left, calendar-scroll-right):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
82148
diff
changeset
|
175 (calendar-scroll-left (- (or arg 1)) event)) |
13053 | 176 |
92916
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
177 (define-obsolete-function-alias |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
178 'scroll-calendar-right 'calendar-scroll-right "23.1") |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
179 |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
180 ;;;###cal-autoload |
82148
d979cb10446a
(calendar-scroll-left, calendar-scroll-right, calendar-scroll-left-three-months)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78216
diff
changeset
|
181 (defun calendar-scroll-left-three-months (arg) |
13053 | 182 "Scroll the displayed calendar window left by 3*ARG months. |
183 If ARG is negative the calendar is scrolled right. Maintains the relative | |
184 position of the cursor with respect to the calendar as well as possible." | |
185 (interactive "p") | |
82148
d979cb10446a
(calendar-scroll-left, calendar-scroll-right, calendar-scroll-left-three-months)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78216
diff
changeset
|
186 (calendar-scroll-left (* 3 arg))) |
13053 | 187 |
92916
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
188 (define-obsolete-function-alias 'scroll-calendar-left-three-months |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
189 'calendar-scroll-left-three-months "23.1") |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
190 |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
191 ;;;###cal-autoload |
82148
d979cb10446a
(calendar-scroll-left, calendar-scroll-right, calendar-scroll-left-three-months)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78216
diff
changeset
|
192 (defun calendar-scroll-right-three-months (arg) |
13053 | 193 "Scroll the displayed calendar window right by 3*ARG months. |
194 If ARG is negative the calendar is scrolled left. Maintains the relative | |
195 position of the cursor with respect to the calendar as well as possible." | |
196 (interactive "p") | |
82148
d979cb10446a
(calendar-scroll-left, calendar-scroll-right, calendar-scroll-left-three-months)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78216
diff
changeset
|
197 (calendar-scroll-left (* -3 arg))) |
13053 | 198 |
92916
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
199 (define-obsolete-function-alias 'scroll-calendar-right-three-months |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
200 'calendar-scroll-right-three-months "23.1") |
13053 | 201 |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
202 ;;;###cal-autoload |
13053 | 203 (defun calendar-forward-day (arg) |
204 "Move the cursor forward ARG days. | |
205 Moves backward if ARG is negative." | |
206 (interactive "p") | |
92916
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
207 (unless (zerop arg) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
208 (let* ((cursor-date (or (calendar-cursor-to-date) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
209 (progn |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
210 (if (> arg 0) (setq arg (1- arg))) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
211 (calendar-cursor-to-nearest-date)))) |
13053 | 212 (new-cursor-date |
213 (calendar-gregorian-from-absolute | |
214 (+ (calendar-absolute-from-gregorian cursor-date) arg))) | |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
215 (new-display-month (calendar-extract-month new-cursor-date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
216 (new-display-year (calendar-extract-year new-cursor-date))) |
92916
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
217 ;; Put the new month on the screen, if needed, and go to the new date. |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
218 (if (not (calendar-date-is-visible-p new-cursor-date)) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
219 (calendar-other-month new-display-month new-display-year)) |
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
220 (calendar-cursor-to-visible-date new-cursor-date))) |
25411
0d68ae69cd8c
Call the new hook in every movement function.
Richard M. Stallman <rms@gnu.org>
parents:
24337
diff
changeset
|
221 (run-hooks 'calendar-move-hook)) |
13053 | 222 |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
223 ;;;###cal-autoload |
13053 | 224 (defun calendar-backward-day (arg) |
225 "Move the cursor back ARG days. | |
226 Moves forward if ARG is negative." | |
227 (interactive "p") | |
228 (calendar-forward-day (- arg))) | |
229 | |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
230 ;;;###cal-autoload |
13053 | 231 (defun calendar-forward-week (arg) |
232 "Move the cursor forward ARG weeks. | |
233 Moves backward if ARG is negative." | |
234 (interactive "p") | |
235 (calendar-forward-day (* arg 7))) | |
236 | |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
237 ;;;###cal-autoload |
13053 | 238 (defun calendar-backward-week (arg) |
239 "Move the cursor back ARG weeks. | |
240 Moves forward if ARG is negative." | |
241 (interactive "p") | |
242 (calendar-forward-day (* arg -7))) | |
243 | |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
244 ;;;###cal-autoload |
13053 | 245 (defun calendar-beginning-of-week (arg) |
246 "Move the cursor back ARG calendar-week-start-day's." | |
247 (interactive "p") | |
248 (calendar-cursor-to-nearest-date) | |
249 (let ((day (calendar-day-of-week (calendar-cursor-to-date)))) | |
250 (calendar-backward-day | |
251 (if (= day calendar-week-start-day) | |
252 (* 7 arg) | |
253 (+ (mod (- day calendar-week-start-day) 7) | |
254 (* 7 (1- arg))))))) | |
255 | |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
256 ;;;###cal-autoload |
13053 | 257 (defun calendar-end-of-week (arg) |
258 "Move the cursor forward ARG calendar-week-start-day+6's." | |
259 (interactive "p") | |
260 (calendar-cursor-to-nearest-date) | |
261 (let ((day (calendar-day-of-week (calendar-cursor-to-date)))) | |
262 (calendar-forward-day | |
263 (if (= day (mod (1- calendar-week-start-day) 7)) | |
264 (* 7 arg) | |
265 (+ (- 6 (mod (- day calendar-week-start-day) 7)) | |
266 (* 7 (1- arg))))))) | |
267 | |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
268 ;;;###cal-autoload |
13053 | 269 (defun calendar-beginning-of-month (arg) |
270 "Move the cursor backward ARG month beginnings." | |
271 (interactive "p") | |
272 (calendar-cursor-to-nearest-date) | |
273 (let* ((date (calendar-cursor-to-date)) | |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
274 (month (calendar-extract-month date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
275 (day (calendar-extract-day date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
276 (year (calendar-extract-year date))) |
13053 | 277 (if (= day 1) |
278 (calendar-backward-month arg) | |
279 (calendar-cursor-to-visible-date (list month 1 year)) | |
280 (calendar-backward-month (1- arg))))) | |
281 | |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
282 ;;;###cal-autoload |
13053 | 283 (defun calendar-end-of-month (arg) |
284 "Move the cursor forward ARG month ends." | |
285 (interactive "p") | |
286 (calendar-cursor-to-nearest-date) | |
287 (let* ((date (calendar-cursor-to-date)) | |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
288 (month (calendar-extract-month date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
289 (day (calendar-extract-day date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
290 (year (calendar-extract-year date)) |
93486
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
291 (last-day (calendar-last-day-of-month month year)) |
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
292 (last-day (progn |
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
293 (unless (= day last-day) |
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
294 (calendar-cursor-to-visible-date |
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
295 (list month last-day year)) |
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
296 (setq arg (1- arg))) |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
297 (calendar-increment-month month year arg) |
93486
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
298 (list month |
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
299 (calendar-last-day-of-month month year) |
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
300 year)))) |
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
301 (if (not (calendar-date-is-visible-p last-day)) |
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
302 (calendar-other-month month year) |
b9615f927009
(Commentary): Point to calendar.el.
Glenn Morris <rgm@gnu.org>
parents:
93329
diff
changeset
|
303 (calendar-cursor-to-visible-date last-day))) |
25411
0d68ae69cd8c
Call the new hook in every movement function.
Richard M. Stallman <rms@gnu.org>
parents:
24337
diff
changeset
|
304 (run-hooks 'calendar-move-hook)) |
13053 | 305 |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
306 ;;;###cal-autoload |
13053 | 307 (defun calendar-beginning-of-year (arg) |
308 "Move the cursor backward ARG year beginnings." | |
309 (interactive "p") | |
310 (calendar-cursor-to-nearest-date) | |
311 (let* ((date (calendar-cursor-to-date)) | |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
312 (month (calendar-extract-month date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
313 (day (calendar-extract-day date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
314 (year (calendar-extract-year date)) |
25411
0d68ae69cd8c
Call the new hook in every movement function.
Richard M. Stallman <rms@gnu.org>
parents:
24337
diff
changeset
|
315 (jan-first (list 1 1 year)) |
0d68ae69cd8c
Call the new hook in every movement function.
Richard M. Stallman <rms@gnu.org>
parents:
24337
diff
changeset
|
316 (calendar-move-hook nil)) |
13053 | 317 (if (and (= day 1) (= 1 month)) |
318 (calendar-backward-month (* 12 arg)) | |
319 (if (and (= arg 1) | |
320 (calendar-date-is-visible-p jan-first)) | |
321 (calendar-cursor-to-visible-date jan-first) | |
60981
669da3d2cff9
Update copyright and maintainer.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
322 (calendar-other-month 1 (- year (1- arg))) |
669da3d2cff9
Update copyright and maintainer.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
323 (calendar-cursor-to-visible-date (list 1 1 displayed-year))))) |
25411
0d68ae69cd8c
Call the new hook in every movement function.
Richard M. Stallman <rms@gnu.org>
parents:
24337
diff
changeset
|
324 (run-hooks 'calendar-move-hook)) |
13053 | 325 |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
326 ;;;###cal-autoload |
13053 | 327 (defun calendar-end-of-year (arg) |
328 "Move the cursor forward ARG year beginnings." | |
329 (interactive "p") | |
330 (calendar-cursor-to-nearest-date) | |
331 (let* ((date (calendar-cursor-to-date)) | |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
332 (month (calendar-extract-month date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
333 (day (calendar-extract-day date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
334 (year (calendar-extract-year date)) |
25411
0d68ae69cd8c
Call the new hook in every movement function.
Richard M. Stallman <rms@gnu.org>
parents:
24337
diff
changeset
|
335 (dec-31 (list 12 31 year)) |
0d68ae69cd8c
Call the new hook in every movement function.
Richard M. Stallman <rms@gnu.org>
parents:
24337
diff
changeset
|
336 (calendar-move-hook nil)) |
13053 | 337 (if (and (= day 31) (= 12 month)) |
338 (calendar-forward-month (* 12 arg)) | |
339 (if (and (= arg 1) | |
340 (calendar-date-is-visible-p dec-31)) | |
341 (calendar-cursor-to-visible-date dec-31) | |
60981
669da3d2cff9
Update copyright and maintainer.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
342 (calendar-other-month 12 (+ year (1- arg))) |
25411
0d68ae69cd8c
Call the new hook in every movement function.
Richard M. Stallman <rms@gnu.org>
parents:
24337
diff
changeset
|
343 (calendar-cursor-to-visible-date (list 12 31 displayed-year))))) |
0d68ae69cd8c
Call the new hook in every movement function.
Richard M. Stallman <rms@gnu.org>
parents:
24337
diff
changeset
|
344 (run-hooks 'calendar-move-hook)) |
13053 | 345 |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
346 ;;;###cal-autoload |
13053 | 347 (defun calendar-goto-date (date) |
348 "Move cursor to DATE." | |
349 (interactive (list (calendar-read-date))) | |
93809
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
350 (let ((month (calendar-extract-month date)) |
3ff2b47de8f2
Update for calendar.el name changes.
Glenn Morris <rgm@gnu.org>
parents:
93486
diff
changeset
|
351 (year (calendar-extract-year date))) |
13053 | 352 (if (not (calendar-date-is-visible-p date)) |
353 (calendar-other-month | |
354 (if (and (= month 1) (= year 1)) | |
355 2 | |
356 month) | |
357 year))) | |
25411
0d68ae69cd8c
Call the new hook in every movement function.
Richard M. Stallman <rms@gnu.org>
parents:
24337
diff
changeset
|
358 (calendar-cursor-to-visible-date date) |
0d68ae69cd8c
Call the new hook in every movement function.
Richard M. Stallman <rms@gnu.org>
parents:
24337
diff
changeset
|
359 (run-hooks 'calendar-move-hook)) |
13053 | 360 |
92836
e4347538b00b
(generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents:
92634
diff
changeset
|
361 ;;;###cal-autoload |
52231
9529ff0804c2
Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents:
52112
diff
changeset
|
362 (defun calendar-goto-day-of-year (year day &optional noecho) |
92916
f296fd96bd7c
(calendar-cursor-to-nearest-date): Use or, when. Move definition before use.
Glenn Morris <rgm@gnu.org>
parents:
92855
diff
changeset
|
363 "Move cursor to YEAR, DAY number; echo DAY/YEAR unless NOECHO is non-nil. |
52231
9529ff0804c2
Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents:
52112
diff
changeset
|
364 Negative DAY counts backward from end of year." |
9529ff0804c2
Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents:
52112
diff
changeset
|
365 (interactive |
9529ff0804c2
Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents:
52112
diff
changeset
|
366 (let* ((year (calendar-read |
9529ff0804c2
Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents:
52112
diff
changeset
|
367 "Year (>0): " |
9529ff0804c2
Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents:
52112
diff
changeset
|
368 (lambda (x) (> x 0)) |
93844
bf9ef749c23e
Replace int-to-string with number-to-string.
Glenn Morris <rgm@gnu.org>
parents:
93809
diff
changeset
|
369 (number-to-string (calendar-extract-year |
52231
9529ff0804c2
Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents:
52112
diff
changeset
|
370 (calendar-current-date))))) |
9529ff0804c2
Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents:
52112
diff
changeset
|
371 (last (if (calendar-leap-year-p year) 366 365)) |
9529ff0804c2
Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents:
52112
diff
changeset
|
372 (day (calendar-read |
9529ff0804c2
Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents:
52112
diff
changeset
|
373 (format "Day number (+/- 1-%d): " last) |
92590
8ef3d5355402
Unquote lambda functions. Add autoload cookies to functions formerly
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
374 (lambda (x) (and (<= 1 (abs x)) (<= (abs x) last)))))) |
52231
9529ff0804c2
Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents:
52112
diff
changeset
|
375 (list year day))) |
9529ff0804c2
Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents:
52112
diff
changeset
|
376 (calendar-goto-date |
9529ff0804c2
Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents:
52112
diff
changeset
|
377 (calendar-gregorian-from-absolute |
9529ff0804c2
Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents:
52112
diff
changeset
|
378 (if (< 0 day) |
9529ff0804c2
Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents:
52112
diff
changeset
|
379 (+ -1 day (calendar-absolute-from-gregorian (list 1 1 year))) |
9529ff0804c2
Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents:
52112
diff
changeset
|
380 (+ 1 day (calendar-absolute-from-gregorian (list 12 31 year)))))) |
9529ff0804c2
Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents:
52112
diff
changeset
|
381 (or noecho (calendar-print-day-of-year))) |
9529ff0804c2
Edward M. Reingold <reingold@emr.cs.iit.edu>
Glenn Morris <rgm@gnu.org>
parents:
52112
diff
changeset
|
382 |
13053 | 383 (provide 'cal-move) |
384 | |
82148
d979cb10446a
(calendar-scroll-left, calendar-scroll-right, calendar-scroll-left-three-months)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78216
diff
changeset
|
385 ;; arch-tag: d0883c46-7e16-4914-8ff8-8f67e699b781 |
13053 | 386 ;;; cal-move.el ends here |