Function: calendar-forward-day

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

Signature

(calendar-forward-day ARG)

Documentation

Move the cursor forward ARG days.

Moves backward if ARG is negative.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/cal-move.el.gz
;;;###cal-autoload
(defun calendar-forward-day (arg)
  "Move the cursor forward ARG days.
Moves backward if ARG is negative."
  (interactive "p")
  (unless (zerop arg)
    (let* ((cursor-date (or (calendar-cursor-to-date)
                            (progn
                              (if (> arg 0) (setq arg (1- arg)))
                              (calendar-cursor-to-nearest-date))))
           (new-cursor-date
            (calendar-gregorian-from-absolute
             (+ (calendar-absolute-from-gregorian cursor-date) arg)))
           (new-display-month (calendar-extract-month new-cursor-date))
           (new-display-year (calendar-extract-year new-cursor-date)))
      ;; Put the new month on the screen, if needed.
      (unless (calendar-date-is-visible-p new-cursor-date)
        ;; The next line gives smoother scrolling IMO (one month at a
        ;; time rather than two).
        (calendar-increment-month new-display-month new-display-year
                                  (if (< arg 0) 1 -1))
        (calendar-other-month new-display-month new-display-year))
      ;; Go to the new date.
      (calendar-cursor-to-visible-date new-cursor-date)))
  (run-hooks 'calendar-move-hook))