alphapapa / outshine

Org-mode for non-Org buffers
GNU General Public License v2.0
212 stars 23 forks source link

Document differences with outline regarding regexps #92

Open Horrih opened 2 years ago

Horrih commented 2 years ago

Hello, Description First of all thank you for your nice mode, it worked really well out of the box on my init.el

However I got bitten when trying to apply it to the same file with a .txt extension : whereas outline-minor-mode worked just the same, outshine did not. It hightlighted only the end of my headings, and cycling with tab produced an error.

Fix for the issue After reading the source code I noticed that outshine depended on the following variables. The following additions made it work (setq comment-start ";")
(setq comment-add 1)

Document the link with major modes I am not sure that this behaviour can be fixed since the dependency on major modes seems to be a feature of outshine. However to avoid users failing like me, it would be nice to add a small section about it in the Readme.md.

Even after a look to the source code I could not easily understand how the final regexps are built.

Something along the lines

Outshine and major modes

Outshine attemps to adapt automatically to the current major modes to detect comments with the appropriate parameters.
In particular, you may have to specify the following variables
(setq varX ...) ; Some useful comment
(setq varY ...) ; Some useful comment

Reproduction information My pattern was as follows ;; * Heading1 ;; ** Heading2

Function to call to reproduce the issue (defun my-elisp-outline ()
"Outline mode for elisp comments"
(interactive)
(make-local-variable 'outline-regexp)
(setq outline-regexp "^;; \*+")
(make-local-variable 'outline-heading-end-regexp)
(setq outline-heading-end-regexp "\n")
(outshine-mode))