25

有人可以帮我完全隐藏:PROPERTIES:抽屉,包括上面写着的那一行:PROPERTIES:

* TASKS (with deadines)

    ** Next Action [#A] Ask the geniuses how to do this.  :lawlist:
       DEADLINE: <2013-07-04 Thu >
         :PROPERTIES:
         :ToodledoID: 330686790
         :ToodledoFolder: TASKS
         :Hash:     afa88f17317bbe2ce0ce661333cdcfb4
         :END:
       This line is for notes, which appears underneath the properties drawer.

* UNDATED (without deadlines)

    ** Someday [#A] Close but no cigar -- keep trying.  :lawlist:
          :PROPERTIES:
          :ToodledoID: 330686680
          :ToodledoFolder: TASKS
          :Hash:     eb0b8d360b5b1453dd66ed0c5698e135
          :END:
       This line is for notes, which appears underneath the properties drawer.

我没有在谷歌上看到这个特性,所以我猜测需要一些特殊的代码行才能使这个特性请求成为现实。[换句话说,我不认为这是一个超级用户的问题,因为这需要用一些特殊的代码来发明。]

4

3 回答 3

26

以下答案完全隐藏了所有:PROPERTIES:内容:END:。它可以通过评估(org-cycle-hide-drawers 'children)、 或(org-cycle-hide-drawers 'all)或与与循环大纲视图相关的其他功能一起进行测试。包含在org-mode家庭中的所有标准功能都可以展开 - 例如,show-all; org-show-subtree; 等等

(require 'org)

(defun org-cycle-hide-drawers (state)
  "Re-hide all drawers after a visibility state change."
  (when (and (derived-mode-p 'org-mode)
             (not (memq state '(overview folded contents))))
    (save-excursion
      (let* ((globalp (memq state '(contents all)))
             (beg (if globalp
                    (point-min)
                    (point)))
             (end (if globalp
                    (point-max)
                    (if (eq state 'children)
                      (save-excursion
                        (outline-next-heading)
                        (point))
                      (org-end-of-subtree t)))))
        (goto-char beg)
        (while (re-search-forward org-drawer-regexp end t)
          (save-excursion
            (beginning-of-line 1)
            (when (looking-at org-drawer-regexp)
              (let* ((start (1- (match-beginning 0)))
                     (limit
                       (save-excursion
                         (outline-next-heading)
                           (point)))
                     (msg (format
                            (concat
                              "org-cycle-hide-drawers:  "
                              "`:END:`"
                              " line missing at position %s")
                            (1+ start))))
                (if (re-search-forward "^[ \t]*:END:" limit t)
                  (outline-flag-region start (point-at-eol) t)
                  (user-error msg))))))))))

对于任何对在所有各种视图之间循环选项卡感兴趣的人(包括显示抽屉内的内容) ,可以通过在之前添加一个附加条件:PROPERTIES:来轻松修改org-cycle-internal-local (t ;; Default action: hide the subtree. . . .

((eq org-cycle-subtree-status 'subtree)
  (org-show-subtree)
  (org-unlogged-message "ALL")
  (setq org-cycle-subtree-status 'all))

屏幕截图——隐藏的抽屉:

https://www.lawlist.com/images/org_mode_properties_a.png


屏幕截图——抽屉可见:

https://www.lawlist.com/images/org_mode_properties_b.png

于 2013-07-05T15:50:18.520 回答
1

现在这根本不可能,至少在没有(很多?)额外编码的情况下是不可能的......

问题是:你将如何取消隐藏它?你会单独看到“……”吗?

于 2013-07-04T22:19:22.240 回答
0

这允许您切换当前所在标题的属性。

(defun org-toggle-properties ()
  ;; toggle visibility of properties in current header if it exists
  (save-excursion
    (when (not (org-at-heading-p))
      (org-previous-visible-heading 1))
    (when (org-header-property-p)
      (let* ((a (re-search-forward "\n\\:" nil t)))
        (if (outline-invisible-p (point))
            (outline-show-entry)
          (org-cycle-hide-drawers 'all))))))
于 2018-09-22T08:29:07.060 回答