2013-07-13 68 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