el-get install throwing error #849

Closed
ciju opened this Issue Aug 29, 2012 · 10 comments

Projects

None yet

5 participants

ciju commented Aug 29, 2012

Am trying this on Emacs version 24.1.50 (on mac osx).

(add-to-list 'load-path "~/.emacs.d/el-get/el-get")

(unless (require 'el-get nil t)
  (url-retrieve
   "https://raw.github.com/dimitri/el-get/master/el-get-install.el"
   (lambda (s)
     (let (el-get-master-branch)
       (goto-char (point-max))
       (eval-print-last-sexp)))))

(el-get 'sync)

But, get the following error/debug message.

Debugger entered--Lisp error: (void-variable closed)
  eval(closed nil)
  eval-last-sexp-1(t)
  eval-last-sexp(t)
  eval-print-last-sexp()
  (let (el-get-master-branch) (goto-char (point-max)) (eval-print-last-sexp))
  (lambda (s) (let (el-get-master-branch) (goto-char (point-max)) (eval-print-last-sexp)))(nil)
  apply((lambda (s) (let (el-get-master-branch) (goto-char (point-max)) (eval-print-last-sexp))) nil)
  url-http-activate-callback()
  url-http-content-length-after-change-function(412 3776 3364)
  url-http-wait-for-headers-change-function(1 3793 3792)
  url-http-generic-filter(#<process raw.github.com> "HTTP/1.1 200 OK
\nServer: nginx/1.0.13
\nDate: Wed, 29 Aug 2012 00:34:44 GMT
\nContent-Type: text/plain; charset=utf-8
\nConnection: close
\nStatus: 200 OK
\nContent-Length: 3356
\nX-Frame-Options: deny
\nETag: \"6bd7b310847511e5787978094fe4f6e4\"
\nX-RateLimit-Limit: 100
\nContent-Disposition: inline
\nCache-Control: private
\nX-RateLimit-Remaining: 100
\nX-Content-Type-Options: nosniff
\nX-Runtime: 16
\nContent-Transfer-Encoding: binary
\n
\n;;; el-get-install.el --- installer for the lazy\n;;\n;; Copyright (C) 2010 Dimitri Fontaine\n;;\n;; Author: Dimitri Fontaine <dim@tapoueh.org>\n;; URL: http://www.emacswiki.org/emacs/el-get.el\n;; Created: 2010-06-17\n;; Keywords: emacs package elisp install elpa git git-svn bzr cvs apt-get fink http http-tar\n;; Licence: WTFPL, grab your copy here: http://sam.zoy.org/wtfpl/\n;;\n;; This file is NOT part of GNU Emacs.\n;;\n;; bootstrap your el-get installation, the goal is then to use el-get to\n;; update el-get.\n;;\n;; So the idea is that you copy/paste this code into your *scratch* buffer,\n;; hit C-j, and you have a working el-get.\n\n(let ((el-get-root\n       (file-name-as-directory\n  (or (bound-and-true-p el-get-dir)\n     (concat (file-name-as-directory user-emacs-directory) \"el-get\")))))\n\n  (when (file-directory-p el-get-root)\n    (add-to-list 'load-path el-get-root))\n\n  ;; try to require el-get, failure means we have to install it\n  (unless (require 'el-get nil t)\n    (unless (file-directory-p el-get-root)\n      (make-directory el-get-root t))\n\n    (let* ((package   \"el-get\")\n     (buf       (switch-to-buffer \"*el-get bootstrap*\"))\n     (pdir      (file-name-as-directory (concat el-get-root package)))\n     (git       (or (executable-find \"git\")\n             (error \"Unable to find `git'\")))\n     (url       (or (bound-and-true-p el-get-git-install-url)\n             \"http://github.com/dimitri/el-get.git\"))\n     (default-directory el-get-root)\n       (process-connection-type nil)   ; pipe, no pty (--no-progress)\n\n      ;; First clone el-get\n     (status\n        (call-process\n      git nil `(,buf t) t \"--no-pager\" \"clone\" \"-v\" url package)))\n\n      (unless (zerop status)\n   (error \"Couldn't clone el-get from the Git repository: %s\" url))\n\n      ;; switch branch if we have to\n      (let* ((branch (cond\n                      ;; Check if a specific branch is requested\n                      ((bound-and-true-p el-get-install-branch))\n                      ;; Check if master branch is requested\n                      ((boundp 'el-get-master-branch) \"master\")\n                      ;; Read the default branch from the el-get recipe\n                      ((plist-get (with-temp-buffer\n                                    (insert-file-contents-literally\n                                     (expand-file-name \"recipes/el-get.rcp\" pdir))\n                                    (read (current-buffer)))\n                                  :branch))\n                      ;; As a last resort, use the master branch\n                      (\"master\")))\n             (remote-branch (format \"origin/%s\" branch))\n             (default-directory pdir)\n             (bstatus\n               (if (string-equal branch \"master\")\n                 0\n                 (call-process git nil (list buf t) t \"checkout\" \"-t\" remote-branch))))\n        (unless (zerop bstatus)\n          (error \"Couldn't `git checkout -t %s`\" branch)))\n\n      (add-to-list 'load-path pdir)\n      (load package)\n      (let ((el-get-default-process-sync t) ; force sync operations for installer\n            (el-get-verbose t))         ; let's see it all\n        (el-get-post-install \"el-get\"))\n      (unless (boundp 'el-get-install-skip-emacswiki-recipes)\n        (el-get-emacswiki-build-local-recipes))\n      (with-current-buffer buf\n (goto-char (point-max))\n   (insert \"\\nCongrats, el-get is installed and ready to serve!\")))))\nclosed\n")
Collaborator

It appears the downloaded file has an extra line at the end containing the word "closed" (scroll the error message all the way to the end to see it. This word is being picked up as the last expression by eval-last-sexp instead of the actual install code.

I suspect this extra line must be some kind of status data indicating the end of the download which got erroneously inserted as part of the file's content. Not sure what to do about this. Maybe do a backward-search for a close paren before the eval?

Collaborator
tkf commented Aug 29, 2012

How about something like this?:

(goto-char (point-min))
(search-forward "\n(let")
(eval-defun)
ciju commented Aug 29, 2012

The install was successful after I applied the patch mentioned in issue 796

But after that el-get-install [enter] packagename was giving me error. Should a create a separate issue for that?

Owner
dimitri commented Aug 29, 2012

I kind of like @tkf idea, using mostly C-M-x myself, rarely using C-x C-e. Want to send a patch?

Rather than going to the first let of the file, what about using C-M-n runs the command forward-list instead, or maybe down-list? That allows not to have to think about updating the *scratch* installer stanza if we ever change the installer file itself.

Collaborator
tkf commented Aug 29, 2012

It turned out that (forward-list) and (down-list) stops at the line:

;; Copyright (C) 2010 Dimitri Fontaine
Owner
dimitri commented Aug 29, 2012

It skips the comments just fine for me here. I guess you might need to turn on emacs-lisp-mode in the install code buffer before being able to use sexp navigation commands?

Collaborator
tkf commented Aug 29, 2012

I tried in the buffer returned by url-retrieve-synchronously. Indeed emacs-lisp-mode is off there. I am not sure if turning on emacs-lisp-mode is a good idea because the header is not lisp code.

FYI This is how its first lines look like:

HTTP/1.1 200 OK
Server: nginx/1.0.13
Date: Wed, 29 Aug 2012 14:55:13 GMT
Content-Type: text/plain; charset=utf-8
Connection: keep-alive
Status: 200 OK
Cache-Control: private
X-Frame-Options: deny
X-RateLimit-Limit: 100
Content-Transfer-Encoding: binary
X-RateLimit-Remaining: 100
X-Runtime: 17
Content-Length: 3356
X-Content-Type-Options: nosniff
ETag: "6bd7b310847511e5787978094fe4f6e4"
Content-Disposition: inline

;;; el-get-install.el --- installer for the lazy
;;
;; Copyright (C) 2010 Dimitri Fontaine
;;
;; Author: Dimitri Fontaine <dim@tapoueh.org>
;; URL: http://www.emacswiki.org/emacs/el-get.el
;; Created: 2010-06-17
;; Keywords: emacs package elisp install elpa git git-svn bzr cvs apt-get fink http http-tar
;; Licence: WTFPL, grab your copy here: http://sam.zoy.org/wtfpl/
;;
;; This file is NOT part of GNU Emacs.
;;
;; bootstrap your el-get installation, the goal is then to use el-get to
;; update el-get.
;;
;; So the idea is that you copy/paste this code into your *scratch* buffer,
;; hit C-j, and you have a working el-get.

(let ((el-get-root

I have no "closed" at the end of the buffer.

Owner
dimitri commented Aug 29, 2012

In a quick test with the following content in a file named el-get-scratch.el it seems to move the point at the right place but then error out on the eval-defun call.

;; So the idea is that you copy/paste this code into your *scratch* buffer,
;; hit C-j, and you have a working el-get.

(switch-to-buffer
 (url-retrieve
  "https://raw.github.com/dimitri/el-get/master/el-get-install.el"
  (lambda (s)
    (emacs-lisp-mode)
    (goto-char (point-min))
    (down-list)
    (eval-defun))))

When trying the other variant, same kind of error. I'm lazily trying to get it.

ruph commented Oct 1, 2012

I had to change (eval-defun) to (eval-defun nil), otherwise I got Wrong number of arguments.

Owner
dimitri commented Dec 14, 2012

Meanwhile we did change the snippet to paste in scratch in order to install el-get, using url-retrieve-synchronously . We would need to reproduce the problem before spending time fixing it. Closing that issue, please open a new one if needs be.

@dimitri dimitri closed this Dec 14, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment