[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/calendar/cal-move.el,v
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/calendar/cal-move.el,v |
Date: |
Sat, 21 Jun 2008 19:28:42 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Glenn Morris <gm> 08/06/21 19:28:42
Index: cal-move.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/calendar/cal-move.el,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- cal-move.el 6 May 2008 03:07:56 -0000 1.31
+++ cal-move.el 21 Jun 2008 19:28:42 -0000 1.32
@@ -29,6 +29,7 @@
;;; Code:
+;; FIXME should calendar just require this?
(require 'calendar)
;;;###cal-autoload
@@ -38,20 +39,21 @@
Returns the list (month day year) giving the cursor position."
(or (calendar-cursor-to-date)
(let ((column (current-column)))
- (when (> 3 (count-lines (point-min) (point)))
- (goto-line 3)
+ (when (> calendar-first-date-row (count-lines (point-min) (point)))
+ (goto-line calendar-first-date-row)
(move-to-column column))
- (if (not (looking-at "[0-9]"))
- (if (and (not (looking-at " *$"))
- (or (< column 25)
- (and (> column 27)
- (< column 50))
- (and (> column 52)
- (< column 75))))
- (progn
+ ;; FIXME the date positions are fixed and computable,
+ ;; but searching is probably more flexible.
+ ;; Note also that this may not be the "nearest" date.
+ ;; Eg with cursor just after end of month, can skip to next month.
+ (or (looking-at "[0-9]")
+ ;; We search forwards for a number, except close to the RH
+ ;; margin of a month, where we search backwards.
+ (if (or (looking-at " *$")
+ (< (calendar-column-to-month) 0))
+ (re-search-backward "[0-9]" nil t)
(re-search-forward "[0-9]" nil t)
- (backward-char 1))
- (re-search-backward "[0-9]" nil t)))
+ (backward-char 1)))
(calendar-cursor-to-date))))
(defvar displayed-month) ; from calendar-generate
@@ -63,18 +65,19 @@
(let ((month (calendar-extract-month date))
(day (calendar-extract-day date))
(year (calendar-extract-year date)))
- (goto-line (+ 3
+ (goto-line (+ calendar-first-date-row
(/ (+ day -1
(mod
(- (calendar-day-of-week (list month 1 year))
calendar-week-start-day)
7))
7)))
- (move-to-column (+ 6
- (* 25
+ (move-to-column (+ calendar-left-margin (1- calendar-day-digit-width)
+ (* calendar-month-width
(1+ (calendar-interval
displayed-month displayed-year month year)))
- (* 3 (mod
+ (* calendar-column-width
+ (mod
(- (calendar-day-of-week date)
calendar-week-start-day)
7))))))
@@ -213,9 +216,13 @@
(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, and go to the new date.
- (if (not (calendar-date-is-visible-p new-cursor-date))
- (calendar-other-month new-display-month new-display-year))
- (calendar-cursor-to-visible-date new-cursor-date)))
+ (if (calendar-date-is-visible-p new-cursor-date)
+ (calendar-cursor-to-visible-date 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))))
(run-hooks 'calendar-move-hook))
;;;###cal-autoload
- [Emacs-diffs] Changes to emacs/lisp/calendar/cal-move.el,v,
Glenn Morris <=