如何在Emacs中实现渐逝文本?

use*_*989 3 emacs templates

一些文字处理软件(例如Apple Words)具有支持渐逝文本的有趣特征.

这种文本在模板文件中用作占位符:如果我从模板开始新的报表,则某些条目会填充渐逝文本,当文本插入与文本或其边界对应的区域内时,该文本会消失.此文本也具有特殊外观.

如果可能的话,如何在Emacs中实现渐逝文本?在富文本或降价缓冲区中支持它可能就足够了.

Tob*_*ias 5

以下代码段可能会给您一个想法.

(defun remove-evanescent (oldpos newpos)
  "We need that later on to remove evanescent text. We could also remove the superfluous space here."
  (remove-text-properties newpos
              (next-property-change newpos)
              '(display nil point-entered nil)))

;; An elisp-snippet to be tried in the *scratch* buffer:
(insert (propertize " " 'display "Help"
            'point-entered 'remove-evanescent))
Run Code Online (Sandbox Code Playgroud)