[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Unable to retrieve :parameters for src-block [org-element]

From: Kaushal Modi
Subject: Re: [O] Unable to retrieve :parameters for src-block [org-element]
Date: Tue, 17 Oct 2017 15:45:59 +0000

On Tue, Oct 17, 2017 at 8:51 AM Kaushal Modi <address@hidden> wrote:

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)
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
#+BEGIN_SRC emacs-lisp :eval no-export :results output silent
(advice-remove 'org-ascii-src-block #'debug/org-ascii-src-block)

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]