emacs-wiki-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[emacs-wiki-discuss] Re: muse colors (and documentation)


From: Oursoye
Subject: [emacs-wiki-discuss] Re: muse colors (and documentation)
Date: Sat, 18 Mar 2006 18:31:02 +0000 (UTC)
User-agent: slrn/0.9.8.1 (Debian)

Le 18-03-2006, Oursoye <address@hidden> a écrit :
>
> The good procedure to modify the colors
> is easily derived from the example below which changes
> the colors in the
> planner-appt-forthcoming-display-buffer. 
>
> (add-hook 'planner-mode-hook
>           (lambda () "" (when (equal (buffer-name)
>           planner-appt-forthcoming-display-buffer)
>                 (add-to-list 'muse-colors-buffer-hook
>                 'colorier-buffer-appointments))))
> where 
> 'colorier-buffer-appointments is....


If someone is interested, I put below the
code to obtain a nice view of the apppointments. Each
name of the day is highlighted with gray
background. Each sunday is highlighted with green
background so the number of weeks from now to an
appointment is easy to read using these green marks. 
Each beginning of month is highlighted with red
background so that the number of month and the number
of days till the end of the month is graphically
apparent too. 

The code is far from perfect (maybe a bit "artificial")
but I think the display is nice. 


(add-hook 'planner-mode-hook
            (lambda () "" (when (equal (buffer-name)
            planner-appt-forthcoming-display-buffer)
                  (add-to-list 'muse-colors-buffer-hook 
'colorier-buffer-appointments))))


I prefer to see the appointments just behind the name
of the day/month so I put this in my
'planner-cyclic-diary-file:


Remark: do not strip the blanks after the 
names of the days/months as they are used for colorisation.
01/1 @00:00 | 00:00 |Janvier                                     
02/1 @00:00 | 00:00 |Février                                      
03/1 @00:00 | 00:00 |Mars                                            
04/1 @00:00 | 00:00 |Avril                                            
05/1 @00:00 | 00:00 |Mai                                       
06/1 @00:00 | 00:00 |Juin                                     
07/1 @00:00 | 00:00 |Juillet                                        
08/1 @00:00 | 00:00 |Août                                         
09/1 @00:00 | 00:00 |Septembre                                      
10/1 @00:00 | 00:00 |Octobre                                        
11/1 @00:00 | 00:00 |Novembre                                     
12/1 @00:00 | 00:00 |Décembre                                             
Monday @00:00 | 00:00 |Lundi      
Tuesday @00:00 | 00:00 |Mardi      
Wednesday @00:00 | 00:00 |Mercredi      
Thursday @00:00 | 00:00 |Jeudi       
Friday @00:00 | 00:00 |Vendredi      
Saturday @00:00 | 00:00 |Samedi     
Sunday @00:00 | 00:00 |Dimanche                                      



Then these appointments are displayed in a nice way 
using the following code which masks the ugly 00:00



(add-hook 'planner-mode-hook
          (lambda () "" (when (equal (buffer-name) 
planner-appt-forthcoming-display-buffer)
              (add-to-list 'muse-colors-buffer-hook 
'colorier-buffer-appointments))))

(defun colorier-buffer-appointments (beg end &optional verbose)
  ""
  (interactive)
  (goto-char beg)
  ;On colore le dimanche en eliminant les heures parasites
  (while (re-search-forward "Dimanche" end t)
    (add-text-properties (match-beginning 0)
                         (+ 30 (match-beginning 0))
                         '(face dimanche-face))
    (beginning-of-line)
    (search-forward "00:00")
    (add-text-properties (match-beginning 0)
                         (match-end 0)
                         '(face jour-usuel-invisible-face))
    (search-forward "00:00")
    (add-text-properties (match-beginning 0)
                         (match-end 0)
                         '(face jour-usuel-invisible-face))
    (end-of-line))
  ;on colore les jours de la semaine en eliminant les heures parasites
  (goto-char beg)
  (while (re-search-forward 
"Lundi\\|Mardi\\|Mercredi\\|Jeudi\\|Vendredi\\|Samedi" end t)
    (add-text-properties (match-beginning 0)
                         (+ 10 (match-beginning 0))
                         '(face jour-usuel-face))
    (beginning-of-line)
    (search-forward "00:00")
    (add-text-properties (match-beginning 0)
                         (match-end 0)
                         '(face jour-usuel-invisible-face))
    (search-forward "00:00")
    (add-text-properties (match-beginning 0)
                         (match-end 0)
                         '(face jour-usuel-invisible-face))
    (end-of-line))
  ;on colore les mois  
  (goto-char beg)
  (while (re-search-forward 
"Janvier\\|Février\\|Mars\\|Avri\\|Mai\\|Juin\\|Juillet\\|Août\\|Septembre\\|Octobre\\|Novembre\\|Décembre"
 end t)
    (beginning-of-line)
    (add-text-properties (point)
                       (+ 30 (match-beginning 0))
                       '(face face-pour-le-mois))
    (beginning-of-line)
    (search-forward "00:00")
    (add-text-properties (match-beginning 0)
                         (match-end 0)
                         '(face mois-invisible-face))
    (search-forward "00:00")
    (add-text-properties (match-beginning 0)
                         (match-end 0)
                         '(face mois-invisible-face))
    (end-of-line)))


 (defface jour-usuel-face
    '((t (:background "gray" :foreground "black")))
    "Face pour les jours de semaine dans planner-appt."
    :group 'muse-colors)

(defface jour-usuel-invisible-face
    '((t ( :foreground "black")))
    "Face pour les jours de semaine dans planner-appt."
    :group 'muse-colors)


 (defface dimanche-face
    '((t (:background "dark green")))
    "Face pour le dimanche dans planner-appt."
    :group 'muse-colors)


 (defface face-pour-le-mois
    '((t (:background "dark red" :foreground "white")))
    "Face pour le mois dans planner-appt."
    :group 'muse-colors)


 (defface mois-invisible-face
    '((t (:background "dark red" :foreground "dark red")))
    "Face pour le mois dans planner-appt."
    :group 'muse-colors)













reply via email to

[Prev in Thread] Current Thread [Next in Thread]