aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2008-04-01 04:10:09 +0000
committerGlenn Morris2008-04-01 04:10:09 +0000
commitc899d5e37a6dd5ab33bc9c19280715aa02b04643 (patch)
tree2e9e81633b9aebe37c5bce33f67558441ee78b7f
parenteff756afa6d3b292aee7e32a76ebc0aab0d34845 (diff)
downloademacs-c899d5e37a6dd5ab33bc9c19280715aa02b04643.tar.gz
emacs-c899d5e37a6dd5ab33bc9c19280715aa02b04643.zip
(calendar-make-temp-face): New function.
(mark-visible-calendar-date): Use it.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/calendar/calendar.el50
2 files changed, 32 insertions, 22 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1d7f1108dd8..b2ec3dc151a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
12008-04-01 Glenn Morris <rgm@gnu.org> 12008-04-01 Glenn Morris <rgm@gnu.org>
2 2
3 * calendar/calendar.el (calendar-make-temp-face): New function.
4 (mark-visible-calendar-date):
5 * calendar/diary-lib.el (fancy-diary-display): Use it.
6
3 * vc-hooks.el (vc-responsible-backend): Declare as function. 7 * vc-hooks.el (vc-responsible-backend): Declare as function.
4 8
5 * calendar/calendar.el (calendar-nongregorian-visible-p): New function. 9 * calendar/calendar.el (calendar-nongregorian-visible-p): New function.
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 61b65130864..fce43de2cac 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -2387,6 +2387,31 @@ Returns the corresponding Gregorian date."
2387 (= (extract-calendar-day date1) (extract-calendar-day date2)) 2387 (= (extract-calendar-day date1) (extract-calendar-day date2))
2388 (= (extract-calendar-year date1) (extract-calendar-year date2)))) 2388 (= (extract-calendar-year date1) (extract-calendar-year date2))))
2389 2389
2390(defun calendar-make-temp-face (attrlist)
2391 "Return a temporary face based on the attributes in ATTRLIST.
2392ATTRLIST is a list with elements of the form :face face :foreground color."
2393 (let ((temp-face (make-symbol
2394 (mapconcat (lambda (sym)
2395 (cond
2396 ((symbolp sym) (symbol-name sym))
2397 ((numberp sym) (number-to-string sym))
2398 (t sym)))
2399 attrlist "")))
2400 (faceinfo attrlist))
2401 (make-face temp-face)
2402 ;; Remove :face info, copy into temp-face.
2403 (while (setq faceinfo (memq :face faceinfo))
2404 ;; FIXME is there any point doing this multiple times, or could we
2405 ;; just take the last?
2406 (condition-case nil
2407 (copy-face (intern-soft (cadr faceinfo)) temp-face)
2408 (error nil))
2409 (setq faceinfo (cddr faceinfo)))
2410 (setq attrlist (delq nil attrlist))
2411 ;; Apply the font aspects.
2412 (apply 'set-face-attribute temp-face nil attrlist)
2413 temp-face))
2414
2390(defun mark-visible-calendar-date (date &optional mark) 2415(defun mark-visible-calendar-date (date &optional mark)
2391 "Mark DATE in the calendar window with MARK. 2416 "Mark DATE in the calendar window with MARK.
2392MARK is a single-character string, a list of face attributes/values, or a face. 2417MARK is a single-character string, a list of face attributes/values, or a face.
@@ -2410,28 +2435,9 @@ MARK defaults to `diary-entry-marker'."
2410 (overlay-put 2435 (overlay-put
2411 (make-overlay (1+ (point)) (+ 2 (point))) 'display mark)) 2436 (make-overlay (1+ (point)) (+ 2 (point))) 'display mark))
2412 (t ; attr list 2437 (t ; attr list
2413 (let ((temp-face 2438 (overlay-put
2414 (make-symbol 2439 (make-overlay (1- (point)) (1+ (point))) 'face
2415 (apply 'concat "temp-" 2440 (calendar-make-temp-face mark))))))))
2416 (mapcar (lambda (sym)
2417 (cond
2418 ((symbolp sym) (symbol-name sym))
2419 ((numberp sym) (number-to-string sym))
2420 (t sym)))
2421 mark))))
2422 (faceinfo mark))
2423 (make-face temp-face)
2424 ;; Remove :face info from mark, copy the face info into temp-face.
2425 (while (setq faceinfo (memq :face faceinfo))
2426 ;; FIXME not read.
2427 (copy-face (read (nth 1 faceinfo)) temp-face)
2428 (setcar faceinfo nil)
2429 (setcar (cdr faceinfo) nil))
2430 (setq mark (delq nil mark))
2431 ;; Apply the font aspects.
2432 (apply 'set-face-attribute temp-face nil mark)
2433 (overlay-put
2434 (make-overlay (1- (point)) (1+ (point))) 'face temp-face))))))))
2435 2441
2436(defun calendar-star-date () 2442(defun calendar-star-date ()
2437 "Replace the date under the cursor in the calendar window with asterisks. 2443 "Replace the date under the cursor in the calendar window with asterisks.