Diary over Finite Fields

515ひかるの日記と雑文

小ネタ集

小ネタ集.

.gitignore を作るときに無意識にしていたこと

最近よく grep をする. たとえばこの間の Advent Calendar を書くのに作ったテストディレクトリを git init してみる.

 % git init 
 % git status
 On branch master

Initial commit

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    whichprop.aux
    whichprop.dvi
    whichprop.fdb_latexmk
    whichprop.fls
    whichprop.log
    whichprop.pdf
    whichprop.synctex.gz
    whichprop.tex
    whichprop.thm

nothing added to commit but untracked files present (use "git add" to track)

このとき, ご存知のように(?) Git 管理下に置きたいのはまぁせいぜい tex, aux くらいであとはヴァージョン管理する必要はない. なので .gitginore ファイルを作るわけだが, 作る時に grep というかシェルコマンドが役に立つ.

 % git add whichprop.tex
 % git commit -m "first commmit"
 % git status | grep which | xargs -n 1
whichprop.aux
whichprop.dvi
whichprop.fdb_latexmk
whichprop.fls
whichprop.log
whichprop.pdf
whichprop.synctex.gz
whichprop.thm 

という出力ができる. この出力にしてしまったら簡単で,

% git status | grep which | xargs -n 1 > .gitignore
% cat .gitignore
whichprop.aux
whichprop.dvi
whichprop.fdb_latexmk
whichprop.fls
whichprop.log
whichprop.pdf
whichprop.synctex.gz
whichprop.thm

となる. まぁ小技って感じ.

grep "hogehoge" /path/to/target は, target 内に "hogehoge" があるかどうが検索できるもの. こんなふうに標準出力のやつを絞るのにも使える.

まぁ誰に教わるでもなく空気のようにやっていて, わしもこんな人間になってしまったなって感じ……正直誰かに教えたいわけでのなんでもなく, むしろ人間としては退化しているんじゃないかってくらいの気持ちである.

あと正直 xargs のことがよくわかっていない. こいつなんなんだろう.

Emacs

前に package.el の使い方を記事にしたが, el-get というものもあるらしく, それを導入してみた(解説する気はない). 最近 GitHub に dotfile リポジトリを作ったので git 管理下で設定ファイルいじれちゃうしなんなら merge とかできるしいいね. てきとうなことしていることも公開されちゃうけど.

それはともかく, el-get だとパッケージごとの設定を別のファイルに移せるらしく, 全部 init.el に書いていたのをわけられるとのことで分けてみた.

github.com

あくまでも個人用ですのでてきとうです. GitHub は結構ちゃんと読んでいると勉強になることがある.

el-get で yatex, auto-complete(-latex), yasnippets とかを導入. 今日はそんなことをしていて全然数学をしていなかった.

やれやれ