diff options
| author | Glenn Morris | 2003-08-17 22:49:46 +0000 |
|---|---|---|
| committer | Glenn Morris | 2003-08-17 22:49:46 +0000 |
| commit | 163fd24dfd910260ae15255c4eaada4ea4aabc23 (patch) | |
| tree | 284cee71a0515612087f9314bec8cca86b90608e | |
| parent | f9df0ca0420622ab4716bf712ffeecb81b860d70 (diff) | |
| download | emacs-163fd24dfd910260ae15255c4eaada4ea4aabc23.tar.gz emacs-163fd24dfd910260ae15255c4eaada4ea4aabc23.zip | |
Edward M. Reingold <reingold@emr.cs.iit.edu>
(calendar-goto-day-of-year): New function.
| -rw-r--r-- | lisp/calendar/cal-move.el | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lisp/calendar/cal-move.el b/lisp/calendar/cal-move.el index b711e226a0e..fed55d9e947 100644 --- a/lisp/calendar/cal-move.el +++ b/lisp/calendar/cal-move.el | |||
| @@ -327,6 +327,27 @@ Moves forward if ARG is negative." | |||
| 327 | (calendar-cursor-to-visible-date date) | 327 | (calendar-cursor-to-visible-date date) |
| 328 | (run-hooks 'calendar-move-hook)) | 328 | (run-hooks 'calendar-move-hook)) |
| 329 | 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 | |||
| 330 | (provide 'cal-move) | 351 | (provide 'cal-move) |
| 331 | 352 | ||
| 332 | ;;; cal-move.el ends here | 353 | ;;; cal-move.el ends here |