[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange eval behaviour

From: Stefan Huchler
Subject: Re: Strange eval behaviour
Date: Tue, 15 Nov 2016 02:55:52 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Stefan Monnier <> writes:

>> Now I have pinned it down to the point that whenever I restart emacs, it
>> does not work, till I evaluate manualy the function in that elisp file.
> Please include such code directly in your messages.
> Do the following:
>     emacs -Q .../kodi-remote.el
>     M-x byte-compile-file RET
> then look at the errors/warnings.  Fix them (typically by adding the
> missing `require`s) and try again until there's no more warnings/errors.
>         Stefan


that kind of pushed me into the right direction. So I test this module
by just requesting it. aperently that dont creates a .elc file.

So I use the function macro, that has somethnig to do with
bytecompiling, so doest it automaticly bytecompile that if its needed,
or did it ignore that I dont have let-alist loaded, because it is in the
function macro?

Normaly it should through a error if it cant find a macro/function that
is not availible right?

So I fixed it but would like to 100% understand what the problem was, to
avoid to make the same mistake again.

(defun kodi-remote-get (method params)
  "method to send get requests to the kodi instance"
  (let* ((request-data
          `(("id" . 0)
           ("jsonrpc" . "2.0")
           ("method" . ,method))))
    (if (equal params nil) ()
        (setq request-data
              (append request-data params
    ;; (print request-data)
     :data (json-encode request-data)
     :headers '(("Content-Type" . "application/json"))
     :success (function* (lambda (&key data &allow-other-keys)
                  (when data
                    (setq kodi-properties (let-alist (json-read-from-string 
                    ;; (print (aref (let-alist kodi-properties .episodedetails) 
                    ;; (print data)
     :error (function* (lambda (&key error-thrown &allow-other-keys&rest _)
                  (message "Got error: %S" error-thrown)))
     :complete (lambda (&rest _) (message "Finished!"))
     :parser 'buffer-string)))

that was the code I did not have
(require 'let-alist)

in the file?

I importet it with:

  (add-to-list 'load-path "~/.emacs.d/config/")
  (require 'kodi-remote)

Again thanks so far so I can release that code soon, but again I would
like to understand what the problem was. Do I have to have a
byte-compiled .elc file if I use the "function" macro

oh wait its the function* which is a alias to the cl-function macro in

so I need the cl library imported too. But well thats more relevant for
packaging I think, I think the main problem was that there just was no
.elc file?

Strange :) cant it just interpret the sourcefile when I require it on

reply via email to

[Prev in Thread] Current Thread [Next in Thread]