Skip to content

Commit e9201db

Browse files
committed
[fix bbatsov#1248] [installer] provide switch to leave .emacs untouched
- if the user specifies the `-m/--no-move-dotemacs` option the installer will not invoke the backup `$HOME/.emacs` code block
1 parent 39da954 commit e9201db

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
### Changes
1515

16+
* [#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`
1617
* [#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.
1718
* [#1278](https://github.com/bbatsov/prelude/issues/1278): Don't disable `menu-bar-mode` unless `prelude-minimalistic-ui` is enabled.
1819
* [#1277](https://github.com/bbatsov/prelude/issues/1277): Make it possible to disable the creation of `Super`-based keybindings via `prelude-super-keybindings`.

utils/installer.sh

+13-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ colors_ () {
6060
# Defaults to 'https://github.com/bbatsov/prelude.git'
6161
# -i/--into
6262
# If one exists, install into the existing config
63+
# -m/--no-move-dotemacs
64+
# Leave '$HOME/.emacs' untouched
6365
# -n/--no-bytecompile
64-
# Skip the compilation of the prelude files.
66+
# Skip the compilation of the prelude files
6567
# -h/--help
6668
# Print help
6769
# -v/--verbose
@@ -75,6 +77,7 @@ usage() {
7577
printf " \t \t \t \t Defaults to $HOME/.emacs.d\n"
7678
printf " -s, --source [url] \t \t Clone Prelude from 'url'.\n"
7779
printf " \t \t \t \t Defaults to 'https://github.com/bbatsov/prelude.git'.\n"
80+
printf " -m, --no-move-dotemacs \t \t Leave '$HOME/.emacs' untouched.\n"
7881
printf " -n, --no-bytecompile \t \t Skip the bytecompilation step of Prelude.\n"
7982
printf " -i, --into \t \t \t Install Prelude into a subdirectory in the existing configuration\n"
8083
printf " \t \t \t \t The default behavior is to install Prelude into the existing\n"
@@ -104,6 +107,10 @@ do
104107
PRELUDE_INTO='true'
105108
shift 1
106109
;;
110+
-m | --no-move-dotemacs)
111+
PRELUDE_PRESERVE_DOTEMACS='true'
112+
shift 1
113+
;;
107114
-n | --no-bytecompile)
108115
PRELUDE_SKIP_BC='true'
109116
shift 1
@@ -135,6 +142,10 @@ then
135142
printf "INSTALL_DIR = $PRELUDE_INSTALL_DIR\n"
136143
printf "SOURCE_URL = $PRELUDE_URL\n"
137144
printf "$RESET"
145+
if [ -n "$PRELUDE_PRESERVE_DOTEMACS" ]
146+
then
147+
printf "Leaving ~/.emacs untouched.\n"
148+
fi
138149
if [ -n "$PRELUDE_SKIP_BC" ]
139150
then
140151
printf "Skipping bytecompilation.\n"
@@ -180,7 +191,7 @@ then
180191
printf "$YELLOW WARNING:$RESET Prelude requires Emacs $RED 25$RESET or newer!\n"
181192
fi
182193

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

0 commit comments

Comments
 (0)