如何在 Emacs 中以 dired 模式突出显示不同类型的文件?
简而言之,我希望在dired模式下对某些类型的文件有不同的面孔。我认为这并不重要,但我正在使用 Aquamacs。
我在这里使用的示例是.tex 文件。如果我可以为 .tex 执行此操作,那么我可以应用相同的结构来为其他类型的文件创建其他面。
据我了解,我必须创建一个变量,编写一个正则表达式,然后应用一个钩子。我读了一些关于正则表达式的内容,到目前为止我
^(.+)\.tex$
认为我的结构和正则表达式并不真正正确。我不是程序员(尽管我对此感兴趣),我只使用 Emacs 两周左右,所以任何帮助将不胜感激。
我需要的至少是我必须做的事情的基本结构。我知道可能已经创建了一些可以执行类似操作的模式(例如 Wdired 和 Dired-X),如果有人告诉我它们,我不会抱怨,但我真正想要的是拥有一个 elisp 代码(或者已经编写)或者我可以继续工作),因为我计划学习一些 elisp 以便能够编写我自己的定制,这将是一种学习方式。
谢谢你!
In a nutshell, I want to have different faces for some types of file in dired mode. I don't think it matters, but I am using Aquamacs.
The example I will use here is .tex files. If I can do it for .tex, then I can just apply the same structure to do create other faces for other types of files.
From what I understand, I have to create a variable, write a regular expression, then apply a hook. I read a bit about regex and so far I have
^(.+)\.tex$
I think my structure and regular expression are not really correct. I am not a programmer (though I have an interest on it), I have only been using Emacs for 2 weeks or so, so any help would be greatly appreciated.
What I need is at least the basic structure of what I have to do. I understand there may be modes already created that do something similar (such as maybe Wdired and Dired-X), and I would not complain if someone told me about them, but what I really want is to have an elisp code (either already written or that I can work on), as I plan on learning a bit of elisp to be able to write my own customisations and this would be a way to learn.
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
既然您想了解如何执行此操作,请尝试查看扩展
dired+。 el
。此模式的功能远远超出您的预期,但它确实添加了新面孔。具体来说,查找变量 diredp-font-lock-keywords-1 及其使用方式。这应该能让你继续前进。其他似乎相关的问题是:
Since you want to learn how to do it, try checking out the extension
dired+.el
. This mode does a lot more than what you want, but it does add new faces. Specifically, look for the variablediredp-font-lock-keywords-1
and how it is used. That should get you going.Other SO questions that seem relevant are: