Skip to content

Commit

Permalink
[fix bbatsov#1248] [installer] provide switch to leave .emacs untouched
Browse files Browse the repository at this point in the history
 - if the user specifies the `-m/--no-move-dotemacs` option the installer will
   not invoke the backup `$HOME/.emacs` code block
  • Loading branch information
sankalp-khare committed Oct 27, 2020
1 parent 39da954 commit e9201db
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

### Changes

* [#1248](https://github.com/bbatsov/prelude/issues/1248): Add `-m/--no-move-dotemacs` option to the installer to disable the backing of the user's `.emacs`
* [#1292](https://github.com/bbatsov/prelude/issues/1292): Add `prelude-python-mode-set-encoding-automatically` defcustom inn `prelude-python.el` module with nil default value.
* [#1278](https://github.com/bbatsov/prelude/issues/1278): Don't disable `menu-bar-mode` unless `prelude-minimalistic-ui` is enabled.
* [#1277](https://github.com/bbatsov/prelude/issues/1277): Make it possible to disable the creation of `Super`-based keybindings via `prelude-super-keybindings`.
Expand Down
15 changes: 13 additions & 2 deletions utils/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ colors_ () {
# Defaults to 'https://github.com/bbatsov/prelude.git'
# -i/--into
# If one exists, install into the existing config
# -m/--no-move-dotemacs
# Leave '$HOME/.emacs' untouched
# -n/--no-bytecompile
# Skip the compilation of the prelude files.
# Skip the compilation of the prelude files
# -h/--help
# Print help
# -v/--verbose
Expand All @@ -75,6 +77,7 @@ usage() {
printf " \t \t \t \t Defaults to $HOME/.emacs.d\n"
printf " -s, --source [url] \t \t Clone Prelude from 'url'.\n"
printf " \t \t \t \t Defaults to 'https://github.com/bbatsov/prelude.git'.\n"
printf " -m, --no-move-dotemacs \t \t Leave '$HOME/.emacs' untouched.\n"
printf " -n, --no-bytecompile \t \t Skip the bytecompilation step of Prelude.\n"
printf " -i, --into \t \t \t Install Prelude into a subdirectory in the existing configuration\n"
printf " \t \t \t \t The default behavior is to install Prelude into the existing\n"
Expand Down Expand Up @@ -104,6 +107,10 @@ do
PRELUDE_INTO='true'
shift 1
;;
-m | --no-move-dotemacs)
PRELUDE_PRESERVE_DOTEMACS='true'
shift 1
;;
-n | --no-bytecompile)
PRELUDE_SKIP_BC='true'
shift 1
Expand Down Expand Up @@ -135,6 +142,10 @@ then
printf "INSTALL_DIR = $PRELUDE_INSTALL_DIR\n"
printf "SOURCE_URL = $PRELUDE_URL\n"
printf "$RESET"
if [ -n "$PRELUDE_PRESERVE_DOTEMACS" ]
then
printf "Leaving ~/.emacs untouched.\n"
fi
if [ -n "$PRELUDE_SKIP_BC" ]
then
printf "Skipping bytecompilation.\n"
Expand Down Expand Up @@ -180,7 +191,7 @@ then
printf "$YELLOW WARNING:$RESET Prelude requires Emacs $RED 25$RESET or newer!\n"
fi

if [ -f "$HOME/.emacs" ]
if [ -f "$HOME/.emacs" ] && [ -z "$PRELUDE_PRESERVE_DOTEMACS" ]
then
## If $HOME/.emacs exists, emacs ignores prelude's init.el, so remove it
printf " Backing up the existing $HOME/.emacs to $HOME/.emacs.pre-prelude\n"
Expand Down

0 comments on commit e9201db

Please sign in to comment.