| 167 | | (defcustom number-of-diary-entries 1 |
|---|
| 168 | | "*Specifies how many days of diary entries are to be displayed initially. |
|---|
| 169 | | This variable affects the diary display when the command \\[diary] is used, |
|---|
| 170 | | or if the value of the variable `view-diary-entries-initially' is t. For |
|---|
| 171 | | example, if the default value 1 is used, then only the current day's diary |
|---|
| 172 | | entries will be displayed. If the value 2 is used, then both the current |
|---|
| 173 | | day's and the next day's entries will be displayed. |
|---|
| 174 | | |
|---|
| 175 | | The value can also be a vector such as [0 2 2 2 2 4 1]; this value |
|---|
| 176 | | says to display no diary entries on Sunday, the display the entries |
|---|
| 177 | | for the current date and the day after on Monday through Thursday, |
|---|
| 178 | | display Friday through Monday's entries on Friday, and display only |
|---|
| 179 | | Saturday's entries on Saturday. |
|---|
| 180 | | |
|---|
| 181 | | This variable does not affect the diary display with the `d' command |
|---|
| 182 | | from the calendar; in that case, the prefix argument controls the |
|---|
| 183 | | number of days of diary entries displayed." |
|---|
| 184 | | :type '(choice (integer :tag "Entries") |
|---|
| 185 | | (vector :value [0 0 0 0 0 0 0] |
|---|
| 186 | | (integer :tag "Sunday") |
|---|
| 187 | | (integer :tag "Monday") |
|---|
| 188 | | (integer :tag "Tuesday") |
|---|
| 189 | | (integer :tag "Wednesday") |
|---|
| 190 | | (integer :tag "Thursday") |
|---|
| 191 | | (integer :tag "Friday") |
|---|
| 192 | | (integer :tag "Saturday"))) |
|---|
| 193 | | :group 'diary) |
|---|
| 194 | | |
|---|
| 195 | | ;;;###autoload |
|---|
| 2934 | | (save-excursion |
|---|
| 2935 | | (set-buffer calendar-buffer) |
|---|
| 2936 | | (calendar-cursor-to-visible-date date) |
|---|
| 2937 | | (let ((mark (or (and (stringp mark) (= (length mark) 1) mark) ; single-char |
|---|
| 2938 | | (and (listp mark) (> (length mark) 0) mark) ; attr list |
|---|
| 2939 | | (and (facep mark) mark) ; face-name |
|---|
| 2940 | | diary-entry-marker))) |
|---|
| 2941 | | (if (facep mark) |
|---|
| 2942 | | (progn ; face or an attr-list that contained a face |
|---|
| 2943 | | (overlay-put |
|---|
| 2944 | | (make-overlay (1- (point)) (1+ (point))) 'face mark)) |
|---|
| 2945 | | (if (and (stringp mark) |
|---|
| 2946 | | (= (length mark) 1)) ; single-char |
|---|
| 2947 | | (let ((buffer-read-only nil)) |
|---|
| 2948 | | (forward-char 1) |
|---|
| 2949 | | (delete-char 1) |
|---|
| 2950 | | (insert mark) |
|---|
| 2951 | | (forward-char -2)) |
|---|
| 2952 | | (let ; attr list |
|---|
| 2953 | | ((temp-face |
|---|
| 2954 | | (make-symbol (apply 'concat "temp-" |
|---|
| 2955 | | (mapcar '(lambda (sym) |
|---|
| 2956 | | (cond ((symbolp sym) (symbol-name sym)) |
|---|
| 2957 | | ((numberp sym) (int-to-string sym)) |
|---|
| 2958 | | (t sym))) mark)))) |
|---|
| 2959 | | (faceinfo mark)) |
|---|
| 2960 | | (make-face temp-face) |
|---|
| 2961 | | ;; Remove :face info from the mark, copy the face info into temp-face |
|---|
| 2962 | | (while (setq faceinfo (memq :face faceinfo)) |
|---|
| 2963 | | (copy-face (read (nth 1 faceinfo)) temp-face) |
|---|
| 2964 | | (setcar faceinfo nil) |
|---|
| 2965 | | (setcar (cdr faceinfo) nil)) |
|---|
| 2966 | | (setq mark (delq nil mark)) |
|---|
| 2967 | | ;; Apply the font aspects |
|---|
| 2968 | | (apply 'set-face-attribute temp-face nil mark) |
|---|
| 2969 | | (overlay-put |
|---|
| 2970 | | (make-overlay (1- (point)) (1+ (point))) 'face temp-face)))))))) |
|---|
| | 2903 | (with-current-buffer calendar-buffer |
|---|
| | 2904 | (save-excursion |
|---|
| | 2905 | (calendar-cursor-to-visible-date date) |
|---|
| | 2906 | (setq mark |
|---|
| | 2907 | (or (and (stringp mark) (= (length mark) 1) mark) ; single-char |
|---|
| | 2908 | (and (listp mark) (> (length mark) 0) mark) ; attr list |
|---|
| | 2909 | (and (facep mark) mark) ; face-name |
|---|
| | 2910 | diary-entry-marker)) |
|---|
| | 2911 | (cond |
|---|
| | 2912 | ;; face or an attr-list that contained a face |
|---|
| | 2913 | ((facep mark) |
|---|
| | 2914 | (overlay-put |
|---|
| | 2915 | (make-overlay (1- (point)) (1+ (point))) 'face mark)) |
|---|
| | 2916 | ;; single-char |
|---|
| | 2917 | ((and (stringp mark) (= (length mark) 1)) |
|---|
| | 2918 | (let ((inhibit-read-only t)) |
|---|
| | 2919 | (forward-char 1) |
|---|
| | 2920 | ;; Insert before delete so as to better preserve markers. |
|---|
| | 2921 | (insert mark) |
|---|
| | 2922 | (delete-char 1) |
|---|
| | 2923 | (forward-char -2))) |
|---|
| | 2924 | (t ;; attr list |
|---|
| | 2925 | (let ((temp-face |
|---|
| | 2926 | (make-symbol |
|---|
| | 2927 | (apply 'concat "temp-" |
|---|
| | 2928 | (mapcar (lambda (sym) |
|---|
| | 2929 | (cond |
|---|
| | 2930 | ((symbolp sym) (symbol-name sym)) |
|---|
| | 2931 | ((numberp sym) (number-to-string sym)) |
|---|
| | 2932 | (t sym))) |
|---|
| | 2933 | mark)))) |
|---|
| | 2934 | (faceinfo mark)) |
|---|
| | 2935 | (make-face temp-face) |
|---|
| | 2936 | ;; Remove :face info from the mark, copy the face info into |
|---|
| | 2937 | ;; temp-face |
|---|
| | 2938 | (while (setq faceinfo (memq :face faceinfo)) |
|---|
| | 2939 | (copy-face (read (nth 1 faceinfo)) temp-face) |
|---|
| | 2940 | (setcar faceinfo nil) |
|---|
| | 2941 | (setcar (cdr faceinfo) nil)) |
|---|
| | 2942 | (setq mark (delq nil mark)) |
|---|
| | 2943 | ;; Apply the font aspects |
|---|
| | 2944 | (apply 'set-face-attribute temp-face nil mark) |
|---|
| | 2945 | (overlay-put |
|---|
| | 2946 | (make-overlay (1- (point)) (1+ (point))) 'face temp-face)))))))) |
|---|