dakrone/es-mode

Request sent in org-babel does not work in es-mode

Closed this issue · 5 comments

I sent the same request in org-babel and es-mode buffer, but the request sent in es-mode produce an error, while org-babel works fine. Here is the request

GET /_search?pretty

Here is the error message

es--execute-region: Invalid function: (result-buffer-name (if (zerop es--query-number) (format "*ES: %s*" (buffer-name)) (format "*ES: %s [%d]*" (buffer-name) es--query-number)))

Hi @colinxy
Can you do (setq debug-on-error t) and then execute the request? That should give you a backtrace you can post here.

Also, what version of es-mode? Are you installing from MELPA or MELPA-Stable?

Here is the backtrace for the error:

Debugger entered--Lisp error: (invalid-function (result-buffer-name (if (zerop es--query-number) (format "*ES: %s*" (buffer-name)) (format "*ES: %s [%d]*" (buffer-name) es--query-number))))
  (result-buffer-name (if (zerop es--query-number) (format "*ES: %s*" (buffer-name)) (format "*ES: %s [%d]*" (buffer-name) es--query-number)))()
  es--execute-region()
  es-execute-request-dwim(nil)
  funcall-interactively(es-execute-request-dwim nil)
  call-interactively(es-execute-request-dwim nil nil)
  command-execute(es-execute-request-dwim)

I can confirm that executing the same request with curl works fine.

I am using the version from MELPA, 20170410.354. Also I am using emacs 25.1.1 on macOS, if that helps.

That's super weird, it's like the lexical-let isn't working for you.

If you manually execute (require 'cl) does executing the request work?

I changed (require 'cl-lib) to (require 'cl) in es-mode.el and recompiled it, it works.

I pushed a commit for this, should be updated in Melpa soon, thanks for reporting this!