Personal emacs config
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
3.8 KiB

  1. (eval-when-compile
  2. (defvar el-get-sources)
  3. )
  4. (declare-function el-get-post-install 'el-get)
  5. (add-to-list 'load-path "~/.emacs.d/el-get/el-get")
  6. ;;; el-get-install.el --- installer for the lazy
  7. ;;
  8. ;; Copyright (C) 2010 Dimitri Fontaine
  9. ;;
  10. ;; Author: Dimitri Fontaine <dim@tapoueh.org>
  11. ;; URL: http://www.emacswiki.org/emacs/el-get.el
  12. ;; Created: 2010-06-17
  13. ;; Keywords: emacs package elisp install elpa git git-svn bzr cvs apt-get fink http http-tar
  14. ;; Licence: WTFPL, grab your copy here: http://sam.zoy.org/wtfpl/
  15. ;;
  16. ;; This file is NOT part of GNU Emacs.
  17. ;;
  18. ;; bootstrap your el-get installation, the goal is then to use el-get to
  19. ;; update el-get.
  20. ;;
  21. ;; So the idea is that you copy/paste this code into your *scratch* buffer,
  22. ;; hit C-j, and you have a working el-get.
  23. (let ((el-get-root
  24. (file-name-as-directory
  25. (or (bound-and-true-p el-get-dir)
  26. (concat (file-name-as-directory user-emacs-directory) "el-get")))))
  27. (when (file-directory-p el-get-root)
  28. (add-to-list 'load-path el-get-root))
  29. ;; try to require el-get, failure means we have to install it
  30. (unless (require 'el-get nil t)
  31. (unless (file-directory-p el-get-root)
  32. (make-directory el-get-root t))
  33. (let* ((package "el-get")
  34. (buf (switch-to-buffer "*el-get bootstrap*"))
  35. (pdir (file-name-as-directory (concat el-get-root package)))
  36. (git (or (executable-find "git")
  37. (error "Unable to find `git'")))
  38. (url (or (bound-and-true-p el-get-git-install-url)
  39. "http://github.com/dimitri/el-get.git"))
  40. (default-directory el-get-root)
  41. (process-connection-type nil) ; pipe, no pty (--no-progress)
  42. ;; First clone el-get
  43. (status
  44. (call-process
  45. git nil `(,buf t) t "--no-pager" "clone" "-v" url package)))
  46. (unless (zerop status)
  47. (error "Couldn't clone el-get from the Git repository: %s" url))
  48. ;; switch branch if we have to
  49. (let* ((branch (cond
  50. ;; Check if a specific branch is requested
  51. ((bound-and-true-p el-get-install-branch))
  52. ;; Check if master branch is requested
  53. ((boundp 'el-get-master-branch) "master")
  54. ;; Read the default branch from the el-get recipe
  55. ((plist-get (with-temp-buffer
  56. (insert-file-contents-literally
  57. (expand-file-name "recipes/el-get.rcp" pdir))
  58. (read (current-buffer)))
  59. :branch))
  60. ;; As a last resort, use the master branch
  61. ("master")))
  62. (remote-branch (format "origin/%s" branch))
  63. (default-directory pdir)
  64. (bstatus
  65. (if (string-equal branch "master")
  66. 0
  67. (call-process git nil (list buf t) t "checkout" "-t" remote-branch))))
  68. (unless (zerop bstatus)
  69. (error "Couldn't `git checkout -t %s`" branch)))
  70. (add-to-list 'load-path pdir)
  71. (load package)
  72. (let ((el-get-default-process-sync t) ; force sync operations for installer
  73. (el-get-verbose t)) ; let's see it all
  74. (el-get-post-install "el-get"))
  75. (with-current-buffer buf
  76. (goto-char (point-max))
  77. (insert "\nCongrats, el-get is installed and ready to serve!")))))
  78. (declare-function el-get 'el-get)
  79. ;; now either el-get is `require'd already, or have been `load'ed by the
  80. ;; el-get installer.
  81. (setq
  82. el-get-sources
  83. '(el-get ; el-get is self-hosting
  84. loc-changes ; loc marks in buffers
  85. load-relative ; load emacs lisp relative to emacs source
  86. test-simple ; simple test framework
  87. ))
  88. ;; install new packages and init already installed packages
  89. (el-get 'sync '(loc-changes list-utils load-relative test-simple))