summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2008-04-01 02:43:05 +0000
committerGlenn Morris <rgm@gnu.org>2008-04-01 02:43:05 +0000
commitb36e906dd003adfb10e0c07cde2e8ba3a282b632 (patch)
tree4a264db2081b76e9b4496af4c61e2e4c76c3a71b /lisp
parent714b503452afa994e423b1f42ff7362c606df377 (diff)
downloademacs-b36e906dd003adfb10e0c07cde2e8ba3a282b632.tar.gz
emacs-b36e906dd003adfb10e0c07cde2e8ba3a282b632.tar.bz2
emacs-b36e906dd003adfb10e0c07cde2e8ba3a282b632.zip
(Commentary): Point to calendar.el.
(calendar-forward-month, calendar-end-of-month): Reduce nesting of some lets.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/calendar/cal-move.el48
1 files changed, 24 insertions, 24 deletions
diff --git a/lisp/calendar/cal-move.el b/lisp/calendar/cal-move.el
index 8c43c1a47fe..77edd16e219 100644
--- a/lisp/calendar/cal-move.el
+++ b/lisp/calendar/cal-move.el
@@ -27,8 +27,7 @@
;;; Commentary:
-;; This collection of functions implements movement in the calendar for
-;; calendar.el.
+;; See calendar.el.
;;; Code:
@@ -102,16 +101,16 @@ Movement is backward if ARG is negative."
(let* ((cursor-date (calendar-cursor-to-date t))
(month (extract-calendar-month cursor-date))
(day (extract-calendar-day cursor-date))
- (year (extract-calendar-year cursor-date)))
- (increment-calendar-month month year arg)
- (let ((last (calendar-last-day-of-month month year)))
- (if (< last day)
- (setq day last)))
- ;; Put the new month on the screen, if needed, and go to the new date.
- (let ((new-cursor-date (list month day year)))
- (if (not (calendar-date-is-visible-p new-cursor-date))
- (calendar-other-month month year))
- (calendar-cursor-to-visible-date new-cursor-date)))
+ (year (extract-calendar-year cursor-date))
+ (last (progn
+ (increment-calendar-month month year arg)
+ (calendar-last-day-of-month month year)))
+ (day (min last day))
+ ;; Put the new month on the screen, if needed, and go to the new date.
+ (new-cursor-date (list month day year)))
+ (if (not (calendar-date-is-visible-p new-cursor-date))
+ (calendar-other-month month year))
+ (calendar-cursor-to-visible-date new-cursor-date))
(run-hooks 'calendar-move-hook))
;;;###cal-autoload
@@ -288,18 +287,19 @@ Moves forward if ARG is negative."
(month (extract-calendar-month date))
(day (extract-calendar-day date))
(year (extract-calendar-year date))
- (last-day (calendar-last-day-of-month month year)))
- (unless (= day last-day)
- (calendar-cursor-to-visible-date (list month last-day year))
- (setq arg (1- arg)))
- (increment-calendar-month month year arg)
- (let ((last-day (list
- month
- (calendar-last-day-of-month month year)
- year)))
- (if (not (calendar-date-is-visible-p last-day))
- (calendar-other-month month year)
- (calendar-cursor-to-visible-date last-day))))
+ (last-day (calendar-last-day-of-month month year))
+ (last-day (progn
+ (unless (= day last-day)
+ (calendar-cursor-to-visible-date
+ (list month last-day year))
+ (setq arg (1- arg)))
+ (increment-calendar-month month year arg)
+ (list month
+ (calendar-last-day-of-month month year)
+ year))))
+ (if (not (calendar-date-is-visible-p last-day))
+ (calendar-other-month month year)
+ (calendar-cursor-to-visible-date last-day)))
(run-hooks 'calendar-move-hook))
;;;###cal-autoload