emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: Nicolas Goaziou <n.goaziou@gmail.com>
Cc: Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: [RFC] Alternative to sub/superscript regexp
Date: Tue, 26 Nov 2013 10:20:20 +0100	[thread overview]
Message-ID: <7CF22FEC-70F1-46A5-BDE0-A07832F9EDAF@gmail.com> (raw)
In-Reply-To: <87wqjw8kuk.fsf@gmail.com>

Hi Nicolas,

I have tested this a bit, and it does pretty much what I want.
Just to be sure:  We will also support expressions with braces, right?

- Carsten

On Nov 25, 2013, at 6:14 PM, Nicolas Goaziou <n.goaziou@gmail.com> wrote:

> Hello,
> 
> For the record `org-match-substring-regexp' is a variation on:
> 
> "\\(\\S-\\)\\([_^]\\)\\(\\(?:\\*\\|[-+]?[^-+*!@#$%^_ \t\r\n,:\"?<>~;./{}=()]+\\)\\)\\)"
> 
> I think it is a bit convoluted and therefore difficult to predict. For
> example, as recent bug report showed, you may tend to interpret
> a_b[fn:1] as
> 
>   a_{b}[fn:1]
> 
> but, in fact, it is equivalent to
> 
>   a_{b[fn}:1]
> 
> Of course, we can prevent this by forbidding "[" and "]" in the last
> part of the regexp. But I wonder if there's something better to do.
> 
> The idea behind this regexp is that we should be able to write simple
> sub/superscript, including numbers and entities, without requiring curly
> braces (see `org-use-sub-superscripts' docstring for details). Maybe
> something like the following could be an interesting alternative:
> 
>  "\\(\\S-\\)\\([_^]\\)\\(\\*\\|[+-]?\\(?:\\w\\|[0-9.,\\]\\)*\\(\\w\\|[0-9]\\)\\)"
> 
> That is, without braces, either an asterisk or any combination of word,
> number, dot, comma and backslash characters, which may start with either
> a plus or a minus sign but cannot end with either a dot or a comma.
> 
> I find it arguably more predictable (no inverted class). Also, we "gain"
> the following:
> 
>  a^3.14. <=> a^{3.14}.
> 
> At the moment, a^3.14. <=> a^{3}.14.
> 
> What do you think?
> 
> 
> Regards,
> 
> -- 
> Nicolas Goaziou
> 

  parent reply	other threads:[~2013-11-26  9:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-25 17:14 [RFC] Alternative to sub/superscript regexp Nicolas Goaziou
2013-11-25 17:45 ` Nick Dokos
2013-11-25 21:53 ` Rasmus
2013-11-26  9:20 ` Carsten Dominik [this message]
2013-11-26 16:46   ` Nicolas Goaziou
2013-12-18 22:13     ` Nicolas Goaziou
2014-01-11 23:18       ` Nicolas Goaziou

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=7CF22FEC-70F1-46A5-BDE0-A07832F9EDAF@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=n.goaziou@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).