From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [RFC] [PATCH] [parser] org-element.el: Handle block parameters Date: Tue, 29 Oct 2013 09:20:21 +0100 Message-ID: <878uxca3p6.fsf@gmail.com> References: <1382987074-19223-1-git-send-email-aaronecay@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vb4X3-0004mH-Gg for emacs-orgmode@gnu.org; Tue, 29 Oct 2013 04:20:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vb4Wx-0001D6-PC for emacs-orgmode@gnu.org; Tue, 29 Oct 2013 04:20:09 -0400 Received: from mail-wi0-x22d.google.com ([2a00:1450:400c:c05::22d]:61401) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vb4Wx-000184-HX for emacs-orgmode@gnu.org; Tue, 29 Oct 2013 04:20:03 -0400 Received: by mail-wi0-f173.google.com with SMTP id ey11so4777199wid.12 for ; Tue, 29 Oct 2013 01:20:02 -0700 (PDT) In-Reply-To: <1382987074-19223-1-git-send-email-aaronecay@gmail.com> (Aaron Ecay's message of "Mon, 28 Oct 2013 15:04:34 -0400") 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: Aaron Ecay Cc: emacs-orgmode@gnu.org Hello, Aaron Ecay writes: Thanks for the patch. > This brings the parser in line with the Org Syntax as documented on > Worg: . Besides this reason (which could also be solved by updating Org Syntax document), do you have a need for this extension? > This does not handle paramters for export blocks (#+begin_latex et > al.) or comment blocks, but these would be trivial to add if needed. Syntax for parameters is different for these blocks, and is already handled. Now some comments about the code. > + (params (progn (looking-at "[ \t]*#\\+BEGIN_CENTER\\(?: +\\(.*\\)\\)?") I suggest changing the regexp into "[ \t]*#\\+BEGIN_CENTER\\(?: +\\(.*\\)[ \t]*\\)?" in order to trim parameters, if any. > + (match-string 1))) It's better to use `org-match-string-no-properties' since you don't need properties. > + (format "#+BEGIN_CENTER%s\n%s#+END_CENTER" > + (if (org-element-property :parameters center-block) > + (concat " " (org-element-property :parameters center-block)) > + "") > + contents)) A `let' would be nicer. (let ((parameters (org-element-property :parameters center-block))) (if parameters (concat " " parameters) "")) > + (params (progn (looking-at "[ \t]*#\\+BEGIN_QUOTE\\(?: +\\(.*\\)\\)?") > + (match-string 1))) Ditto. > + (format "#+BEGIN_QUOTE%s\n%s#+END_QUOTE" > + (if (org-element-property :parameters quote-block) > + (concat " " (org-element-property :parameters quote-block)) > + "") Ditto > + (type (progn (looking-at "[ \t]*#\\+BEGIN_\\(\\S-+\\)\\(?: +\\(.*\\)\\)?") > + (upcase (match-string-no-properties 1)))) Ditto. > + (params (match-string-no-properties 2))) Use `org-match-string-no-properties' here, for compatibility with XEmacs. > + (format "#+BEGIN_%s%s\n%s#+END_%s" > + block-type > + (if (org-element-property :parameters special-block) > + (concat " " (org-element-property :parameters special-block)) > + "") See above. > + (params (progn (looking-at "[ \t]*#\\+BEGIN_VERSE\\(?: +\\(.*\\)\\)?") > + (match-string 1))) See above. > + (format "#+BEGIN_VERSE%s\n%s#+END_VERSE" > + (if (org-element-property :parameters verse-block) > + (concat " " (org-element-property :parameters verse-block)) > + "") See above. Regards, -- Nicolas Goaziou