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

微笑、不失礼 提交于 2019-12-22 05:42:07

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/6445762/lazy-loading-of-only-the-first-n-lines-in-emacs-org-mode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!