[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Org Minor Mode (was Re: Low level trickery for changing character sy
Re: Org Minor Mode (was Re: Low level trickery for changing character syntax?)
Wed, 09 Apr 2014 15:01:13 +0200
Gnus/5.13001 (Ma Gnus v0.10) Emacs/24.4.50 (gnu/linux)
Thorsten Jolitz <address@hidden> writes:
> The major "flaw" of Org-mode that inhibits its use as minor-mode is
> the wide-spread use of hard-coded regexps, i.e. regexps of this form
> | "^\\*+ ... $"
> in many many variants all over the place. Those three elements "^"
> (bol), "$" (eol) and "*" (star) are not portable,
Yeah, I've quickly looked into org.el, and that's indeed very much
You could add around-advices to the basic regexp functions like
`looking-at' and `re-search-forward' that modify the given regex.
Changing "^something" to "^;; something" is easy, but if you also want
to change the outlining character from * to something else, it will
become quite hard.
Changing org.el is also quite hard. I mean, you could define
org-heading-start-rx: (concat org-prefix-rx "\\(" org-bullet-rx "\\)+")
somehow systematically so that in theory, lisp modes could set
org-prefix-rx to ";; " and be done. However, it's quite unlikely that
in the future, every quick regex in some org function will be composed
of all those predefined parts in the correct way.
Maybe a better approach was to have some `org-rx' macro that's like `rx'
except that `bol' and `line-start' would mean (concat "^" org-prefix-rx)
instead of just "^", and there was some additional `*' element that
would mean org-bullet-rx. Then the org-heading-start-rx could be
defined as (org-rx bol (group (+ *))) which is a bit less of a pain.