(defun ecli-metadata-single (ecli meta)
  "meta needs to be quotes \n example: (case-metadata ECLI:NL:HR:2013:BY6108 'identifier)"
  (interactive "sEnter ecli: \nxEnter identifier: ")
  (insert (car (cddr (assoc  meta (ecli-metadata-full ecli)))))

(ecli-metadata-single "ECLI:NL:HR:2007:BA2511" 'date)

What this code does is getting some metadata from a remote xml-file. The code seems to work fine when I use just type the expression, however, the interactive version does not insert the data, instead throwing an error saying

wrong type argument: char-or-string-p, nil.

I have looked up (interactive) in C-h f, and tried many of the alternative characters for input. However, I still get the same (non-)result. After browsing stack-overflow and not finding a suitable answer, I 'gave up' and decided to ask this question.

To recap:

My goal is to make the above function interactively insert data. The first argument is an identifier-code, and the second argument is the data I want from the retrieved xml (other code not shown due to length). The first argument is a string "ECLI:NL:HR:2013:BY6108", and the second argument is a quoted item 'date.

A second question would be how I can remove the required quote from the input-arguments. I have tried something like (quote meta), but that did not work.

  • Please indicate your interactions - what you type, what you see, etc.
    – Drew
    Commented Mar 2, 2015 at 16:09

1 Answer 1


When you invoke the command interactively, are you typing 'date at the prompt, or just date? You should be typing date, because the lisp object that interactive reads is not an eval form; that is, the symbol you type does not need to be quoted.

When you do have the result of a quote-expression and you want to retrieve the symbol, just treat it like an ordinary list. If a is (quote foo), then (car (cdr a)) is the symbol foo.

  • This worked! However, this has made me quite curious why I would have to quote if I am not calling it interactively, but not the other way around. If this requires too much general knowledge to fully explain, could you instead point me into the general direction I could start learning?
    – coenttb
    Commented Mar 2, 2015 at 16:10
  • 1
    interactive can read different formats, x mean read but don't eval (i.e. you get what you type) and X mean read and evaluate (i.e. if you type an expression, you will get the result of the expression). If you call a function the argument is evaluated. To call something without evaluating the argument you will need a lisp macro, which, unfortunately, is much harder to write. Commented Mar 2, 2015 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.