327 |
(calendar-cursor-to-visible-date date) |
(calendar-cursor-to-visible-date date) |
328 |
(run-hooks 'calendar-move-hook)) |
(run-hooks 'calendar-move-hook)) |
329 |
|
|
330 |
|
(defun calendar-goto-day-of-year (year day &optional noecho) |
331 |
|
"Move cursor to YEAR, DAY number; echo DAY/YEAR unless NOECHO is t. |
332 |
|
Negative DAY counts backward from end of year." |
333 |
|
(interactive |
334 |
|
(let* ((year (calendar-read |
335 |
|
"Year (>0): " |
336 |
|
(lambda (x) (> x 0)) |
337 |
|
(int-to-string (extract-calendar-year |
338 |
|
(calendar-current-date))))) |
339 |
|
(last (if (calendar-leap-year-p year) 366 365)) |
340 |
|
(day (calendar-read |
341 |
|
(format "Day number (+/- 1-%d): " last) |
342 |
|
'(lambda (x) (and (<= 1 (abs x)) (<= (abs x) last)))))) |
343 |
|
(list year day))) |
344 |
|
(calendar-goto-date |
345 |
|
(calendar-gregorian-from-absolute |
346 |
|
(if (< 0 day) |
347 |
|
(+ -1 day (calendar-absolute-from-gregorian (list 1 1 year))) |
348 |
|
(+ 1 day (calendar-absolute-from-gregorian (list 12 31 year)))))) |
349 |
|
(or noecho (calendar-print-day-of-year))) |
350 |
|
|
351 |
(provide 'cal-move) |
(provide 'cal-move) |
352 |
|
|
353 |
;;; cal-move.el ends here |
;;; cal-move.el ends here |