设置emacs打开文件默认折叠#+BEGIN_SRC


#1

使用emacs记录笔记,会将命令的输出,保存在

#+BEGIN_SRC

#+END_SRC

命令输出很长,怎么设置下次打开这个org文件, BEGIN_SRC 里面的内容是折叠的?


#2

=> search bar: emacs org babel code fold by default

=> https://www.google.com/search?q=emacs+org+babel+code+fold+by+default&oq=emacs+org+babel+code+fold+by+default&aqs=chrome..69i57j69i64l2.10877j0j7&sourceid=chrome&ie=UTF-8

=> https://emacs.stackexchange.com/questions/7211/collapse-src-blocks-in-org-mode-by-default

=> (add-hook 'org-mode-hook 'org-hide-block-all)


#3

谢谢 能不能指定类型? #+BEGIN_SRC的默认隐藏, 隐藏这个的内容 因为这个是命令的输出,

一般是不看的 但是像其他的比如说 源码或者引文 都是要一直显示的


#4

=> searech bar: org-hide-block partially OR selectively

=> https://www.google.com/search?ei=1SlQXJHTBIeh_wSbrJyQBw&q=org-hide-block+partially+OR+selectively&oq=org-hide-block+partially+OR+selectively&gs_l=psy-ab.3..33i160l2.63130.67406..67679...0.0..0.328.4228.2-7j7......0....1..gws-wiz.......0i71j33i299.9CcYc51SOqo

=> https://emacs.stackexchange.com/questions/44914/choose-individual-startup-visibility-of-org-modes-source-blocks

Indeed, some code blocks are too long and take up too much space. By default, you want to display all the code blocks, only hidden when you set a block of code to hide. Suppose there is a block of code in an org file that needs to be hidden, like:

#+BEGIN_SRC emacs-lisp :hidden
(defun individual-visibility-source-blocks ()
  "Fold some blocks in the current buffer."
  (interactive)
  (org-show-block-all)
  (org-block-map
   (lambda ()
     (let ((case-fold-search t))
       (when (and
              (save-excursion
                (beginning-of-line 1)
                (looking-at org-block-regexp))
              (cl-assoc
               ':hidden
               (cl-third
                (org-babel-get-src-block-info))))
         (org-hide-block-toggle))))))

(add-hook
 'org-mode-hook
 (function individual-visibility-source-blocks))
#+END_SRC

When the command “individual-visibility-source-blocks” is used, all code blocks are displayed except for the code block.


#5

谢谢 我消化下


#6

简而言之,添加此函数并将上面的钩子添加到您的配置中。 然后在希望在默认情况下折叠的代码块前面添加:hidden

在您的情况下,只需使用yasnippet或内置org snippet,如

#+ BEGIN_SRC $ 0(语言):hidden \ n#+ END_SRC

(边注: 我发现在这情节,下,google> yandex >> bing = baidu = duckduckgo, 最后三个(bing.com,baidu,duckduckgo)找不到任何有用的信息)


#7

安利一下最近发现的 MEZW 搜索引擎,最近发现的,个人感觉不翻墙时最好用的搜索引擎: