From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Huchler Newsgroups: gmane.emacs.help Subject: Re: Strange eval behaviour Date: Tue, 15 Nov 2016 02:55:52 +0100 Message-ID: <878tsl1p7b.fsf@mail.de> References: <87vavrul0k.fsf@mail.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1479218549 13143 195.159.176.226 (15 Nov 2016 14:02:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 15 Nov 2016 14:02:29 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 15 15:02:20 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c6eIs-0005ou-Px for geh-help-gnu-emacs@m.gmane.org; Tue, 15 Nov 2016 15:01:38 +0100 Original-Received: from localhost ([::1]:46652 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c6eIw-0008Ci-5f for geh-help-gnu-emacs@m.gmane.org; Tue, 15 Nov 2016 09:01:42 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55725) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c6SzC-0002Fg-Tc for help-gnu-emacs@gnu.org; Mon, 14 Nov 2016 20:56:35 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c6Sz8-0000X3-Gi for help-gnu-emacs@gnu.org; Mon, 14 Nov 2016 20:56:34 -0500 Original-Received: from [195.159.176.226] (port=54644 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c6Sz8-0000WX-AT for help-gnu-emacs@gnu.org; Mon, 14 Nov 2016 20:56:30 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1c6Syq-0001Kr-Ts for help-gnu-emacs@gnu.org; Tue, 15 Nov 2016 02:56:12 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 86 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:E8dJmbr+5aOBSAI5U1pubAVfIZE= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-Mailman-Approved-At: Tue, 15 Nov 2016 09:00:23 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:111733 Archived-At: 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. >> 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?