当我从事件缓冲区调用 org-content 时,我得到了我想要的大纲。但是如果我在像这样的 lisp 函数中使用它
(split-window-right (truncate (* W 0.75)))
(if (get-buffer "inbox.org")
(set-window-buffer nil "inbox.org")
(progn
(find-file "~/Documents/GTD/inbox.org")
(text-scale-set -1)))
(org-content)
窗口 split ,右侧缓冲区被加载,但组织内容位似乎没有做任何事情。 对我做错了什么有什么想法吗?
谢谢
乔克
最佳答案
这是一个可重现的示例,打开一个名为 test.org
的新缓冲区,并在 *scratch*
缓冲区中定义以下函数:
(defun test ()
(let ((buffer (get-buffer "test.org")))
(when buffer
(set-window-buffer nil buffer)
(message "%s" (current-buffer)))))
输出的消息是*scratch*
:仅与窗口关联的缓冲区发生了更改,但 Emacs 认为当前的缓冲区并未发生变化。
如果您使用switch-to-buffer
,如下所示,消息将显示选定的缓冲区:
(defun test ()
(let ((buffer (get-buffer "test.org")))
(when buffer
(switch-to-buffer buffer)
(message "%s" (current-buffer)))))
对代码应用相同的更改会让 (org-content)
满意。
关于elisp - 从 Lisp 调用 org-content 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58408339/