emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [RFC] Alternative to sub/superscript regexp
@ 2013-11-25 17:14 Nicolas Goaziou
  2013-11-25 17:45 ` Nick Dokos
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2013-11-25 17:14 UTC (permalink / raw)
  To: Org Mode List

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-01-11 23:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2013-11-26 16:46   ` Nicolas Goaziou
2013-12-18 22:13     ` Nicolas Goaziou
2014-01-11 23:18       ` Nicolas Goaziou

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).