From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Faces bug in org-indent-mode Date: Tue, 25 Aug 2009 09:56:07 +0200 Message-ID: <9D4BBA1C-659F-4E2F-83FC-E31D2F350CCE@gmail.com> References: <871vn6y5gy.fsf@CPU107.opentrends.net> <54F61D36-7A75-42B6-9AE5-FCDE2F373F4F@gmail.com> <87prapwhse.fsf@CPU107.opentrends.net> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=WINDOWS-1252; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mfqt9-0005xb-Jc for emacs-orgmode@gnu.org; Tue, 25 Aug 2009 03:56:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mfqt4-0005vt-C5 for emacs-orgmode@gnu.org; Tue, 25 Aug 2009 03:56:18 -0400 Received: from [199.232.76.173] (port=56238 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mfqt3-0005vh-Vp for emacs-orgmode@gnu.org; Tue, 25 Aug 2009 03:56:14 -0400 Received: from mail-ew0-f211.google.com ([209.85.219.211]:44871) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mfqt3-0000cX-Bl for emacs-orgmode@gnu.org; Tue, 25 Aug 2009 03:56:13 -0400 Received: by ewy7 with SMTP id 7so3077323ewy.31 for ; Tue, 25 Aug 2009 00:56:12 -0700 (PDT) In-Reply-To: <87prapwhse.fsf@CPU107.opentrends.net> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Daniel Clemente Cc: org-mode list Hi Daniel, thanks for looking deeper into the issue. As you have noticed yourself, your proposal fixes only half of the problem. Doing this emphasis with a regular expression is really hard, and each time you change something, another thing will break. The real solution for this would be to switch to a programmed solution instead of a regular expression search. Your proposed change does fix a problem, but it also breaks the structure of how the emphasis regexp is constructed. BODY is supposed to match a character that should be emphasized. Maybe it can be re-written so that this does not have to be part of the BODY. Also, there are similar issues with this in tables: Try | *h | h | | h | h* | or also with comments: Some text *h mamma mia # terminate bold in comment* So I will out this on the back burner and try to get myself to implement programmed emphasis at some point. Sorry. - Carsten On Aug 21, 2009, at 1:03 PM, Daniel Clemente wrote: > El dj, ago 20 2009 a les 21:57, Carsten Dominik va escriure: >>> >>> * something >>> aaa =3Deee >>> * two=3D *iii >>> ooo* uuu >>> >> Yes, this is kind of hard to fix...... And a minor issue, I =20 >> guess... ? >> > > Yes, it's a minor issue. I like minor issues :-) > > There are two display problems here: > - a face defined before a heading enters the heading (like the =3Deee=85= =3D) > - a face defined in a heading goes on past the heading (like the =20 > *iii=85) > > I did some tests with org-emph-re (original value: [1]); the =20 > interesting part is \\(?:\n.*?\\)\\{0,1\\} because it is the one =20 > that allows the face to extend up to 1 line below. > The .*? from there comes from the so-called body in org-emphasis-=20 > regexp-components, body=3D"." > I have done some tests and I think that body=3D"\\(?:\\*+[^\n ]\\|[^=20= > \n*]\\)." fixes the first problem. The expression represents a non-=20 > heading line: anything not starting by * (except when the initial * =20= > precedes a word) and then many other characters (a "*?" at the end =20 > will be added by org-set-emph-re) > Final value: [2] > > Is this added complexity worth it? The bug is unpleasant (headings =20= > aren't coloured as headings) and performance shouldn't be much =20 > affected in the common case because ^\\* fails early. Only visually =20= > it is a complex regexp. > > I don't know how to detect the other problem inside a regular =20 > expression. Maybe there's some way to ask =84don't cross boundaries =20= > between headings and content=93. > > > -- Daniel > > [1]: "\\([ ('`\"{]\\|^\\)\\(\\([*/_=3D~+]\\)\\([^ =09 > \n,\"']\\|[^ =09 > \n,\"'].*?\\(?:\n.*?\\)\\{0,1\\}[^ =09 > \n,\"']\\)\\3\\)\\([- .,:!?;'\")}\\]\\|$\\)" > > [2]: "\\([ ('`\"{]\\|^\\)\\(\\([*/_=3D~+]\\)\\([^ =09 > \n,\"']\\|[^ =09 > \n,\"'].*?\\(?:\n\\*+[^\n ].*?\\|\n[^\n*].*?\\)\\{0,1\\}[^ =09 > \n,\"']\\)\\3\\)\\([- .,:!?;'\")}\\]\\|$\\)" > >