ljos / sparql-mode

A SPARQL mode for emacs
GNU General Public License v3.0
59 stars 23 forks source link

Symbol's function definition is void: endpoint-url #49

Closed wouterbeek closed 8 years ago

wouterbeek commented 8 years ago

Whenever I execute a SPARQL query the following message is displayed in the echo area: "Symbol's function definition is void: endpoint-url".

I'm on GNU Emacs 25.1.50.1 (Git master).

wouterbeek commented 8 years ago

Adding (require 'cl) and (re)valuating the file sparql-mode.el from within Emacs gets me a little further in the process:

  1. In Org Babel I get: "Trying to parse HTTP response code in odd buffer: http localhost:2020" (I've set the url parameter to another endpoint, so I'm not sure where the http localhost:2020 is coming from.)
  2. In a SPARQL buffer (loaded from file test.sparql) I get: "error in process sentinel: Buffer is read-only: #<buffer SPARQL: test.sparql>".

Adding the require statement results in function lexical-let being recognized. However, I cannot find the function endpoint-url in library cl. It does not seem to be part of Emacs 25.x.

ljos commented 8 years ago

Thank you for reporting and looking into this. You were on the right track with the lexical-let not being recognized. When that was fixed you stumbled into a different error. I need to be a bit more careful when I refactor and test. I sometimes forget to open a new emacs and test that my environment is not affecting the tests.

enpoint-url is not a function, but a variable bound by lexical-let; when lexical-let wasn't working properly the syntax makes emacs think it's a function instead. That is why you got that error.

I am not sure I understand the Org babel error. Do you still get it?

wouterbeek commented 8 years ago

@ljos Thanks for the fix! C-c C-c now works in sparql-mode. in Org Babel I still get the same message: "Trying to parse HTTP response code in odd buffer: *http localhost:2020*" This is probably a different issue?

Here is my MWE:

#+HEADER: :format text/csv
#+HEADER: :url    http://dbpedia.org/sparql
#+BEGIN_SRC sparql
SELECT * { ?s ?p ?o }
LIMIT 10
#+END_SRC
ljos commented 8 years ago

It seems to work for me, but the buffer name it complains about is the default url setting (except it is missing //: after http).

You can try to run "M-x toggle-debug-on-error" to see if you can get some more information; though it is sometimes hard to understand the error trace etc. from the url package.

You can also try to use edebug-defun on org-babel-execute:sparql and see if it gets the correct url value there. Edebug instruments the function and the next time you run it it will break when the function is entered. You can read about how to control edebug here: https://www.gnu.org/software/emacs/manual/html_node/elisp/Edebug-Execution-Modes.html#Edebug-Execution-Modes .

I'm guessing it is not getting the right value for some reason and that the error for when there is no endpoint to query (or maybe worse, there is) is just horrible on sparql-modes end.

ljos commented 8 years ago

I pushed another commit that at least gives a better error message.

I think I was right, your emacs doesn't set the URL correctly. I don't know why as it works on my end. If you run through with edebug you could see if the params argument to org-babel-execute:sparql contains the correct value.