Coder Social home page Coder Social logo

chemacs's Introduction

     ___           ___           ___           ___           ___           ___           ___
    /  /\         /__/\         /  /\         /__/\         /  /\         /  /\         /  /\
   /  /:/         \  \:\       /  /:/_       |  |::\       /  /::\       /  /:/        /  /:/_
  /  /:/           \__\:\     /  /:/ /\      |  |:|:\     /  /:/\:\     /  /:/        /  /:/ /\
 /  /:/  ___   ___ /  /::\   /  /:/ /:/_   __|__|:|\:\   /  /:/~/::\   /  /:/  ___   /  /:/ /::\
/__/:/  /  /\ /__/\  /:/\:\ /__/:/ /:/ /\ /__/::::| \:\ /__/:/ /:/\:\ /__/:/  /  /\ /__/:/ /:/\:\
\  \:\ /  /:/ \  \:\/:/__\/ \  \:\/:/ /:/ \  \:\~~\__\/ \  \:\/:/__\/ \  \:\ /  /:/ \  \:\/:/~/:/
 \  \:\  /:/   \  \::/       \  \::/ /:/   \  \:\        \  \::/       \  \:\  /:/   \  \0.1 /:/
  \  \:\/:/     \  \:\        \  \:\/:/     \  \:\        \  \:\        \  \:\/:/     \__\/ /:/
   \  \::/       \  \:\        \  \::/       \  \:\        \  \:\        \  \::/        /__/:/
    \__\/         \__\/         \__\/         \__\/         \__\/         \__\/         \__\/



                                 ... ........,**********,...
                          .%*....       .,/(((#//(//*,*,,,*.,#%&(,,/(##.
                            %/..                          ,,  ,*,*/(%%.
                             %/*.                         .. .,,.,#%&
                              &(,.                       .. ....((%&.
                               ,#,.                     ..  ...*/#%
                                .#,..                   .  ..,/(%#
                                 .#,.                  ..  .,,(#%
                                   #*,.               .. .,,.(%(
                                  ***//((((((((//****,,**//,/  .
                                  ///((#%%%%%%%##(///////*./,,,,
                                   /#(##%%%%%%%%%##(((//*.(**,*
                                    .(/###%%%%%%##(((/// (/,,,
                                     */(##%%%%##(((/((/(/*.
                                     *((###%%%%%%%%%%%&&(*..
                                     .((###%%%%%%%%##((####/,//
                                     **//((###(###%%%#%%#&/%(%#(.
                                    **//(((((((/((##%#%#/%##%*/.
                                   ***///(/(((/////((((%**../..   //
                                  **//(((###(((((//////%/***(,..   /&
                                  ,####%%%%%%%%###((//(%,*/((/**    #*
                                  ./,,                *%..,..*&%    ,#
                                 ,(,.                 *%   .../%&    @
                                *#,.                  *%,  ....,%&   &.
                               (/,                   .&&&%/   ..,%&  %,
                              %/,                        ((.   .,,%&%%/,
                             #*.                                .*(%%%@,
                            #,.                                 ..,,%&.,
                           ,/....                              .... ,%%
                           %,,.....                  ......   ,* ....#&.
                           #,,,,..      .....................  ....,/#%*
                           #*,,*.......  ...................,,,****/(%%,
                           ,(*/**,.......................,,,,,**//###%#
                            /#/(((/**,...  .............,,,,/(##%%%##@
                             /.*/((/,,,,,.,/(###########(/(((((#%%#&&
                               ,(#(/,,.......,,,,,,,,/(///(#%%%%#
                                ./(*,..                  ..,*((#&/
                                    ...,..,..,/###(//(#(/*,.. .

Chemacs

Chemacs is an Emacs profile switcher, it makes it easy to run multiple Emacs configurations side by side.

Think of it as a bootloader for Emacs.

Rationale

Emacs configuration is either kept in a ~/.emacs file or, more commonly, in a ~/.emacs.d= directory. These paths are hard-coded. If you want to try out someone else’s configuration, or run different distributions like Prelude or Spacemacs, then you either need to swap out ~/.emacs.d, or run Emacs with a different $HOME directory set.

This last approach is quite common, but has some real drawbacks, since now packages will no longer know where your actual home directory is.

All of these makes trying out different Emacs configurations and distributions needlessly cumbersome.

Various approaches to solving this have been floated over the years. There’s an Emacs patch around that adds an extra command line option, and various examples of how to add a command line option in userspace from Emacs Lisp.

Chemacs tries to implement this idea in a user-friendly way, taking care of the various edge cases and use cases that come up.

Installation

Clone the Git repository, and run install.sh

$ git clone https://github.com/plexus/chemacs.git
$ cd chemacs
$ ./install.sh
OK      Creating symlink ~/.emacs -> /home/arne/chemacs/.emacs

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

$ ./install.sh
WARN    chemacs can't be installed, ~/.emacs is in the way

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.

Usage

Chemacs adds an extra command line option to Emacs, --with-profile. Profiles are configured in ~/.emacs-profiles.el. If this file does not exist Chemacs will create it with a default profile pointing at ~/.emacs.d.

If no profile is given at the command line then the default profile is used, so if you currently have your emacs configuration in ~/.emacs.d then Chemacs will, by default, use your existing configuration.

$ emacs --with-profile my-profile

.emacs-profiles.el

This file contains an association list, with the keys/cars being the profile names, and the values/cdrs their configuration.

The main thing to configure is the user-emacs-directory

(("default" . ((user-emacs-directory . "~/.emacs.d")))
 ("spacemacs" . ((user-emacs-directory . "~/spacemacs"))))

Chemacs will set this to be the user-emacs-directory in use, and load init.el from that directory.

Other things you can configure

  • custom-file : The file where Customize stores its customizations. If this isn’t configured, and the custom-file variable is still unset after loading the profile’s init.el, then this will get set to the profile’s init.el
  • server-name : Sets the server-name variable, so you can distinguish multiple instances with emacsclient -s <server-name>.
  • env An association list of environment variables. These will get set before loading the profile, so they can influence the initialization, and they are visible to any subprocesses spawned from Emacs.

Store .emacs-profile.el together with your dotfiles. If you’re not yet keeping a version controlled directory of dotfiles, then check out [connect-the-dots](https://github.com/plexus/dotfiles/blob/master/connect-the-dots) for a helpful script to do that.

Spacemacs

Spacemacs is typically installed by cloning the Spacemacs repo to ~/.emacs.d, and doing extra customization from ~/.spacemacs or ~/.spacemacs.d/init.el. This makes it tedious to switch between version of Spacemacs, or between different Spacemacs configurations.

With Chemacs you can point your user-emacs-directory to wherever you have Spacemacs installed, and use the SPACEMACSDIR environment variable to point at a directory with customizations that are applied on top of the base install.

(("spacemacs" . ((user-emacs-directory . "~/spacemacs")
                 (env . (("SPACEMACSDIR" . "~/.spacemacs.d")))))

 ("spacemacs-develop" . ((user-emacs-directory . "~/spacemacs/develop")
                        (env . (("SPACEMACSDIR" . "~/.spacemacs.d")))))

 ("new-config" . ((user-emacs-directory . "~/spacemacs/develop")
                  (env . (("SPACEMACSDIR" . "~/my-spacemacs-config"))))))

LICENSE

Copyright © Arne Brasseur 2018

Distributed under the terms of the GPL v3.

chemacs's People

Contributors

plexus avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.