all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Huchler <stefan.huchler@mail.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Strange eval behaviour
Date: Tue, 15 Nov 2016 02:55:52 +0100	[thread overview]
Message-ID: <878tsl1p7b.fsf@mail.de> (raw)
In-Reply-To: jwveg2em7f7.fsf-monnier+gmane.emacs.help@gnu.org

Stefan Monnier <monnier@iro.umontreal.ca> 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.
>> http://ix.io/1EEU
>
> 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

Thanks,

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)
    (request
     (kodi-json-url)
     :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 data)
					    .result))
    		    ;; (print (aref (let-alist kodi-properties .episodedetails) 0))
    		    ;; (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
cl-macs

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
emacs-start?




  reply	other threads:[~2016-11-15  1:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-13 21:28 Strange eval behaviour Stefan Huchler
2016-11-14 15:04 ` Stefan Monnier
2016-11-15  1:55   ` Stefan Huchler [this message]
2016-11-18  2:38     ` Michael Heerdegen
2016-11-18 16:51       ` Stefan Huchler
2016-11-18 23:19         ` Michael Heerdegen
2016-11-22 23:57           ` Stefan Huchler
2016-11-23  9:19             ` Michael Heerdegen
2016-11-23 14:20               ` Stefan Huchler
2016-11-18 17:00       ` Stefan Huchler
2016-11-18 23:35         ` Michael Heerdegen
2016-11-22 14:43           ` Stefan Huchler
2016-11-27  4:25           ` Stefan Huchler
2016-11-27  4:29           ` Stefan Huchler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878tsl1p7b.fsf@mail.de \
    --to=stefan.huchler@mail.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.