From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Unable to retrieve :parameters for src-block [org-element] Date: Tue, 17 Oct 2017 12:51:22 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a114d7266309722055bbd95f7" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48610) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4RLL-0005DQ-LL for emacs-orgmode@gnu.org; Tue, 17 Oct 2017 08:51:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4RLK-0000hd-Mu for emacs-orgmode@gnu.org; Tue, 17 Oct 2017 08:51:35 -0400 Received: from mail-qt0-x229.google.com ([2607:f8b0:400d:c0d::229]:45109) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e4RLK-0000hI-Gd for emacs-orgmode@gnu.org; Tue, 17 Oct 2017 08:51:34 -0400 Received: by mail-qt0-x229.google.com with SMTP id p1so3196807qtg.2 for ; Tue, 17 Oct 2017 05:51:34 -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" To: emacs-org list --001a114d7266309722055bbd95f7 Content-Type: text/plain; charset="UTF-8" Hello, I am using the latest Org master. I am trying to retrieving user-set parameters for a source block. While I am able to retrieve the :switches property for the src-block element, :parameters always returns as nil. Here's a dummy version of the function I am using to parse source blocks in my custom exporter: ===== (defun org-hugo-src-block (src-block _contents info) (let ((lang (org-element-property :language src-block)) ;; See `org-element-src-block-parser' for all SRC-BLOCK properties. (switches (org-element-property :switches src-block)) (parameters (org-element-property :parameters src-block)) (number-lines (org-element-property :number-lines src-block))) ;Non-nil if -n or +n switch is used (message "ox-hugo src [dbg] number-lines: %S" number-lines) (message "ox-hugo src [dbg] switches: %S" switches) (message "ox-hugo src [dbg] parameters: %S" parameters))) ===== Here is the test Org snippet: ===== #+BEGIN_SRC emacs-lisp -n :hl 1,3-4 :eval no (message "This is line 1") (message "This is line 2") (message "This is line 3") (message "This is line 4") (message "This is line 5") #+END_SRC ===== (:hl 1,3-4 is something special that ox-hugo will handle.) But on exporting that Org snippet, I get: ===== ox-hugo src [dbg] number-lines: (new . 0) ox-hugo src [dbg] switches: "-n" ox-hugo src [dbg] parameters: nil ===== If I put a debug statement directly in org-element-src-block-parser towards the end: ===== ;; SNIP (message "dbg: parameters: %s" parameters) (list 'src-block (nconc (list :language language ;; SNIP ===== I get these in the *Messages*: ===== dbg: parameters: :hl 1,3-4 :eval no [3 times] ===== So it is clear that the parameters are read inside org-element-src-block-parser, but I don't understand why (org-element-property :parameters src-block) is unable to fetch the same. Hints? -- Kaushal Modi --001a114d7266309722055bbd95f7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

I am using the latest Org master= .

I am trying to retrieving user-set parameters fo= r a source block. While I am able to retrieve the :switches property for th= e src-block element, :parameters always returns as nil.

Here's a dummy version of the function I am using to parse source= blocks in my custom exporter:

=3D=3D=3D=3D=3D
(defun org-hugo-src-block (src-block _contents info)
= =C2=A0 (let ((lang (org-element-property :language src-block))
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; See `org-element-src-block-parser' for a= ll SRC-BLOCK properties.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (switches (o= rg-element-property :switches src-block))
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 (parameters (org-element-property :parameters src-block))
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 (number-lines (org-element-property :number-lin= es src-block))) ;Non-nil if -n or +n switch is used
=C2=A0 =C2=A0= (message "ox-hugo src [dbg] number-lines: %S" number-lines)
=C2=A0 =C2=A0 (message "ox-hugo src [dbg] switches: %S" swi= tches)
=C2=A0 =C2=A0 (message "ox-hugo src [dbg] parameters:= %S" parameters)))
=3D=3D=3D=3D=3D=C2=A0 =C2=A0=C2=A0
<= /div>

Here is the test Org snippet:

=
=3D=3D=3D=3D=3D
#+BEGIN_SRC emacs-lisp -n :hl 1,3-4 :ev= al no
(message "This is line 1")
(message &qu= ot;This is line 2")
(message "This is line 3")
(message "This is line 4")
(message "This i= s line 5")
#+END_SRC
=3D=3D=3D=3D=3D

(:hl 1,3-4 is something special that ox-hugo will handle.= )

But on exporting that Org snippet, I get:
<= div>
=3D=3D=3D=3D=3D
ox-hugo src [dbg] number-= lines: (new . 0)
ox-hugo src [dbg] switches: "-n"
=
ox-hugo src [dbg] parameters: nil
=3D=3D=3D=3D=3D

If I put a debug statement directly in=C2=A0org-elemen= t-src-block-parser towards the end:

=3D=3D=3D=3D= =3D
;; SNIP
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (message "dbg: parameters: %s" parameters)
=C2=A0 =C2=A0 (list 'src-block
=C2=A0 (nconc
=C2=A0 =C2=A0(list :language language
;; SNIP
=3D=3D=3D=3D=3D

I ge= t these in the *Messages*:

=3D=3D=3D=3D=3D
dbg: parameters:=C2=A0 :hl 1,3-4 :eval no [3 times]
=3D=3D=3D=3D=3D

So it is clear that the parameter= s are read inside org-element-src-block-parser, but I don't understand = why (org-element-property :parameters src-block) is unable to fetch the sam= e.

Hints?
--

Kaushal Modi

--001a114d7266309722055bbd95f7--