3

我是 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切换只读。

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

4

1 回答 1

3

这是代码:

(with-current-buffer (get-buffer-create "*tmp*")
  (insert-button "My Button"))
于 2013-10-02T09:47:55.257 回答