alphapapa / alphapapa/org-sidebar
tree-sidebar: Text inserted into entries appears in sidebar
- 主要語言
- Shell
- 星號
- 558
- 分支
- 17
- PR 合併指標
- 30 天內沒有已合併 PR
描述
See https://github.com/alphapapa/org-sidebar/blob/master/notes.org#maybe-a-use-font-locking-to-hide-non-heading-text-in-tree-buffer
Here's a function that modifies the font-lock keywords to attempt this. It almost works, although it doesn't seem to take effect in an Org buffer unless I use `font-lock-studio`, then the keywords are applied again. (Even `(font-lock-flush)` doesn't seem to force it.) Also, typing more text afterward does not make the new text invisible, even though it should. So maybe this could be a starting point, but it doesn't seem as easy as I hoped, and it seems like a lot of trial-and-error is required.
```el
(defun test-font-lock-keywords ()
(setq-local argh-invisible '(face font-lock-warning-face invisible t))
(setq-local argh-visible '(face font-lock-warning-face invisible nil))
(let ((keywords (list (cons (rx bol (or blank (seq "*" (1+ (not blank)))
(not (any "*")))
(1+ not-newline) eol)
'argh-invisible)
(cons (rx bol (1+ blank) eol)
'argh-invisible)
(cons (rx bol eol)
'argh-invisible)
(cons (rx bol (1+ "*") (1+ blank) (minimal-match (1+ not-newline)) eol)
'argh-visible)
)))
(font-lock-add-keywords nil keywords 'append)
(set (make-local-variable 'font-lock-extra-managed-props)
(cons 'invisible font-lock-extra-managed-props))))
```
貢獻指南
這個儲存庫沒有索引到貢獻指南
評估
這個 Issue 還沒有評估資料。