From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Should comments break paragraphs? Date: Wed, 17 Jul 2013 15:47:13 +0200 Message-ID: <87ehaxjo2m.fsf@gmail.com> References: <51E443F6.2050104@arfer.net> <87mwpnfybn.fsf@gmail.com> <51E47BC1.7010808@gmail.com> <87ip0byoqg.fsf@gmail.com> <87fvvev771.fsf@gmail.com> <87wqoqxznb.fsf@gmail.com> <87ppuitp8y.fsf@gmail.com> <87sizexuj9.fsf@gmail.com> <87li55lpqd.fsf@bzg.ath.cx> <87mwplk645.fsf@gmail.com> <87fvvdk3es.fsf@bzg.ath.cx> <87ip09k1d4.fsf@gmail.com> <878v15jqdy.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40054) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzS4M-0000t9-FZ for emacs-orgmode@gnu.org; Wed, 17 Jul 2013 09:47:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UzS4L-0004PB-5E for emacs-orgmode@gnu.org; Wed, 17 Jul 2013 09:47:02 -0400 In-Reply-To: <878v15jqdy.fsf@bzg.ath.cx> (Bastien's message of "Wed, 17 Jul 2013 14:57:13 +0200") 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: Bastien Cc: Christian Wittern , emacs-orgmode@gnu.org, Eric Schulte Bastien writes: > Nicolas Goaziou writes: >> And the direction is wrong... Parsing shouldn't modify the buffer being >> parsed, ever. But you can use a hook for that purpose. > > I didn't suggest that parsing should modify the before: I said "where > comments are deleted before parsing and exporting". > > There should be an easy solution for that. Yes, a hook, as I suggested: (defun my-comment-removal (backend) (delete-matching-lines "^[ \t]*#\\( \\|$\\)")) (add-hook 'org-export-before-parsing-hook 'my-comment-removal) I maintain it is dangerous to make it a default (or even make it easier than that) because it will cause a discrepancy between the real buffer contents and what is really parsed. It can create strange things, really. > I didn't suggest to redefine comments. Of course you did. You said comments should be available anywhere but in source blocks, didn't you? It isn't possible without redefining them in Org. >> You have to change every part of Org that >> assumes there will be no comment in its way (lists, agenda, babel, >> parser and probably more I can't think of). >> >> If it's an HTML/ODT export issue, it's far easier to patch the export >> back-ends instead. 10 lines of code in each one, maybe. > > This is a general pre-export issue, it does not depend on the > exporters themselves. What you want here is to give comments a special meaning just before export, even though they don't have it otherwise. As an example, you can remove the comment here just before export: text # comment text but `org-element-at-point' will still see two paragraphs and a comment between them nonetheless. But, IIUC, the problem the OP wants to solve is different: he wants the example above to be treated as a paragraph, not as two of them. In fact this is more about paragraphs than comments (i.e. paragraphs definition in targeted back-ends is different than Org's). > So again, what prevents us to make it easy for users to treat comments > as no-line before parsing and exporting? It is already easy, see hook above. Nothing prevents you from making it easier. But this is wrong. Regards, -- Nicolas Goaziou