浏览代码

Use SETUP_LOAD #4

pull/5/head
10sr 9 年前
父节点
当前提交
67f57101e8
共有 5 个文件被更改,包括 33 次插入11 次删除
  1. +26
    -6
      Makefile
  2. +2
    -2
      emacs.el
  3. +1
    -0
      setup.sh
  4. +1
    -0
      tmux.conf
  5. +3
    -3
      vimrc

+ 26
- 6
Makefile 查看文件

@@ -32,6 +32,7 @@ shrc_common_tpl =
emacs ?= $(shell which emacs 2>/dev/null)
git ?= $(shell which git 2>/dev/null)
curl ?= $(shell which curl 2>/dev/null)
grep ?= GREP_OPTIONS= $(shell which grep 2>/dev/null)

# Targets

@@ -44,8 +45,9 @@ test_syntaxes = test-syntax-el test-syntax-sh
test-syntax: $(test_syntaxes)

setups = setup-darwin setup-directories setup-emacs setup-gitconf \
setup-repository setup-util setup-tmux
setup: $(setups)
setup-repository setup-util setup-rc
# `make setup` to setup these all sounds to be too match
setup-all: $(setups)



@@ -112,7 +114,9 @@ endif
# setup repository
# ----------------

setup-repository:
setup-repository: $(dotfiles_dir)/.git

$(dotfiles_dir)/.git:
ifeq (,$(git))
false "Git not installed"
endif
@@ -264,13 +268,29 @@ endif



# tmux setup
# ----------
# setup rc files
# --------------

setup_rcs = setup-rc-vimrc setup-rc-tmux.conf setup-rc-emacs.el
setup-rc: $(setup_rcs)
.PHONY: $(setup_rcs)

setup-tmux:
command_extract_setup_load = $(grep) -e 'SETUP_LOAD: ' | \
sed -e 's/^.*SETUP_LOAD: //' -e 's|DOTFILES_DIR|$(dotfiles_dir)|'

$(setup_rcs): setup-rc-%: $(dotfiles_dir)/%
ifeq (,$(append_load))
@echo "\`append_load' is not defined. Just print load command."
cat "$<" | $(command_extract_setup_load)
else
cat "$<" | $(command_extract_setup_load) | tee -a "$(topfile)"
endif

setup-rc-vimrc: topfile = $(home)/.vimrc
setup-rc-tmux.conf: topfile = $(home)/.tmux.conf
setup-rc-emacs.el: topfile = $(home)/.emacs.d/init.el

$(dotfiles_dir)/%: setup-repository


# test


+ 2
- 2
emacs.el 查看文件

@@ -4,8 +4,8 @@

;;; Code:

;; (and (file-readable-p "~/.dotfiles/emacs.el")
;; (load-file "~/.dotfiles/emacs.el"))
;; SETUP_LOAD: (and (file-readable-p "DOTFILES_DIR/emacs.el")
;; SETUP_LOAD: (load-file "DOTFILES_DIR/emacs.el"))

;; make directories
(unless (file-directory-p (expand-file-name user-emacs-directory))


+ 1
- 0
setup.sh 查看文件

@@ -292,6 +292,7 @@ __EOC__
}

##############################

# setup scripts

_fetch_script(){


+ 1
- 0
tmux.conf 查看文件

@@ -1,4 +1,5 @@
# tmux.conf
# SETUP_LOAD: source "DOTFILES_DIR/tmux.conf"

run-shell 'tmux set -g status-right "${USER}@`hostname` | #(tmux -V) "'



+ 3
- 3
vimrc 查看文件

@@ -1,7 +1,7 @@
" "load external file
" if filereadable(expand('~/.dotfiles/vimrc'))
" source ~/.dotfiles/vimrc
" endif
" SETUP_LOAD: if filereadable(expand('DOTFILES_DIR/vimrc'))
" SETUP_LOAD: source DOTFILES_DIR/vimrc
" SETUP_LOAD: endif
if !isdirectory(expand('~/.vim'))
call mkdir(expand('~/.vim'))
endif


正在加载...
取消
保存