emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: emacs-org list <emacs-orgmode@gnu.org>
Subject: Re: Unable to retrieve :parameters for src-block [org-element]
Date: Tue, 17 Oct 2017 15:45:59 +0000	[thread overview]
Message-ID: <CAFyQvY2JOUH+OesTjWCkyk-=Wj0pnQucbkhmwxs8qqt9psMKZQ@mail.gmail.com> (raw)
In-Reply-To: <CAFyQvY17+XnrFvuq05NzCc5FPnJxnOBEjXkAia=c9fv0qHNPbA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2182 bytes --]

On Tue, Oct 17, 2017 at 8:51 AM Kaushal Modi <kaushal.modi@gmail.com> 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

[-- Attachment #2: Type: text/html, Size: 3197 bytes --]

  reply	other threads:[~2017-10-17 15:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-17 12:51 Unable to retrieve :parameters for src-block [org-element] Kaushal Modi
2017-10-17 15:45 ` Kaushal Modi [this message]
2017-10-17 16:31 ` Berry, Charles
2017-10-17 17:22   ` Kaushal Modi
2017-10-17 21:39     ` Berry, Charles
2017-10-18 21:20       ` Kaushal Modi
2017-10-18 23:19         ` Kaushal Modi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFyQvY2JOUH+OesTjWCkyk-=Wj0pnQucbkhmwxs8qqt9psMKZQ@mail.gmail.com' \
    --to=kaushal.modi@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).