gpt4 book ai didi

emacs lisp 如何将按钮插入临时缓冲区而不切换到它

转载 作者:行者123 更新时间:2023-12-02 00:04:44 25 4
gpt4 key购买 nike

我是 Elisp 的新手。正在尝试使用以下代码将可点击按钮插入临时缓冲区

(with-output-to-temp-buffer "*tmp*"
(insert-button "My Button"))

它不会以这种方式工作,按钮是在当前缓冲区而不是 tmp 中创建的。然后我尝试将代码修改为以下
(with-output-to-temp-buffer "*tmp*"
(toggle-read-only)
(insert-button "My Button"))

不幸的是,“toggle-read-only”似乎只能为当前缓冲区而不是 tmp 切换只读。

有什么办法可以实现这一点 - 将按钮直接插入临时缓冲区而不实际将光标焦点切换到它?

最佳答案

这是代码:

(with-current-buffer (get-buffer-create "*tmp*")
(insert-button "My Button"))

关于emacs lisp 如何将按钮插入临时缓冲区而不切换到它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19133965/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com