Hi Nicolas and all, @Nicolas: Thanks for org-num-mode.
> A few weeks ago, I posted on this ML a proof of concept about dynamic > numbering of headlines in an Org buffer. Since then, I worked on it more > seriously, improved it, and threw in some features. Here is an excerpt > of its commentary section: > > This library provides dynamic numbering for Org headlines. Use > > <M-x org-num-mode> > > to toggle it. > > You can select what is numbered according to level, tags, COMMENT > keyword, or UNNUMBERED property. You can also skip footnotes > sections. See `org-num-max-level', `org-num-skip-tags', > `org-num-skip-commented', `org-num-skip-unnumbered', and > `org-skip-footnotes' for details. > > You can also control how the numbering is displayed by setting > `org-num-face' and `org-num-format-function'. > > I tested it a bit, even in relatively large documents like the Org > manual, without problem. I also wrote a test suite for that library. > > Since it is very much Org-specific, and a basic feature you could expect > from Org, I'd like to add it in core. So, if there is no strong > objection to it, it can go in Org 9.3. > > I attach the library for further testing, suggestions, remarks… Let me > know what you think. For some days I turned on org-num-mode for every Org file automatically with the setting (add-hook 'org-mode-hook #'org-num-mode) in my init file. org-num-mode worked fine for me. Just one idea came to my mind. What about adding an option to restart the numbering at 1 for the first heading in the case when narrowing is in effect? Ciao, Marco