1

I have been using emacs for a while, and i recently installed zsh and i wanted to give a try with spacemacs. I want to try spacemacs without disturbing existing emacs.

I followed the instruction as mentioned here.

  • created a dir ~/spacemacs
  • git clone https://github.com/syl20bnr/spacemacs.git ~/spacemacs/.emacs.d
  • HOME=~/spacemacs emacs

I did the first two steps. But im not sure to do the last step HOME=~/spacemacs emacs, because i want things to be as follows. when i give emacs, my default emacs should open, and when i give semacs i want to open spacemacs.

So far, i have modified my .zshrc file in such a way that, when i give the command emacs it fires up emacs, so i have an alias like such alias emacs='emacs -nw'.

And i want to give semacs(alias for spacemacs) open spacemacs, so that i can open emacs any time i wanted to, if im not comfortable with spacemacs. Now what should be the 3rd step as and what should be my alias look like.

arvindh
  • 155
  • 4
  • Closely related: [Running spacemacs alongside regular emacs: how to keep a separate .emacs.d](http://emacs.stackexchange.com/questions/19936/running-spacemacs-alongside-regular-emacs-how-to-keep-a-separate-emacs-d) – Dan Oct 12 '16 at 15:32

1 Answers1

1

If I understand your question, what you want to do is set up an alias. The third command, HOME=~/spacemacs emacs, will launch emacs using the Spacemacs configuration and layers. So, all you should need to do is put

alias semacs='HOME=~/spacemacs emacs'

in your .zshrc file, and restart the shell.

As a caveat, I am not very familiar with zsh, but am reasonably experienced with bash. I assume simple aliases like this should work the same.


EDIT: I was unable to personally get the alias working in zsh. However, I was able to do it using a shell function (based on this answer):

semacs() {
  HOME=~/spacemacs emacs $@
}
Violet
  • 488
  • 4
  • 13
  • what does the 3rd step means if i directly give them in the terminal as said in the link – arvindh Oct 12 '16 at 18:19
  • @arvindh The third step means "launch emacs using the spacemacs configuration." Also, have you restarted your shell after modifying .zshrc? The easiest way to do this is just to run the zsh command again. – Violet Oct 12 '16 at 19:34
  • thanks for the information on restarting zsh. Now after restarting zsh when i give `semacs` its opening basic gnu `emacs`. and it does not start `spacemacs` – arvindh Oct 12 '16 at 20:01
  • You are right—I should have tried this before posting it. My zsh inexperience is showing. I have updated the answer with a shell function that you can use instead of the alias. This time I actually tried it first ;-) Sorry for the runaround. – Violet Oct 12 '16 at 21:56
  • Thanks @Violet. It worked. And i have to mention one more thing for someone who end up with same thing. Previously i had emacs 24.3 as default and spacemacs works with 24.4 above. So i had to install recent version and change the line as `{HOME=~/spacemacs emacs-25.1 $@}` (your version number over there, i installed 25.1 so i had to change it to 25.1) – arvindh Oct 13 '16 at 03:33
  • It's almost always better to use a script than a shell function or alias. Shell functions and aliases only work from within the shell they're defined in, but scripts can be called from anywhere. –  Oct 14 '16 at 10:22