dakrone / es-mode

An Emacs major mode for interacting with Elasticsearch
GNU General Public License v3.0
196 stars 34 forks source link

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

Closed colinxy closed 7 years ago

colinxy commented 7 years ago

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)))
dakrone commented 7 years ago

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?

colinxy commented 7 years ago

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.

dakrone commented 7 years ago

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?

colinxy commented 7 years ago

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

dakrone commented 7 years ago

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