holo-layer: 一种全新的Emacs增强图层插件

了解,了解 :grinning: :grinning:

最近太忙了, 今天终于有空写一点Elisp代码了

这个补丁让 holo-layer 和 rime frame 窗口可以兼容工作, 之前 holo-layer 在输入法候选词窗口的上面画了一条横线很奇怪, 现在修复了, 如下图:

你好,holo-layer 在启用了native-comp 的emacs上会提示如下错误:

我的环境如下:

OS: Archlinux

Emacs 安装 pacman -S emacs-git

Emacs: 30.0.50

不要用native comp

ok,我试试

holo-layer 增加了赛博朋克版的 indent line 插件, 打开选项 (setq holo-layer-enable-indent-rainbow t)

相对于其他 indent 插件的优势:

  1. 超高性能, 永远不卡Emacs
  2. 像素绘制, 用Qt绘制的对齐线, 不受CJK字体或者其他overlay的影响
  3. 稳定性强, 因为在Qt端绘制, 不会像Overlay或者Text Prop那样万一挂了影响文本内容

还有很多细节需要修正, 完美的支持需要添加 tree-sitter 的支持来识别各个块的语法区域。

欢迎试用, 欢迎PR。

4 个赞

默认是彩虹颜色, 喜欢简洁的可以设置 (setq holo-layer-indent-colors '(“#333333”))

1 个赞

兄台,holo-layer在Mac m1下可以用了?

我的还是不能用,把python和emacs程序都添加到input 监控了也不行。

您是怎么配置的?

我用不了,没有再试了 :pleading_face:

macos 试用的时候 indent line 的位置不会随 emacs 窗口的位置改变。基础偏移就是显示器的基础偏移。即使把 emacs 窗口移到左上角显示也会有一个原生 title bar 的偏移。感觉之前的 border 出现过类似的问题。

欢迎发送补丁,谢谢

pass emacs_frame_info to IndentLine.draw function. by tickscn · Pull Request #34 · manateelazycat/holo-layer (github.com) 按照我对变量的理解提了一个 pr。

合并了,感谢感谢

更新到最新版本,可以看到效果了,酷炫。

猫大,在我按照readme更改了 hyprland.conf 后,启用 holo-layer,虽然holo-layer的窗口全屏了,但是它显示的是桌面的背景图片而非emacs,使得看不见emacs窗口了,且 holo-layer 无响应

*holo-layer*不断重复:(**** 为递增的数字)

[New Thread 0x7fffabfff6c0 (LWP ****)]
[Thread 0x7fffabfff6c0 (LWP ****) exited]

*holo-layer-epc con 35* 无错误输出

  • hyprland version: v0.33.1
  • Emacs version: GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.17.8)

开启前

开启后

我不用 hyprland,不晓得哇。

1 个赞

holo-layer 其实可以做一个 org-mode 的多媒体实时预览插件, 思路如下:

  1. Overlay 插件: 写一个 elisp 插件, 解析连接和多媒体的文本内容, 创建 overlay 提前占好空白位置
  2. 多媒体渲染: 根据内容的属性, 根据视频、SVG、数学公式等, 用Qt绘制置顶的控件, 这样就可以多媒体显示 org-mode 的多媒体内容, 又不用对 emacs 和 org-mode 的代码进行修改, 保持 org-mode 强大的生态
  3. 滚动支持: 根据窗口的边界和org-mode的offset, 传输矩形给 Qt 那边用 setClipPath 函数裁剪掉超出 org-mode window 以外的内容

我不用 org-mode, 但是我想这种功能识别出来以后, org-mode 几乎就是完美了, 分享一下我的思路, 如果哪位大佬有兴趣, 我下班后可以提供Qt关键函数的技术指导。

9 个赞

我有一个暂时的方法可以解决,就是把 showFullScreen() 改成 show() 。可以考虑一下怎么搞一个通用的方法

经过尝试,可以不修改 holo-layer 的代码,在 hyprland 的 配置文件中再加一个规则

windowrulev2 = nofullscreenrequest, title:(holo_layer.py)
4 个赞

;; 启动时窗口全屏 ;(add-to-list 'default-frame-alist '(fullscreen . maximized))

可能要把这一行注释掉, M2 Mac, emacs-plus 可以使用 cursor-animation

但是 indent line 会报错:

/Users/xiudi/.emacs.d/site-lisp/holo-layer/holo_layer.py:223: DeprecationWarning: sipPyTypeDict() is deprecated, the extension module should use sipPyTypeDictRef() instead
  super().__init__()

Traceback (most recent call last):
  File "/Users/xiudi/.emacs.d/site-lisp/holo-layer/holo_layer.py", line 297, in paintEvent
    self.indent_line.draw(painter, self.emacs_indent_infos, self.emacs_frame_info)
  File "/Users/xiudi/.emacs.d/site-lisp/holo-layer/plugin/indent_line.py", line 25, in draw
    indents = [int(i) for i in indents.split(',')]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xiudi/.emacs.d/site-lisp/holo-layer/plugin/indent_line.py", line 25, in <listcomp>
    indents = [int(i) for i in indents.split(',')]
               ^^^^^^
ValueError: invalid literal for int() with base 10: ''

Process *holo-layer* abort trap: 6