Skip to content

Commit

Permalink
[#123] Deprecate bootstrap.el symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
raxod502 committed Dec 18, 2017
1 parent 1148f4e commit 93a2a9e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ First, place the following bootstrap code in your init-file:

<!-- longlines-start -->

(let ((bootstrap-file (concat user-emacs-directory "straight/bootstrap.el"))
(bootstrap-version 2))
(let ((bootstrap-file (concat user-emacs-directory "straight/repos/straight.el/bootstrap.el"))
(bootstrap-version 3))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
Expand Down Expand Up @@ -1292,8 +1292,8 @@ care of all these details for you:

<!-- longlines-start -->

(let ((bootstrap-file (concat user-emacs-directory "straight/bootstrap.el"))
(bootstrap-version 2))
(let ((bootstrap-file (concat user-emacs-directory "straight/repos/straight.el/bootstrap.el"))
(bootstrap-version 3))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
Expand Down Expand Up @@ -1804,9 +1804,14 @@ of `straight.el` itself using `straight-recipe-overrides`! How does
this work? Well, it's basically black magic. If you want the details,
go read the [developer manual][straight.el-recipe-internals]. All you
need to know is that you can set `straight-recipe-overrides`, and it
will magically work. (Obviously you can't use
`straight-override-recipe`, since that function definition hasn't been
loaded yet before `straight.el` is installed and bootstrapped.)
will magically work. The only caveat is that if you change the
`:local-repo` for `straight.el`, then you will also need to adjust the
value of `bootstrap-file` in the [bootstrap snippet][bootstrap]
accordingly, since otherwise your init-file will not know where to
find `straight.el`. (You must use `straight-recipe-overrides` instead
of `straight-override-recipe`, since the latter function definition
hasn't been loaded yet before `straight.el` is installed and
bootstrapped.)

Here is the default recipe used for `straight.el`, if you don't
override it:
Expand All @@ -1821,7 +1826,7 @@ branch of `straight.el`, the default recipe installs from `master`.

If all you want to do is change which branch you are installing
`straight.el` from, simply customize the variable
`straight-repository-variable`, which is provided for this purpose.
`straight-repository-branch`, which is provided for this purpose.
(Although using `straight-recipe-overrides` will work just as well, at
least until the recipe happens to be changed upstream and your
init-file isn't updated.)
Expand Down
12 changes: 7 additions & 5 deletions bootstrap.el
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
(defvar inhibit-message)

(let* ((bootstrap.el
;; If this file is accessed through a symlink (the normal
;; case), resolve it. We need to be looking at the actual
;; file, since the eventual target of the symlink is the only
;; way we can actually identify the straight.el repository
;; (which might be called something else).
;; If this file is accessed through a symlink (this may happen
;; when an old version of the bootstrap snippet is used to
;; load straight.el), resolve it. We need to be looking at
;; the actual file, since the eventual target of the
;; symlink is the only way we can actually identify the
;; straight.el repository (which might be called something
;; else).
(file-truename
(or
;; If the file is being loaded from the init-file.
Expand Down
3 changes: 3 additions & 0 deletions install.el
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@
:repo "raxod502/straight.el"
:files ("straight.el")
:branch ,straight-repository-branch))
;; Make a bootstrap.el symlink, for backwards compatibility
;; (bootstrap snippets versioned 2 and lower expect this
;; symlink to exist).
(let* ((recipe (gethash "straight" straight--recipe-cache))
(local-repo (plist-get recipe :local-repo))
;; This is a relative symlink. It won't break if you
Expand Down

0 comments on commit 93a2a9e

Please sign in to comment.