简体   繁体   English

Emacs minibuffer中的突出显示的文本

[英]Highlighted text in Emacs minibuffer

I'm trying to display some highlighted text in the Emacs minibuffer. 我正在尝试在Emacs迷你缓冲区中显示一些突出显示的文本。 I know it's possible because SLIME does it when displaying argument hints. 我知道这是可能的,因为SLIME在显示参数提示时会这样做。 However, I can't see how it's being accomplished by looking at slime.el . 但是,通过查看slime.el ,我看不到它是如何实现的。 Based on what I'm reading there, the displayed text shouldn't be highlighted (relevant section starts at line 3615). 根据我在这里阅读的内容, 不应突出显示显示的文本(相关部分从3615行开始)。

I've tried 我试过了

  • (message "%s" (propertize "test" 'face 'highlight))
  • (overlay-put (make-overlay (point-min) (point-min)) 'before-string (propertize "test" 'face 'highlight))
  • (with-current-buffer (window-buffer (minibuffer-window)) (insert (propertize "test" 'face 'highlight)))

That last one seems closest to what I want, but the displayed text appears and disappears sporadically as I move point , and it has to be manually removed later. 最后一个似乎最接近我想要的内容,但是当我移动point ,显示的文本偶尔出现并消失,因此必须稍后手动将其删除。 I've also tested the solution given here , and it doesn't seem to work for me either. 我还测试了此处提供的解决方案,它似乎也不适合我。 The non-working solutions all do the same thing; 无效的解决方案都做同样的事情。 display the text 显示文字

  #("test" 0 4 (face highlight))

in the minibuffer. 在迷你缓冲区中。

In case it matters, I'm running Emacs 23.4.1 on Debian Wheezy. 万一重要,我在Debian Wheezy上运行Emacs 23.4.1。

您是使用M-:进行测试的受害者M-:除了运行代码外, M-:还显示返回的值在迷你缓冲区中,从而立即覆盖您所做的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM