From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: Unable to retrieve :parameters for src-block [org-element] Date: Tue, 17 Oct 2017 15:45:59 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c1b86129fac25055bc0053d" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4U4P-0002Nk-2f for emacs-orgmode@gnu.org; Tue, 17 Oct 2017 11:46:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4U4J-0002GD-3j for emacs-orgmode@gnu.org; Tue, 17 Oct 2017 11:46:17 -0400 Received: from mail-qt0-x233.google.com ([2607:f8b0:400d:c0d::233]:51122) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e4U4I-0002Fp-VN for emacs-orgmode@gnu.org; Tue, 17 Oct 2017 11:46:11 -0400 Received: by mail-qt0-x233.google.com with SMTP id f15so4472350qtf.7 for ; Tue, 17 Oct 2017 08:46:10 -0700 (PDT) In-Reply-To: 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 --94eb2c1b86129fac25055bc0053d Content-Type: text/plain; charset="UTF-8" On Tue, Oct 17, 2017 at 8:51 AM Kaushal Modi wrote: > 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 comprehensive/literate version (Org file) of the same test case.. requires only ox-ascii. ===== #+TITLE: Org Element :parameters parsing issue * Activating debug 1. Hit =C-c C-c= on the below block, and allow its evaluation. #+BEGIN_SRC emacs-lisp -n :eval no-export :results output silent (defun debug/org-ascii-src-block (orig-fun &rest args) "Print few debug messages before executing `org-ascii-src-block'." (let* ((src-block (car args)) (switches (org-element-property :switches src-block)) (parameters (org-element-property :parameters src-block)) (number-lines (org-element-property :number-lines src-block))) (message "[src-block dbg] number-lines: %S" number-lines) (message "[src-block dbg] switches: %S" switches) (message "[src-block dbg] parameters: %S" parameters)) (apply orig-fun args)) (advice-add 'org-ascii-src-block :around #'debug/org-ascii-src-block) #+END_SRC 2. Do =C-c C-e t A= to export this file using Ascii backend, to a buffer. /We do not need to see the exported file, just the messages output by debug messages in above code snippet. * Deactivating debug Evaluate the below (and allow that evaluation) to deactivate these debug messages. #+BEGIN_SRC emacs-lisp :eval no-export :results output silent (advice-remove 'org-ascii-src-block #'debug/org-ascii-src-block) #+END_SRC ===== After following the 2 steps in the "Activating debug" section, you will find this in *Messages* buffer: [src-block dbg] number-lines: (new . 0) [src-block dbg] switches: "-n" [src-block dbg] parameters: nil [src-block dbg] number-lines: nil [src-block dbg] switches: nil [src-block dbg] parameters: nil (First 3 messages are for the first code block, and the next 3 messages for the second code block.) Why is parameters always nil? -- Kaushal Modi --94eb2c1b86129fac25055bc0053d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, Oct 17= , 2017 at 8:51 AM Kaushal Modi <kaushal.modi@gmail.com> wrote:
Hello,

I am using the latest Org m= aster.

I am trying to retrieving user-set paramete= rs for a source block. While I am able to retrieve the :switches property f= or the src-block element, :parameters always returns as nil.

Here's a comprehensive/literate version (= Org file) of the same test case.. requires only ox-ascii.

=3D=3D=3D=3D=3D
#+TITLE: Org Element :parameters parsing = issue
* Activating debug
1. Hit =3DC-c C-c=3D on the be= low block, and allow its evaluation.
=C2=A0 =C2=A0#+BEGIN_SRC ema= cs-lisp -n :eval no-export :results output silent
=C2=A0 =C2=A0(d= efun debug/org-ascii-src-block (orig-fun &rest args)
=C2=A0 = =C2=A0 =C2=A0"Print few debug messages before executing `org-ascii-src= -block'."
=C2=A0 =C2=A0 =C2=A0(let* ((src-block (car arg= s))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (switches (org-elem= ent-property :switches src-block))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 (parameters (org-element-property :parameters src-block))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (number-lines (org-element= -property :number-lines src-block)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0(= message "[src-block dbg] number-lines: %S" number-lines)
=C2=A0 =C2=A0 =C2=A0 =C2=A0(message "[src-block dbg] switches: %S&qu= ot; switches)
=C2=A0 =C2=A0 =C2=A0 =C2=A0(message "[src-bloc= k dbg] parameters: %S" parameters))
=C2=A0 =C2=A0 =C2=A0(app= ly orig-fun args))
=C2=A0 =C2=A0(advice-add 'org-ascii-src-bl= ock :around #'debug/org-ascii-src-block)
=C2=A0 =C2=A0#+END_S= RC
2. Do =3DC-c C-e t A=3D to export this file using Ascii backen= d, to a buffer. /We do
=C2=A0 =C2=A0not need to see the exported = file, just the messages output by debug messages
=C2=A0 =C2=A0in = above code snippet.
* Deactivating debug
Evaluate the b= elow (and allow that evaluation) to deactivate these debug
messag= es.
#+BEGIN_SRC emacs-lisp :eval no-export :results output silent=
(advice-remove 'org-ascii-src-block #'debug/org-ascii-sr= c-block)
#+END_SRC
=3D=3D=3D=3D=3D=C2=A0
=
After following the 2 steps in the "Activating debug&qu= ot; section, you will find this in *Messages* buffer:

<= div>
[src-block dbg] number-lines: (new . 0)
[src-block dbg] = switches: "-n"
[src-block dbg] parameters: nil
[src-block dbg] number-lines: nil
[src-block dbg] switches: nil=
[src-block dbg] parameters: nil

(= First 3 messages are for the first code block, and the next 3 messages for = the second code block.)

Why is parameters always n= il?
--

Kaushal Modi

--94eb2c1b86129fac25055bc0053d--