The length of the matching text determines the level of the heading; longer matches make a more deeply nested level. Thus, for example, if a text formatter has commands ‘chapter’, ‘section’ and ‘subsection’ to divide the document into chapters and sections, you could make those lines count as heading lines by setting outline-regexp to ‘“chap\|\(sub\)*section”’. Note the trick: the two words ‘chapter’ and ‘section’ are equally long, but by defining the regexp to match only ‘chap’ we ensure that the length of the text matched on a chapter heading is shorter, so that Outline mode will know that sections are contained in chapters. This works as long as no other command starts with ‘chap’.

在elisp-mode中,对应的outline-regexp;;;\\(;* [^\n]\\|###autoload\\)\\|(,这个regexp匹配到;;; 的长度会长于匹配到的(,所以按道理,在elisp中,应该是以(开始的函数标题层次会比以;;;开始的注释层次高,也就是说以;;;开始的标题应该是以(开始的标题的子标题。