23

我正在使用 org-mode 为我的论文做一个大纲,我想显示所有标题到某个级别(例如所有级别 1 和级别 2 标题)。

我在 org-mode 手册中没有找到任何相关内容。Cycling 要么只显示 1 级标题,要么显示所有标题,这在我的大纲中提供了太多信息。

谢谢,

丹尼尔。

更新:我为他找到了一个解决方法:设置变量 org-cycle-max-level。不过,这是一个全局设置。

4

4 回答 4

30

只是偶然发现了这个问题。一年后,但到底是什么......有一些命令可以让您将标题显示到某个级别。

一个命令是C-<n> C-c tab将子标题显示到 level <n> (<n>=1,2,3...)

另一个命令C-<n> S-tab将对整个缓冲区进行操作。它显示所有标题到级别<n> (<n>=1,2,3...)

于 2012-05-29T15:08:36.620 回答
11

我找到了一个适合我的解决方案:命令 org-content 显示文件夹层次结构,并给它一个数字参数正是我想要的:限制显示的最大级别。在我的示例中,我想显示 2 个级别,所以我可以做到C-2 M-x org-content <RET>.

我还将我自己的命令添加到我的.emacs初始化文件中,将该命令绑定到 Cc m

(defun org-show-two-levels ()
  (interactive)
  (org-content 2))

(add-hook 'org-mode-hook
  (lambda ()
    (define-key org-mode-map "\C-cm" 'org-show-two-levels)))
于 2011-06-03T19:24:56.537 回答
1

如果 M. Kullman 的答案中的前缀参数占用了您太多的心智能力(当您同时努力思考其他事情时,这是一种有限的资源),那么您可以使用以下函数来扩展合同标题

(defvar hf-org-depth-point nil)
(defvar hf-org-depth-depth nil)

(defun hf-org-depth-increase ()
   (interactive)
   (hf-org-depth-incr 1))

(defun hf-org-depth-decrease ()
    (interactive)
    (hf-org-depth-incr -1))

(defun hf-org-depth-incr (incr)
    (when (not (equal (point) hf-org-depth-point))
        (setq hf-org-depth-point nil)
        (setq hf-org-depth-depth 0))a
    (setq hf-org-depth-point (point))
    (setq hf-org-depth-depth (max (+ hf-org-depth-depth incr) 0))
    (hide-subtree)
    (show-children hf-org-depth-depth))

```

于 2016-09-06T22:32:57.523 回答
1

我迟到了,但让我们为后代添加一个简单的方法。只需使用Cycle Global Visibility (<backtab>). 如果您的标题是打开的,它将关闭它们。但是,如果您在所有标题折叠的情况下重复应用它,它们将打开到您想要的级别。

<SHIFT>我通过+从键盘使用它<TAB>。你也可以在 Org 菜单(在 Emacs 中)的 Show/Hide -> Cycle Global Visibility () 下找到它

于 2020-09-29T19:25:08.760 回答