home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / lucid / help-lucid-emacs / text0163.txt < prev    next >
Encoding:
Text File  |  1993-07-14  |  3.8 KB  |  120 lines

  1. Tony E. Bennett writes:
  2.  > This is what I did.  Not entirely happy with it.  Sometimes
  3.  > it seems to take a *long* time to step from one msg to the next.
  4.  > 
  5.  > add to dummy-font-lock-mode-hook
  6.  > 
  7.  >         ((eq major-mode 'vm-mode)
  8.  >          (set (make-local-variable 'font-lock-keywords)
  9.  >               vm-font-lock-keywords))
  10.  >         ((eq major-mode 'vm-summary-mode)
  11.  >          (set (make-local-variable 'font-lock-keywords)
  12.  >               vm-summary-font-lock-keywords))
  13.  >         ((eq major-mode 'mail-mode)
  14.  >          (set (make-local-variable 'font-lock-keywords)
  15.  >               vm-font-lock-keywords))
  16.  > 
  17.  > put this with your font-lock config (.emacs):
  18.  > note I use environ variable to specify fonts.
  19.  > In this case I have MFONT_BOLD set to "lucidasans-typewriterbold-12"
  20.  > 
  21.  > (or (find-face 'marked-face)
  22.  >     (make-face 'marked-face))
  23.  > (or (find-face 'new-face)
  24.  >     (make-face 'new-face))
  25.  > (or (find-face 'red-face)
  26.  >     (make-face 'red-face))
  27.  > (or (find-face 'yellow-face)
  28.  >     (make-face 'yellow-face))
  29.  > (or (find-face 'deleted-face)
  30.  >     (make-face 'deleted-face))
  31.  > 
  32.  > (set-face-background 'marked-face "dark green")
  33.  > (set-face-font 'marked-face (getenv "MFONT_BOLD"))
  34.  > 
  35.  > (set-face-background 'new-face "light coral")
  36.  > (set-face-foreground 'new-face "black")
  37.  > (set-face-font 'new-face (getenv "MFONT_BOLD"))
  38.  > 
  39.  > (set-face-foreground 'deleted-face "grey30")
  40.  > (set-face-background 'deleted-face "grey60")
  41.  > 
  42.  > (set-face-foreground 'red-face "#FF2060")
  43.  > (set-face-font 'red-face (getenv "MFONT_BOLD"))
  44.  > 
  45.  > (set-face-foreground 'yellow-face "yellow")
  46.  > (set-face-font 'yellow-face (getenv "MFONT_BOLD"))
  47.  > 
  48.  > ;; 
  49.  > ;; VM and Mail mode
  50.  > ;;
  51.  > 
  52.  > (setq vm-font-lock-keywords
  53.  >       '(
  54.  >         ("^From:.*" . font-lock-keyword-face)
  55.  >         ("^T[oO]:.*" . font-lock-string-face)
  56.  >         ("^C[cC]:.*\\|^FCC:.*" . font-lock-comment-face)
  57.  >         ("^Subject:.*" . font-lock-function-name-face)))
  58.  > 
  59.  > ;; 
  60.  > ;; VM summary buffer
  61.  > ;;
  62.  > 
  63.  > (setq vm-summary-font-lock-keywords
  64.  >       '(
  65.  >         ("^->.*" 0 yellow-face t)
  66.  >         ("^...[0-9]+[UN].*" 0 new-face t)    ;; new/unread
  67.  >         ("^...[0-9]+[A-Z]* *\\*.*" 0 marked-face t)    ;; marked
  68.  >         ("^...[0-9]+D.*" 0 deleted-face t)    ;; deleted
  69.  >         ))
  70.  > 
  71.  > ;; Define the highlighting function. Basically just redefine the
  72.  > ;;  standard VM function so it uses font-lock buttons.
  73.  > 
  74.  > (defun vm-highlight-headers (message window)
  75.  >   "\
  76.  > Using font-lock; highlight From: and Subject: fields in mail messages displayed
  77.  > by VM."
  78.  >   (save-excursion
  79.  >     ;; As of v18.52, this call to save-window-excursion is needed!
  80.  >     ;; Somehow window point can get fouled in here, and drag the
  81.  >     ;; buffer point along with it.  This problem only manifests
  82.  >     ;; itself when operating VM from the summary buffer, subsequent
  83.  >     ;; to using vm-beginning-of-message or vm-end-of-message.
  84.  >     ;; After running a next or previous message command, point
  85.  >     ;; somehow ends up at the end of the message.
  86.  >     (save-window-excursion
  87.  >       (font-lock-mode 1))))
  88.  > 
  89.  > (defun vm-my-force-font-lock ()
  90.  >   (let ((font-lock-verbose nil))
  91.  >     (setq font-lock-fontified nil)
  92.  >     (font-lock-mode 1)))
  93.  > 
  94.  > (add-hook 'vm-show-message-hook 'vm-my-force-font-lock)
  95.  > (add-hook 'vm-preview-message-hook 'vm-my-force-font-lock)
  96.  > (add-hook 'vm-summary-mode-hooks 'vm-my-force-font-lock)
  97.  > (add-hook 'mail-setup-hook '(lambda () (font-lock-mode 1)))
  98.  
  99.  
  100. I love it, you made my day.
  101. If you have any improvements, please let us know, o.k ?
  102.  
  103. Thanks,
  104.  
  105. --
  106. Danny.
  107.  
  108. -------------------------------
  109. Dan Bar Dov
  110.  
  111. Applied Materials (Israel)
  112. Currently at Applied Materials - Santa Clara, CA
  113.  
  114. Email:        danny@amil.co.il
  115. Phone:        office (408) 235-6514
  116.               home   (408) 739-5281
  117. TimeZone:     PST
  118. -------------------------------
  119.  
  120.