开发者

lazy loading of only the first N lines in emacs org-mode

开发者 https://www.devze.com 2023-03-14 15:02 出处:网络
Is there a way to tell org-mode to load only the first N lines of a long text file? I would like to keep the whole file open to be able 开发者_运维问答to search through it, but have org-mode display o

Is there a way to tell org-mode to load only the first N lines of a long text file? I would like to keep the whole file open to be able 开发者_运维问答to search through it, but have org-mode display on the first N lines of my file, which is where I edit new content.


If you have a structured outline in org-mode, you can set the global file visibility with the #+STARTUP markup, or the visibility of any heading with the VISIBILITY property, see Visibility Cycling for details. The benefit of using the built-in org-mode properties is that it's easy to have a file open up in exactly the state you want.

I have my journal file set up to accomplish something similar what I think you're asking for using these org-mode properties. The "Today" section is opened so I can see everything, but older archives are collapsed.


I'm not sure the title really fits the description?

I think you just want use buffer narrowing, which lets you hide everything outside of the specified region for as long as necessary.

You can manually narrow the buffer by marking the region and typing C-xnn

Widen the display back to the full buffer with C-xnw

I guess you could use an eval Local Variable to automate this to a pre-defined region, if you really wanted to.

There's also narrow-to-defun (C-xnd) and narrow-to-page (C-xnp). If you throw a page break into your org file (C-qC-l), the latter might prove handy.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号