如果我放置
(insert-image (create-image "/tmp/test.png"))
在缓冲区中,将光标放在最后一个括号后面并使用C-x C-e
,那么图像/tmp/test.png
显示在缓冲区中:
很简约。但,
- 我必须将最后一个括号放在单独的行上,所以图像
靠近缓冲区的左侧。有没有办法隐藏
这
(insert-image ...)
全部文字?
- 该文本文件包含
(insert-image ...)
仅文本,不包含
图像。我对此很满意,但是有没有办法告诉 emacs
自动替换所有(insert-image ...)
表达式由
他们相应的图像(文件打开后),无需我输入C-x C-e
后
每一个?
根据您想要实现的具体目标,您可以尝试以下想法之一:
1. use org-mode
作为缓冲区的主要模式。然后你就可以使用所有的权力org-mode
格式化,包括链接到图像文件并显示它们:
an image without description
[[file:/tmp/image.png]]
an image with description
[[file:/tmp/image.png][my description]]
then you can call org-toggle-inline-images
(C-c C-x C-v) to display images in the buffer (without a prefix argument, it will display only images without description; if you give a prefix argument, it will display all images)
2.编写您自己的 elisp 代码以在您想要的位置插入图像,并将其放入eval
本地伪变量,以便在打开文件时调用它。例如:
foo
<HERE>
bar
# Local Variables:
# eval: (progn (beginning-of-buffer)(search-forward "<HERE>")(insert-image (create-image "/tmp/image.png")))
# End:
当然,您可以将 elisp 代码包装成一个简洁的函数,然后简单地从eval
局部变量(这更干净,但迫使您将函数定义放在远离文件的其他地方)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)