(分享)telega 的一些自定义

利用 modus 主题 fork 了改的,维护了 light 和 dark 两者,其他的都删了。GitHub - LuciusChen/modus-themes: Highly accessible themes for GNU Emacs, conforming with the highest standard for colour contrast between background and foreground values (WCAG AAA).

telega 在 chat-buffer 里时,中英文混输时的换行有点奇怪,可以设置 word-wrap-by-categoryt 就会好很多,至于原理参见其 Emacs 的文档,如下。

Emacs only breaks lines after whitespace characters. When this option is turned on, Emacs also breaks lines after characters that have the “|” category (defined in characters.el). This is useful for allowing breaking after CJK characters and improves the word-wrapping for CJK text mixed with Latin text.

效果对比。左边是 word-wrap-by-categoryt 的效果。

在 telega v0.8.231 中,新增了 telega-msg-heading-with-date-and-status 变量,默认为 nil,这样消息的时间是显示在每个消息的后面,对于不同时间的消息就可以共用同一个 header。

但是对于同一个人连续发送了多条消息,其中一条被回复,被编辑等操作时,就会因为 header 中的内容不一样了,单独给个 header 给这个消息。比较影响整体性,因此我做了修改,把消息的「 查看数量」、「转发数量」、「回复数量」和编辑时间都放在了每个消息的后面,也就是现在的时间戳位置。这样同一个人的多条消息就完全可以共用一个 header。效果如下。

可以参考我 forked 代码 GitHub - LuciusChen/telega.el: GNU Emacs telegram client (unofficial)

主要修改了 telega-ins--message-headertelega-ins--message0 函数。

给 code block 修改了一些样式,主要是修改了 telega--entity-type-to-text-props 以及自定义了一个 face,可参考楼上我的 forked 地址。