如何为特定缓冲区设置缓冲区本地面值属性? [英] How to set a buffer locally face attribute for a particular buffer?

查看:183
本文介绍了如何为特定缓冲区设置缓冲区本地面值属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想改变Org-Agenda缓冲区中的face属性。
所以我需要在本地更改Org-Agenda面部属性缓冲区。

I want to change the face attribute in Org-Agenda buffer only. So I need to change Org-Agenda face attribute buffer locally.

这是我的代码:(全球)

Here is my code: (which is globally)

(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)

请帮我做这个本地缓冲谢谢

Please to help me make this buffer locally. Thanks

推荐答案

这是你需要做的:

;; 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)

这篇关于如何为特定缓冲区设置缓冲区本地面值属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆