164 |
:group 'diary) |
:group 'diary) |
165 |
|
|
166 |
;;;###autoload |
;;;###autoload |
|
(defcustom number-of-diary-entries 1 |
|
|
"*Specifies how many days of diary entries are to be displayed initially. |
|
|
This variable affects the diary display when the command \\[diary] is used, |
|
|
or if the value of the variable `view-diary-entries-initially' is t. For |
|
|
example, if the default value 1 is used, then only the current day's diary |
|
|
entries will be displayed. If the value 2 is used, then both the current |
|
|
day's and the next day's entries will be displayed. |
|
|
|
|
|
The value can also be a vector such as [0 2 2 2 2 4 1]; this value |
|
|
says to display no diary entries on Sunday, the display the entries |
|
|
for the current date and the day after on Monday through Thursday, |
|
|
display Friday through Monday's entries on Friday, and display only |
|
|
Saturday's entries on Saturday. |
|
|
|
|
|
This variable does not affect the diary display with the `d' command |
|
|
from the calendar; in that case, the prefix argument controls the |
|
|
number of days of diary entries displayed." |
|
|
:type '(choice (integer :tag "Entries") |
|
|
(vector :value [0 0 0 0 0 0 0] |
|
|
(integer :tag "Sunday") |
|
|
(integer :tag "Monday") |
|
|
(integer :tag "Tuesday") |
|
|
(integer :tag "Wednesday") |
|
|
(integer :tag "Thursday") |
|
|
(integer :tag "Friday") |
|
|
(integer :tag "Saturday"))) |
|
|
:group 'diary) |
|
|
|
|
|
;;;###autoload |
|
167 |
(defcustom mark-diary-entries-in-calendar nil |
(defcustom mark-diary-entries-in-calendar nil |
168 |
"*Non-nil means mark dates with diary entries, in the calendar window. |
"*Non-nil means mark dates with diary entries, in the calendar window. |
169 |
The marking symbol is specified by the variable `diary-entry-marker'." |
The marking symbol is specified by the variable `diary-entry-marker'." |
364 |
|
|
365 |
For example, |
For example, |
366 |
|
|
367 |
(add-hook 'calendar-move-hook (lambda () (view-diary-entries 1))) |
(add-hook 'calendar-move-hook (lambda () (diary-view-entries 1))) |
368 |
|
|
369 |
redisplays the diary for whatever date the cursor is moved to." |
redisplays the diary for whatever date the cursor is moved to." |
370 |
:type 'hook |
:type 'hook |
1306 |
|
|
1307 |
(defmacro calendar-for-loop (var from init to final do &rest body) |
(defmacro calendar-for-loop (var from init to final do &rest body) |
1308 |
"Execute a for loop." |
"Execute a for loop." |
1309 |
|
(declare (debug (symbolp "from" form "to" form "do" body))) |
1310 |
`(let ((,var (1- ,init))) |
`(let ((,var (1- ,init))) |
1311 |
(while (>= ,final (setq ,var (1+ ,var))) |
(while (>= ,final (setq ,var (1+ ,var))) |
1312 |
,@body))) |
,@body))) |
1623 |
(increment-calendar-month month year (- calendar-offset)) |
(increment-calendar-month month year (- calendar-offset)) |
1624 |
(generate-calendar-window month year) |
(generate-calendar-window month year) |
1625 |
(if (and view-diary-entries-initially (calendar-date-is-visible-p date)) |
(if (and view-diary-entries-initially (calendar-date-is-visible-p date)) |
1626 |
(view-diary-entries |
(diary-view-entries))) |
|
(if (vectorp number-of-diary-entries) |
|
|
(aref number-of-diary-entries (calendar-day-of-week date)) |
|
|
number-of-diary-entries)))) |
|
1627 |
(let* ((diary-buffer (get-file-buffer diary-file)) |
(let* ((diary-buffer (get-file-buffer diary-file)) |
1628 |
(diary-window (if diary-buffer (get-buffer-window diary-buffer))) |
(diary-window (if diary-buffer (get-buffer-window diary-buffer))) |
1629 |
(split-height-threshold (if diary-window 2 1000))) |
(split-height-threshold (if diary-window 2 1000))) |
1631 |
(list-calendar-holidays))) |
(list-calendar-holidays))) |
1632 |
(run-hooks 'initial-calendar-window-hook)) |
(run-hooks 'initial-calendar-window-hook)) |
1633 |
|
|
1634 |
(autoload 'view-diary-entries "diary-lib" |
(autoload 'diary-view-entries "diary-lib" |
1635 |
"Prepare and display a buffer with diary entries. |
"Prepare and display a buffer with diary entries. |
1636 |
Searches your diary file for entries that match ARG days starting with |
Searches your diary file for entries that match ARG days starting with |
1637 |
the date indicated by the cursor position in the displayed three-month |
the date indicated by the cursor position in the displayed three-month |
2241 |
(define-key calendar-mode-map "x" 'mark-calendar-holidays) |
(define-key calendar-mode-map "x" 'mark-calendar-holidays) |
2242 |
(define-key calendar-mode-map "u" 'calendar-unmark) |
(define-key calendar-mode-map "u" 'calendar-unmark) |
2243 |
(define-key calendar-mode-map "m" 'mark-diary-entries) |
(define-key calendar-mode-map "m" 'mark-diary-entries) |
2244 |
(define-key calendar-mode-map "d" 'view-diary-entries) |
(define-key calendar-mode-map "d" 'diary-view-entries) |
2245 |
(define-key calendar-mode-map "D" 'view-other-diary-entries) |
(define-key calendar-mode-map "D" 'view-other-diary-entries) |
2246 |
(define-key calendar-mode-map "s" 'show-all-diary-entries) |
(define-key calendar-mode-map "s" 'show-all-diary-entries) |
2247 |
(define-key calendar-mode-map "pd" 'calendar-print-day-of-year) |
(define-key calendar-mode-map "pd" 'calendar-print-day-of-year) |
2462 |
(defun update-calendar-mode-line () |
(defun update-calendar-mode-line () |
2463 |
"Update the calendar mode line with the current date and date style." |
"Update the calendar mode line with the current date and date style." |
2464 |
(if (bufferp (get-buffer calendar-buffer)) |
(if (bufferp (get-buffer calendar-buffer)) |
2465 |
(save-excursion |
(with-current-buffer calendar-buffer |
|
(set-buffer calendar-buffer) |
|
2466 |
(setq mode-line-format |
(setq mode-line-format |
2467 |
(calendar-string-spread |
(calendar-string-spread |
2468 |
(let ((date (condition-case nil |
(let ((date (condition-case nil |
2557 |
(list month |
(list month |
2558 |
(string-to-number (buffer-substring (1+ (point)) (+ 4 (point)))) |
(string-to-number (buffer-substring (1+ (point)) (+ 4 (point)))) |
2559 |
year)) |
year)) |
2560 |
(if (looking-at "\\*") |
(if (and (looking-at "\\*") |
2561 |
(save-excursion |
(save-excursion |
2562 |
(re-search-backward "[^*]") |
(re-search-backward "[^*]") |
2563 |
(if (looking-at ".\\*\\*") |
(looking-at ".\\*\\*"))) |
2564 |
(list month calendar-starred-day year) |
(list month calendar-starred-day year) |
|
(if error (error "Not on a date!")))) |
|
2565 |
(if error (error "Not on a date!")))))) |
(if error (error "Not on a date!")))))) |
2566 |
|
|
2567 |
|
(add-to-list 'debug-ignored-errors "Not on a date!") |
2568 |
|
|
2569 |
;; The following version of calendar-gregorian-from-absolute is preferred for |
;; The following version of calendar-gregorian-from-absolute is preferred for |
2570 |
;; reasons of clarity, BUT it's much slower than the version that follows it. |
;; reasons of clarity, BUT it's much slower than the version that follows it. |
2571 |
|
|
3040 |
"Show dates on other calendars for date under the cursor." |
"Show dates on other calendars for date under the cursor." |
3041 |
(interactive) |
(interactive) |
3042 |
(let* ((date (calendar-cursor-to-date t))) |
(let* ((date (calendar-cursor-to-date t))) |
3043 |
(save-excursion |
(with-current-buffer (get-buffer-create other-calendars-buffer) |
|
(set-buffer (get-buffer-create other-calendars-buffer)) |
|
3044 |
(setq buffer-read-only nil) |
(setq buffer-read-only nil) |
3045 |
(calendar-set-mode-line |
(calendar-set-mode-line |
3046 |
(concat (calendar-date-string date) " (Gregorian)")) |
(concat (calendar-date-string date) " (Gregorian)")) |
3106 |
|
|
3107 |
(provide 'calendar) |
(provide 'calendar) |
3108 |
|
|
3109 |
;;; Local variables: |
;; Local variables: |
3110 |
;;; byte-compile-dynamic: t |
;; byte-compile-dynamic: t |
3111 |
;;; End: |
;; End: |
3112 |
|
|
3113 |
;;; arch-tag: 19c61596-c8fb-4c69-bcf1-7dd739919cd8 |
;; arch-tag: 19c61596-c8fb-4c69-bcf1-7dd739919cd8 |
3114 |
;;; calendar.el ends here |
;;; calendar.el ends here |