projects
/
dotfiles.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1c1836a
)
emacs - update install file
author
Peng Li
<seudut@gmail.com>
Sat, 18 Feb 2017 15:54:41 +0000
(23:54 +0800)
committer
Peng Li
<seudut@gmail.com>
Sat, 18 Feb 2017 15:54:41 +0000
(23:54 +0800)
emacs.d/install.pl
patch
|
blob
|
history
diff --git
a/emacs.d/install.pl
b/emacs.d/install.pl
index
333531a
..
ed92356
100755
(executable)
--- a/
emacs.d/install.pl
+++ b/
emacs.d/install.pl
@@
-1,26
+1,18
@@
#!/usr/bin/perl -w
#
#!/usr/bin/perl -w
#
-use 5.010;
+#
use strict;
use strict;
+use File::Basename;
+use Cwd;
+use Cwd "abs_path";
-##my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime;
-chomp (my $date = `date +%m%d`);
-
-if (-e "$ENV{HOME}/.emacs.d" ) {
- print "~/.emacs.d folder already exists.\nRename as ~/.emacs.d_bak_$date and continue yes (y) or no (n)? ";
- chomp (my $yorn = <STDIN>);
- while ($yorn ne "y" and $yorn ne "n") {
- print "Input y or n: ";
- chomp ($yorn = <STDIN>);
- }
+my $home = $ENV{'HOME'};
+my $emacsDir = dirname abs_path (__FILE__);
- exit if $yorn eq "n";
+die "~/.emacs.d or ~/init.el exist. Backup them first.\n"
+ if -e "$home/.init.el" or -e "$home/.emacs.d";
- ! system "mv", "$ENV{HOME}/.emacs.d", "$ENV{HOME}/.emacs.d_bak_$date" or die
- if $yorn eq "y";
-}
+print `ln -s $emacsDir $home/.emacs.d`;
-## link emacs.d folder
-! system "ln", "-s", "$ENV{HOME}/dotfiles/emacs.d", "$ENV{HOME}/.emacs.d" or die;
-say "DONE";
+print "Done.\n" unless $?;