all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: Thorsten Jolitz <tjolitz@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Org Minor Mode (was Re: Low level trickery for changing character syntax?)
Date: Wed, 09 Apr 2014 15:01:13 +0200	[thread overview]
Message-ID: <87ppkq3bdy.fsf@gnu.org> (raw)
In-Reply-To: <877g6yj355.fsf_-_@gmail.com> (Thorsten Jolitz's message of "Wed,  09 Apr 2014 10:52:38 +0200")

Thorsten Jolitz <tjolitz@gmail.com> writes:

Hi Thorsten,

> 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
hard-coded.

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-prefix-rx: ""
  org-bullet-rx: "\\*"
  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.

Bye,
Tassilo



  parent reply	other threads:[~2014-04-09 13:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-08 17:00 Low level trickery for changing character syntax? Thorsten Jolitz
2014-04-08 17:06 ` Thorsten Jolitz
2014-04-08 17:49 ` Andreas Röhler
2014-04-09  0:26   ` Thorsten Jolitz
2014-04-09  5:59 ` Andreas Röhler
2014-04-09  7:44   ` Thorsten Jolitz
2014-04-09  9:56     ` Andreas Röhler
2014-04-09 12:49     ` Stefan Monnier
2014-04-09 13:12       ` Thorsten Jolitz
2014-04-09  7:09 ` Tassilo Horn
2014-04-09  8:52   ` Org Minor Mode (was Re: Low level trickery for changing character syntax?) Thorsten Jolitz
2014-04-09 12:50     ` Stefan Monnier
2014-04-09 13:01     ` Tassilo Horn [this message]
2014-04-09 13:43       ` Thorsten Jolitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ppkq3bdy.fsf@gnu.org \
    --to=tsdh@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tjolitz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.