gpt4 book ai didi

emacs - 如何从 org-mode 缓冲区中的折叠状态仅复制可见文本?

转载 作者:行者123 更新时间:2023-12-04 01:40:42 24 4
gpt4 key购买 nike

如果源是:如何将 org 文件复制到其他缓冲区:

** TODO task #1
- some text for task #1
** TODO task #2
- some text for task #2

但是当你折叠所有任务时,它看起来像
** TODO task #1 ...
** TODO task #2 ...

我想标记所有任务并复制到另一个缓冲区,它必须看起来像第二个变体。不要包含存储在每个任务中的任务文本。
我该怎么做?

最佳答案

根据 Hendy 的评论,在当前版本的 org-mode 中,您使用 org-copy-visible ( C-c C-x v ) 将当前区域的可见内容复制到杀伤环。 (像往常一样,可以首先使用 C-x h 标记整个缓冲区。)

此外,请注意导出调度菜单 ( C-x C-e ) 提供了“仅可见”开关,如果您想将该内容导出为不同的格式。

对于旧版本的 org-mode,以下原始答案仍应适用:
M-x org-export-visible RET SPC只会将组织模式缓冲区的当前可见文本复制到新缓冲区中。

org-export-visible is an interactive compiled Lisp function in `org-exp.el'.

(org-export-visible TYPE ARG)

Create a copy of the visible part of the current buffer, and export it. The copy is created in a temporary buffer and removed after use. TYPE is the final key (as a string) that also select the export command in the `C-c C-e' export dispatcher. As a special case, if the you type SPC at the prompt, the temporary org-mode file will not be removed but presented to you so that you can continue to use it. The prefix arg ARG is passed through to the exporting command.



如果你想绑定(bind)它(在本例中绑定(bind)到 C-c o),你可以使用以下命令:
(add-hook 'org-mode-hook 'my-org-mode-hook)
(defun my-org-mode-hook ()
"Custom behaviours when entering org-mode."
(local-set-key (kbd "C-c o") (function (lambda () (interactive)
(org-export-visible ?\s nil)))))

关于emacs - 如何从 org-mode 缓冲区中的折叠状态仅复制可见文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3193985/

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