【问题标题】:Section summaries in org-mode组织模式中的部分摘要
【发布时间】:2015-08-30 02:21:23
【问题描述】:

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

到目前为止,我尝试使用抽屉进行摘要。例如:

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

【问题讨论】:

    标签: emacs org-mode


    【解决方案1】:

    在这里,您可以找到问题中 :SUMMARY: 解决方案的快速而肮脏的扩展。

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

    【讨论】:

      【解决方案2】:

      我找到了一个mailing list post,它描述了一个“概要视图”,听起来它可以满足您的需求。看起来很简单:只需使用SYNOPSIS 抽屉,然后使用此功能显示“概要视图”:

      (defun k-synopsis-view ()
        "Show all headings (contents view) and, if any, their synopsis."
        (interactive)
        (save-excursion
          (goto-char (point-min))
          (hide-sublevels 1)
          (while (re-search-forward "\\(^[ \t]*:SYNOPSIS:[. \t]*$\\)" nil t)
            (org-flag-drawer nil)
            (re-search-forward "^[ \t]*:END:[ \t]*" nil t)
            (outline-flag-region (match-beginning 0) (match-end 0) t))
          (org-content)))
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-12-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-07-18
        • 2017-06-26
        相关资源
        最近更新 更多