From mboxrd@z Thu Jan 1 00:00:00 1970 From: Federico Beffa Subject: [PATCH] org.el: make org-paragraph-fill ignore \[...\] regions starting and ending a line Date: Tue, 5 Aug 2014 23:45:03 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=001a11345d66a72eb004ffe8c47c Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEmXa-0001Bi-Op for emacs-orgmode@gnu.org; Tue, 05 Aug 2014 17:45:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEmXZ-0004BB-Sj for emacs-orgmode@gnu.org; Tue, 05 Aug 2014 17:45:06 -0400 Received: from mail-la0-x22f.google.com ([2a00:1450:4010:c03::22f]:42500) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEmXZ-00044m-G6 for emacs-orgmode@gnu.org; Tue, 05 Aug 2014 17:45:05 -0400 Received: by mail-la0-f47.google.com with SMTP id mc6so1226443lab.20 for ; Tue, 05 Aug 2014 14:45:03 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: rasmus@gmx.us, emacs-orgmode@gnu.org --001a11345d66a72eb004ffe8c47c Content-Type: text/plain; charset=UTF-8 >>> The current proposal is to make them elements instead of objects in Org >>> syntax (i.e, a `latex-environment' instead of a `latex-fragment'). In >>> a nutshell: >>> >>> - Pros: >>> + conform to LaTeX intent, >>> + impossible to fill. >>> - Cons: >>> - documents containing \[...\] mid-line will be broken (such >>> constructs will not be recognized anymore). ... > If this is always the case for you, you can "fix" this behavior by > always putting it in a new paragraph and using a filter. OK, I understand that the Cons above is a serious issue and nobody wants it. For this reason I went back to my original idea and modified the `org-fill-paragraph' function. This provides the two Pros above without having to introduce the undesired Cons. The behavior is a follows: - if \[...\] is inline, behave as before. - if \[ is the first non space character of a line and the closing \] is the last non space character of a line (possibly spanning several lines), then do not fill this region of the paragraph. Attached you find a patch with the proposed modification. I would greatly appreciate if you could consider it for inclusion in org-mode and provide feedback. I understand that if you are willing to make use of this patch, I will have to sign a copyright assignment form. This is not a problem, but please do not make me waste time with forms if you do not want to include the patch in org-mode. Please provide instructions on how to proceed. Regards, Federico. --001a11345d66a72eb004ffe8c47c Content-Type: application/octet-stream; name="0001-org.el-make-org-paragraph-fill-ignore-.-regions-star.patch" Content-Disposition: attachment; filename="0001-org.el-make-org-paragraph-fill-ignore-.-regions-star.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hyhr2m9y0 RnJvbSAxM2YyYjAxZTJjN2IyZGM3ZDExYzdjOTA2NDBkMDc1ZjAyZmNjNmMzIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBGZWRlcmljbyBCZWZmYSA8YmVmZmFAZmJlbmdpbmVlcmluZy5j aD4KRGF0ZTogVHVlLCA1IEF1ZyAyMDE0IDIzOjA4OjI2ICswMjAwClN1YmplY3Q6IFtQQVRDSF0g b3JnLmVsOiBtYWtlIG9yZy1wYXJhZ3JhcGgtZmlsbCBpZ25vcmUgXFsuLi5cXSByZWdpb25zCiBz dGFydGluZyBhbmQgZW5kaW5nIGEgbGluZQoKKiBsaXNwL29yZy5lbCAob3JnLXBhcmFncmFwaC1m aWxsKTogSWYgYSBMYVRlWCBcWy4uLlxdIG1hY3JvIHN0YXJ0cwphIGxpbmUgYW5kIGVuZHMgYSBs aW5lIChwb3NzaWJseSBzcGFubmluZyBtdWx0aXBsZSBsaW5lcyksIHRoZW4gZG8gbm90CmNoYW5n ZSB0aGF0IHBhcnQgb2YgdGhlIHBhcmFncmFwaC4KLS0tCiBsaXNwL29yZy5lbCB8ICAxMjggKysr KysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrK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