diff options
| author | Juanma Barranquero | 2003-02-11 23:23:10 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2003-02-11 23:23:10 +0000 |
| commit | d13c137897f5f1da4a06fe0bca8b46fa55bcb8e1 (patch) | |
| tree | 59e8846a9060ddc4d57a8e2d605bbceff03a1001 | |
| parent | 32fda8c95222e08c2569f01fa7fb88d920e0b8a7 (diff) | |
| download | emacs-d13c137897f5f1da4a06fe0bca8b46fa55bcb8e1.tar.gz emacs-d13c137897f5f1da4a06fe0bca8b46fa55bcb8e1.zip | |
(diary-face-attrs): New custom.
(diary-file-name-prefix-function): New custom.
(diary-glob-file-regexp-prefix): New custom.
(diary-file-name-prefix): New custom.
(generate-calendar-window): Check that font-lock-mode is bound before checking
value.
(mark-visible-calendar-date): Add the ability to pass face attribute/value pairs
in the mark argument. Handle the mark.
| -rw-r--r-- | lisp/calendar/calendar.el | 83 |
1 files changed, 72 insertions, 11 deletions
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 8de969df369..4e2705f102f 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el | |||
| @@ -310,6 +310,11 @@ calendar." | |||
| 310 | :type 'boolean | 310 | :type 'boolean |
| 311 | :group 'holidays) | 311 | :group 'holidays) |
| 312 | 312 | ||
| 313 | (defcustom diary-file-name-prefix-function (function (lambda (str) str)) | ||
| 314 | "*The function that will take a diary file name and return the desired prefix." | ||
| 315 | :type 'string | ||
| 316 | :group 'diary) | ||
| 317 | |||
| 313 | ;;;###autoload | 318 | ;;;###autoload |
| 314 | (defcustom calendar-load-hook nil | 319 | (defcustom calendar-load-hook nil |
| 315 | "*List of functions to be called after the calendar is first loaded. | 320 | "*List of functions to be called after the calendar is first loaded. |
| @@ -497,6 +502,36 @@ See the documentation for the function `include-other-diary-files'." | |||
| 497 | :type 'string | 502 | :type 'string |
| 498 | :group 'diary) | 503 | :group 'diary) |
| 499 | 504 | ||
| 505 | (defcustom diary-glob-file-regexp-prefix "^\\#" | ||
| 506 | "*The regular expression that gets pre-pended to each of the attribute-regexp's for file-wide specifiers." | ||
| 507 | :type 'regexp | ||
| 508 | :group 'diary) | ||
| 509 | |||
| 510 | (defcustom diary-face-attrs '( | ||
| 511 | (" *\\[foreground:\\([-a-z]+\\)\\]$" 1 :foreground string) | ||
| 512 | (" *\\[background:\\([-a-z]+\\)\\]$" 1 :background string) | ||
| 513 | (" *\\[width:\\([-a-z]+\\)\\]$" 1 :width symbol) | ||
| 514 | (" *\\[height:\\([-0-9a-z]+\\)\\]$" 1 :height int) | ||
| 515 | (" *\\[weight:\\([-a-z]+\\)\\]$" 1 :weight symbol) | ||
| 516 | (" *\\[slant:\\([-a-z]+\\)\\]$" 1 :slant symbol) | ||
| 517 | (" *\\[underline:\\([-a-z]+\\)\\]$" 1 :underline stringtnil) | ||
| 518 | (" *\\[overline:\\([-a-z]+\\)\\]$" 1 :overline stringtnil) | ||
| 519 | (" *\\[strike-through:\\([-a-z]+\\)\\]$" 1 :strike-through stringtnil) | ||
| 520 | (" *\\[inverse-video:\\([-a-z]+\\)\\]$" 1 :inverse-video tnil) | ||
| 521 | (" *\\[face:\\([-0-9a-z]+\\)\\]$" 1 :face string) | ||
| 522 | (" *\\[font:\\([-a-z0-9]+\\)\\]$" 1 :font string) | ||
| 523 | ;Unsupported (" *\\[box:\\([-a-z]+\\)\\]$" 1 :box) | ||
| 524 | ;Unsupported (" *\\[stipple:\\([-a-z]+\\)\\]$" 1 :stipple) | ||
| 525 | ) | ||
| 526 | "*A list of (regexp regnum attr attrtype) lists where the regexp says how to find the tag, the regnum says which parenthetical sub-regexp this regexp looks for, and the attr says which attribute of the face (or that this _is_ a face) is being modified." | ||
| 527 | :type 'sexp | ||
| 528 | :group 'diary) | ||
| 529 | |||
| 530 | (defcustom diary-file-name-prefix nil | ||
| 531 | "If non-nil then each entry in the diary list will be prefixed with the name of the file in which it was defined." | ||
| 532 | :type 'boolean | ||
| 533 | :group 'diary) | ||
| 534 | |||
| 500 | ;;;###autoload | 535 | ;;;###autoload |
| 501 | (defcustom sexp-diary-entry-symbol "%%" | 536 | (defcustom sexp-diary-entry-symbol "%%" |
| 502 | "*The string used to indicate a sexp diary entry in `diary-file'. | 537 | "*The string used to indicate a sexp diary entry in `diary-file'. |
| @@ -1816,7 +1851,8 @@ Or, for optional MON, YR." | |||
| 1816 | ;; Adjust the window to exactly fit the displayed calendar | 1851 | ;; Adjust the window to exactly fit the displayed calendar |
| 1817 | (fit-window-to-buffer)) | 1852 | (fit-window-to-buffer)) |
| 1818 | (sit-for 0) | 1853 | (sit-for 0) |
| 1819 | (if font-lock-mode | 1854 | (if (and (boundp 'font-lock-mode) |
| 1855 | font-lock-mode) | ||
| 1820 | (font-lock-fontify-buffer)) | 1856 | (font-lock-fontify-buffer)) |
| 1821 | (and mark-holidays-in-calendar | 1857 | (and mark-holidays-in-calendar |
| 1822 | (mark-calendar-holidays) | 1858 | (mark-calendar-holidays) |
| @@ -2556,21 +2592,46 @@ If WIDTH is non-nil, return just the first WIDTH characters of the name." | |||
| 2556 | 2592 | ||
| 2557 | (defun mark-visible-calendar-date (date &optional mark) | 2593 | (defun mark-visible-calendar-date (date &optional mark) |
| 2558 | "Mark DATE in the calendar window with MARK. | 2594 | "Mark DATE in the calendar window with MARK. |
| 2559 | MARK is either a single-character string or a face. | 2595 | MARK is a single-character string, a list of face attributes/values, or a face. |
| 2560 | MARK defaults to `diary-entry-marker'." | 2596 | MARK defaults to `diary-entry-marker'." |
| 2561 | (if (calendar-date-is-legal-p date) | 2597 | (if (calendar-date-is-legal-p date) |
| 2562 | (save-excursion | 2598 | (save-excursion |
| 2563 | (set-buffer calendar-buffer) | 2599 | (set-buffer calendar-buffer) |
| 2564 | (calendar-cursor-to-visible-date date) | 2600 | (calendar-cursor-to-visible-date date) |
| 2565 | (let ((mark (or mark diary-entry-marker))) | 2601 | (let ((mark (or (and (stringp mark) (= (length mark) 1) mark) ; single-char |
| 2566 | (if (stringp mark) | 2602 | (and (listp mark) (> (length mark) 0) mark) ; attr list |
| 2567 | (let ((buffer-read-only nil)) | 2603 | (and (facep mark) mark) ; face-name |
| 2568 | (forward-char 1) | 2604 | diary-entry-marker))) |
| 2569 | (delete-char 1) | 2605 | (if (facep mark) |
| 2570 | (insert mark) | 2606 | (progn ; face or an attr-list that contained a face |
| 2571 | (forward-char -2)) | 2607 | (overlay-put |
| 2572 | (overlay-put | 2608 | (make-overlay (1- (point)) (1+ (point))) 'face mark)) |
| 2573 | (make-overlay (1- (point)) (1+ (point))) 'face mark)))))) | 2609 | (if (and (stringp mark) |
| 2610 | (= (length mark) 1)) ; single-char | ||
| 2611 | (let ((buffer-read-only nil)) | ||
| 2612 | (forward-char 1) | ||
| 2613 | (delete-char 1) | ||
| 2614 | (insert mark) | ||
| 2615 | (forward-char -2)) | ||
| 2616 | (progn ; attr list | ||
| 2617 | (setq temp-face | ||
| 2618 | (make-symbol (apply 'concat "temp-face-" | ||
| 2619 | (mapcar '(lambda (sym) | ||
| 2620 | (cond ((symbolp sym) (symbol-name sym)) | ||
| 2621 | ((numberp sym) (int-to-string sym)) | ||
| 2622 | (t sym))) mark)))) | ||
| 2623 | (make-face temp-face) | ||
| 2624 | ;; Remove :face info from the mark, copy the face info into temp-face | ||
| 2625 | (setq faceinfo mark) | ||
| 2626 | (while (setq faceinfo (memq :face faceinfo)) | ||
| 2627 | (copy-face (read (nth 1 faceinfo)) temp-face) | ||
| 2628 | (setcar faceinfo nil) | ||
| 2629 | (setcar (cdr faceinfo) nil)) | ||
| 2630 | (setq mark (delq nil mark)) | ||
| 2631 | ;; Apply the font aspects | ||
| 2632 | (apply 'set-face-attribute temp-face nil mark) | ||
| 2633 | (overlay-put | ||
| 2634 | (make-overlay (1- (point)) (1+ (point))) 'face temp-face)))))))) | ||
| 2574 | 2635 | ||
| 2575 | (defun calendar-star-date () | 2636 | (defun calendar-star-date () |
| 2576 | "Replace the date under the cursor in the calendar window with asterisks. | 2637 | "Replace the date under the cursor in the calendar window with asterisks. |