* Possible regexp bug in org.el
@ 2014-04-01 9:46 Thorsten Jolitz
2014-04-01 10:16 ` Nicolas Richard
0 siblings, 1 reply; 3+ messages in thread
From: Thorsten Jolitz @ 2014-04-01 9:46 UTC (permalink / raw)
To: emacs-orgmode
Hi List,
here is a possible regexp bug in org.el I discovered by accident:
,---------------------------------------------
| 7734: (and (not (looking-back "^\*+"))
`---------------------------------------------
#+begin_src emacs-lisp
(and (not (looking-back "^\*+")) ; missing backslash?
(looking-at "[ \t]+") (replace-match ""))
(unless (eobp) (forward-char 1))
(when (looking-at "^\\*")
#+end_src
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Possible regexp bug in org.el
2014-04-01 9:46 Possible regexp bug in org.el Thorsten Jolitz
@ 2014-04-01 10:16 ` Nicolas Richard
2014-04-16 16:28 ` Bastien
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Richard @ 2014-04-01 10:16 UTC (permalink / raw)
To: Thorsten Jolitz; +Cc: emacs-orgmode
Thorsten Jolitz <tjolitz@gmail.com> writes:
> here is a possible regexp bug in org.el I discovered by accident:
>
> ,---------------------------------------------
> | 7734: (and (not (looking-back "^\*+"))
> `---------------------------------------------
It's almost certainly a typo, but it introduces no bug because '*' can't
bear its special meaning after '^', so the regexp engine will make it
match exactly the '*' character. But it'd be better written as "^*+"
(but this is not recommended) or, preferably, "^\\*+" indeed.
Here's the relevant manual excerpt from (info "(elisp) Regexp Special") :
> *Please note:* For historical compatibility, special characters are
> treated as ordinary ones if they are in contexts where their special
> meanings make no sense. For example, `*foo' treats `*' as ordinary
> since there is no preceding expression on which the `*' can act. It is
> poor practice to depend on this behavior; quote the special character
> anyway, regardless of where it appears.
--
Nico.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Possible regexp bug in org.el
2014-04-01 10:16 ` Nicolas Richard
@ 2014-04-16 16:28 ` Bastien
0 siblings, 0 replies; 3+ messages in thread
From: Bastien @ 2014-04-16 16:28 UTC (permalink / raw)
To: Nicolas Richard; +Cc: emacs-orgmode, Thorsten Jolitz
Hi Thorsten and Nicolas,
Nicolas Richard <theonewiththeevillook@yahoo.fr> writes:
> It's almost certainly a typo, but it introduces no bug because '*' can't
> bear its special meaning after '^', so the regexp engine will make it
> match exactly the '*' character. But it'd be better written as "^*+"
> (but this is not recommended) or, preferably, "^\\*+" indeed.
Fixed in master, thanks,
--
Bastien
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-04-16 16:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-01 9:46 Possible regexp bug in org.el Thorsten Jolitz
2014-04-01 10:16 ` Nicolas Richard
2014-04-16 16:28 ` Bastien
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).