Function: calendar-goto-day-of-year

calendar-goto-day-of-year is an autoloaded, interactive and byte-compiled function defined in cal-move.el.gz.

Signature

(calendar-goto-day-of-year YEAR DAY &optional NOECHO)

Documentation

Move cursor to YEAR, DAY number; echo DAY/YEAR unless NOECHO is non-nil.

Negative DAY counts backward from end of year.

Probably introduced at or before Emacs version 22.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/cal-move.el.gz
;;;###cal-autoload
(defun calendar-goto-day-of-year (year day &optional noecho)
  "Move cursor to YEAR, DAY number; echo DAY/YEAR unless NOECHO is non-nil.
Negative DAY counts backward from end of year."
  (interactive
   (let* ((year (calendar-read-sexp
                 "Year (>0)"
                 (lambda (x) (> x 0))
                 (calendar-extract-year (calendar-current-date))))
          (last (if (calendar-leap-year-p year) 366 365))
          (day (calendar-read-sexp
                "Day number (+/- 1-%d)"
                (lambda (x) (and (<= 1 (abs x)) (<= (abs x) last)))
                nil
                last)))
     (list year day)))
  (calendar-goto-date
   (calendar-gregorian-from-absolute
    (if (< 0 day)
        (+ -1 day (calendar-absolute-from-gregorian (list 1 1 year)))
      (+ 1 day (calendar-absolute-from-gregorian (list 12 31 year))))))
  (or noecho (calendar-print-day-of-year)))