Skip to content

Commit

Permalink
Update installation instructions, stop auto-creating profiles file
Browse files Browse the repository at this point in the history
Remove the installation scripts, people should just clone into .emacs.d.

Remove the auto-creation of ~/.emacs-profiles.el, since we no longer can assume
where the default config lives.
  • Loading branch information
plexus committed Oct 5, 2020
1 parent efdafa3 commit 9a8d516
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 169 deletions.
53 changes: 16 additions & 37 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -62,48 +62,27 @@ various edge cases and use cases that come up.

** Installation

Clone the Git repository, and run =install.sh=
Clone the Chemacs 2 repository as =$HOME/.emacs.d=. Note that if you already
have an Emacs setup in =~/.emacs.d= you need to move it out of the way first. If
you have an =~/.emacs= startup script then move that out of the way as well.

#+BEGIN_SRC shell
$ git clone https://github.com/plexus/chemacs.git
$ cd chemacs
$ ./install.sh
OK Creating symlink ~/.emacs -> /home/arne/chemacs/.emacs
[ -f ~/.emacs ] && mv ~/.emacs ~/.emacs.bak
[ -d ~/.emacs.d ] && mv ~/.emacs.d ~/.emacs.default
git clone https://github.com/plexus/chemacs2.git ~/.emacs.d
#+END_SRC

The install script will symlink =~/.emacs= to the Chemacs script. If you
already have a =~/.emacs= you need to move it out of the way first
Note that this is different from Chemacs 1. Before Chemacs installed itself as
=~/.emacs= and you could have your own default setup in =~/.emacs.d=. This
approach no longer works because of =~/.emacs.d/early-init.el=, so Chemacs 2
needs to be installed as =~/.emacs.d=.

#+BEGIN_SRC shell
$ ./install.sh
WARN chemacs can't be installed, ~/.emacs is in the way
#+END_SRC

By symlinking you can easily update Chemacs with a =git pull=. Chemacs is not
available on ELPA/MELPA because its special position in the Emacs boot process
would cause a chicken and egg problem.

There's a similar script for Windows called =install.ps1=.
Next you will need to create a =~/.emacs-profiles.el= file, for details see
below.

#+BEGIN_SRC powershell
$ git clone https://github.com/plexus/chemacs.git
$ cd chemacs
$ .\install.ps1
OK copying file to ~/.emacs
#+END_SRC

The Windows script copies the ~/.emacs file rather than symlinking it, as
symlinks in Windows require elevated privileges. To update the file, run
=install.ps1= a second time, if necessary - it uses hashing to detect
changes and prompts for conformation before overwriting

#+BEGIN_SRC powershell
$ .\install.ps1
WARN content is different between C:\Users\Me\.emacs and C:\Users\Me\repos\chemacs\.emacs
WARN chemacs may already be installed OR something else may be in the way
Do you want to overwrite C:\Users\Me\.emacs?: y
OK updated chemacs files successfully.
#+END_SRC
#+begin_src emacs-lisp
(("default" . ((user-emacs-directory . "~/.emacs.default"))))
#+end_src

** Usage

Expand All @@ -127,7 +106,7 @@ names, and the values/cdrs their configuration.
The main thing to configure is the =user-emacs-directory=

#+BEGIN_SRC emacs-lisp
(("default" . ((user-emacs-directory . "~/.emacs.d")))
(("default" . ((user-emacs-directory . "~/.emacs.default")))
("spacemacs" . ((user-emacs-directory . "~/spacemacs"))))
#+END_SRC

Expand Down
25 changes: 3 additions & 22 deletions chemacs.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; chemacs-common.el --- -*- lexical-binding: t; -*-
;;; chemacs.el --- -*- lexical-binding: t; -*-
;;; Commentary:
;; ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;;
Expand All @@ -18,25 +18,7 @@
;;
;; Chemacs - Emacs Profile Switcher
;;
;; INSTALLATION
;;
;; Install this file as ~/.emacs . Next time you start Emacs it will create a
;; ~/.emacs-profiles.el , with a single "default" profile
;;
;; (("default" . ((user-emacs-directory . "~/.emacs.d"))))
;;
;; Now you can start Emacs with `--with-profile' to pick a specific profile. A
;; more elaborate example:
;;
;; (("default" . ((user-emacs-directory . "~/emacs-profiles/plexus")))
;; ("spacemacs" . ((user-emacs-directory . "~/github/spacemacs")
;; (server-name . "spacemacs")
;; (custom-file . "~/.spacemacs.d/custom.el")
;; (env . (("SPACEMACSDIR" . "~/.spacemacs.d"))))))
;;
;; If you want to change the default profile used (so that, for example, a
;; GUI version of Emacs uses the profile you want), you can also put the name
;; of that profile in a ~/.emacs-profile file
;; See README.md for instructions.

;; ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;; this must be here to keep the package system happy, normally you do
Expand All @@ -49,8 +31,7 @@
(defvar chemacs-default-profile-path "~/.emacs-profile")

(when (not (file-exists-p chemacs-profiles-path))
(with-temp-file chemacs-profiles-path
(insert "((\"default\" . ((user-emacs-directory . \"~/.emacs.d\"))))")))
(error "[chemacs] %s does not exist." chemacs-profiles-path))

(defvar chemacs-emacs-profiles
(with-temp-buffer
Expand Down
57 changes: 0 additions & 57 deletions install.ps1

This file was deleted.

53 changes: 0 additions & 53 deletions install.sh

This file was deleted.

0 comments on commit 9a8d516

Please sign in to comment.