2013-07-13 67 views
6

我只想在Org-Agenda緩衝區中更改面部屬性。 所以我需要在本地更改Org-Agenda面部屬性緩衝區如何爲特定緩衝區設置緩衝區本地面屬性?

這裏是我的代碼:(這是全球範圍內)

(defun my-org-agenda-hl-line() 
    (hl-line-mode) 
    (set-face-attribute 'hl-line nil 
        :box '(:color "deep pink" :line-width 2)) 
) 
(add-hook 'org-agenda-mode-hook 'my-org-agenda-hl-line) 

請幫我做這個本地緩衝區。由於

回答

9

以下是你需要做的:

;; First create new face which is a copy of hl-line-face 
(copy-face 'hl-line 'hl-line-agenda-face) 

;; Change what you want in this new face 
(set-face-attribute 'hl-line-agenda-face nil 
        :box '(:color "deep pink" :line-width 2)) 

;; The function to use the new face 
(defun my-org-agenda-hl-line() 
    (set (make-local-variable 'hl-line-face) ; This is how to make it local 
     'hl-line-agenda-face) 
    (hl-line-mode)) 

;; Finally, the hook 
(add-hook 'org-agenda-mode-hook 'my-org-agenda-hl-line) 
+0

哇,這是非常真棒,非常感謝。 – stardiviner