diff options
| -rw-r--r-- | lisp/calendar/calendar.el | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index fce43de2cac..7ae60e170cd 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el | |||
| @@ -2390,27 +2390,35 @@ Returns the corresponding Gregorian date." | |||
| 2390 | (defun calendar-make-temp-face (attrlist) | 2390 | (defun calendar-make-temp-face (attrlist) |
| 2391 | "Return a temporary face based on the attributes in ATTRLIST. | 2391 | "Return a temporary face based on the attributes in ATTRLIST. |
| 2392 | ATTRLIST is a list with elements of the form :face face :foreground color." | 2392 | ATTRLIST is a list with elements of the form :face face :foreground color." |
| 2393 | (let ((temp-face (make-symbol | 2393 | (let ((attrs attrlist) |
| 2394 | (mapconcat (lambda (sym) | 2394 | faceinfo face temp-face) |
| 2395 | (cond | 2395 | ;; Separate :face from the other attributes. Use the last :face |
| 2396 | ((symbolp sym) (symbol-name sym)) | 2396 | ;; if there are more than one. FIXME is merging meaningful? |
| 2397 | ((numberp sym) (number-to-string sym)) | 2397 | (while attrs |
| 2398 | (t sym))) | 2398 | (if (eq (car attrs) :face) |
| 2399 | attrlist ""))) | 2399 | (setq face (intern-soft (cadr attrs)) |
| 2400 | (faceinfo attrlist)) | 2400 | attrs (cddr attrs)) |
| 2401 | (make-face temp-face) | 2401 | (push (car attrs) faceinfo) |
| 2402 | ;; Remove :face info, copy into temp-face. | 2402 | (setq attrs (cdr attrs)))) |
| 2403 | (while (setq faceinfo (memq :face faceinfo)) | 2403 | (or (facep face) (setq face 'default)) |
| 2404 | ;; FIXME is there any point doing this multiple times, or could we | 2404 | (if (not faceinfo) |
| 2405 | ;; just take the last? | 2405 | ;; No attributes to apply, so just use an existing-face. |
| 2406 | (condition-case nil | 2406 | face |
| 2407 | (copy-face (intern-soft (cadr faceinfo)) temp-face) | 2407 | ;; FIXME should we be using numbered temp-faces, re-using where poss? |
| 2408 | (error nil)) | 2408 | (setq temp-face |
| 2409 | (setq faceinfo (cddr faceinfo))) | 2409 | (make-symbol |
| 2410 | (setq attrlist (delq nil attrlist)) | 2410 | (concat ":caltemp" |
| 2411 | ;; Apply the font aspects. | 2411 | (mapconcat (lambda (sym) |
| 2412 | (apply 'set-face-attribute temp-face nil attrlist) | 2412 | (cond |
| 2413 | temp-face)) | 2413 | ((symbolp sym) (symbol-name sym)) |
| 2414 | ((numberp sym) (number-to-string sym)) | ||
| 2415 | (t sym))) | ||
| 2416 | attrlist "")))) | ||
| 2417 | (make-face temp-face) | ||
| 2418 | (copy-face face temp-face) | ||
| 2419 | ;; Apply the font aspects. | ||
| 2420 | (apply 'set-face-attribute temp-face nil (nreverse faceinfo)) | ||
| 2421 | temp-face))) | ||
| 2414 | 2422 | ||
| 2415 | (defun mark-visible-calendar-date (date &optional mark) | 2423 | (defun mark-visible-calendar-date (date &optional mark) |
| 2416 | "Mark DATE in the calendar window with MARK. | 2424 | "Mark DATE in the calendar window with MARK. |