gpt4 book ai didi

emacs - 组织模式中的部分摘要

转载 作者:行者123 更新时间:2023-12-01 05:16:53 25 4
gpt4 key购买 nike

我经常在 Emacs 中使用 org-mode 来撰写长篇文章和论文章节,我一直感到沮丧,因为我在章节大纲和全文之间没有中间 View 。有没有人知道包含某种可以轻松显示和隐藏的摘要(如点或一段文本)的好方法?

到目前为止,我尝试过的是使用抽屉作为摘要。例如:

#+TITLE: My article
#+DRAWERS: SUMMARY

* Introduction
* Data and hypotheses
* Results
** First attempt
:SUMMARY:
My first attempt didn't work so well.
:END:

The text of the section goes here...
** Second attempt
:SUMMARY:
I still haven't started my second attempt.
:END:

我发现这非常有效,因为摘要大部分是隐藏的,我只在需要时才看到它们。问题是我仍然无法通过这种方式获得摘要概述,我可以在其中看到每个部分的摘要并隐藏全文。

也许在 org-mode 中没有明显的解决方案,在这种情况下我不反对写一个但肯定其他人有同样的需求所以我想我会先问问是否有其他人找到了解决方案。

最佳答案

在这里,您会发现问题中 :SUMMARY: 解决方案的一个快速而肮脏的扩展。

编辑:我添加了更好的帮助和一种将 org-summary 包含到 org-shifttab 操作中的方法。但是,您也可以将一些键绑定(bind)到 org-summary

(defun org-summary ()
"Include :SUMMARY: drawer into heading if present.
You can use this drawer to write a summary.
As a pre-requisite you should include :SUMMARY: in `org-drawers':

\'(add-to-list 'org-drawers \"SUMMARY\")

1. In your org-document put a line only containing :SUMMARY: on the line following the header.
2. End the summary by a line starting with :END:.
3. Leading indentation for :SUMMARY: and :END: is fine.
4. The last line in the summary block must not be a blank line.
5. The first non-blank character within summary lines must not be a colon `:'.

Example:

* I am the header
:SUMMARY:
And I am the summary.

Spanning several lines including newlines.
In this chapter the following topics are discussed:
1. The world turns fast.
2. We cannot always read everything we have written once.
3. We need a summary.
:END: Now, we will explain everything in full..."
(interactive)
(show-all)
(let ((outline-heading-end-regexp "
\\([[:blank:]]*:SUMMARY:\\(
[[:blank:]]*[^:[:blank:]].*\\)*
[[:blank:]]*:END:\\)?"))
(hide-body)
))

(add-to-list 'org-drawers "SUMMARY")

;; You can insert org-summary into org-cycle:
(defadvice org-shifttab (around summary activate)
(if (and (boundp 'org-summary-cycle)
(null org-summary-cycle)
(eq org-cycle-global-status 'all))
(progn
(org-summary)
(setq-local org-summary-cycle t)
(message "SUMMARY")
)
ad-do-it
(setq-local org-summary-cycle nil)))

关于emacs - 组织模式中的部分摘要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19510984/

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