elisp - 从 lisp 调用 org-content 不起作用
问题描述
当我从活动缓冲区调用 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)
窗口拆分并加载了正确的缓冲区,但 org-content 位似乎没有做任何事情。关于我做错了什么的任何想法?
谢谢,
约克
解决方案
这是一个可重现的示例,打开一个名为的新缓冲区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)
很开心。
推荐阅读
- ios - Run on iOS 13 device using Xcode without iOS 13
- python-3.x - 如何从 keras 高级层中获取权重?
- android - 使用改造 2 加载图像
- c# - 不在大厅时使用 LoadBalancingClient 轮询可用的 Unity Photon 房间?
- android - 为什么我的电子邮件和密码变量作为未解决的参考出现?
- node.js - 如何将参数传递到我的 put 调用中?
- excel - 确保用户窗体上的组合框和文本框不为空
- mysql - Sequelize:在同一事务中使用截断和插入
- conv-neural-network - 在 CNN 中使用自定义过滤器时遇到错误:RuntimeError: expected backend CUDA and dtype Float but got backend CPU and dtype Float
- youtube - Youtube 数据 API 密钥停止工作。获取 accessNotConfigured 错误