Skip to content

Instantly share code, notes, and snippets.

@vaiorabbit
Created July 21, 2012 10:50
Show Gist options
  • Save vaiorabbit/3155418 to your computer and use it in GitHub Desktop.
Save vaiorabbit/3155418 to your computer and use it in GitHub Desktop.
grep / grep-find のデフォルト引数
; [2012-07-21] grep / grep-find のデフォルト引数。文字コードが混在していても使えるよう lv を利用している。
(setenv "LC_CTYPE" "ja_JP.UTF-8")
(setq grep-use-null-device nil)
(setq grep-command "lv -g -Au8 -Kej -Ou8 -Ia -n ")
(setq grep-find-command '("find . ! -name '*~' -type f -print0 | xargs -0 lv -g -Au8 -Kej -Ou8 -Ia -n "))
(defadvice grep (around grep-coding-setup activate)
(let ((coding-system-for-read 'utf-8))
ad-do-it))
; [OS X 対策] grep.el にある '(setenv "TERM" "emacs-grep")' という記述のせいで grep の検索結果バッファに
; tput: unknown terminal "emacs-grep"
; という行が並んでしまうことへの対策。シェルで env|grep TERM として見つけた結果ならば使えるだろう、と考えて
; grep-process-setup の最後に呼ばれるフックで "emacs-grep" を上書きするようにした。
(add-hook 'grep-setup-hook '(lambda () (setenv "TERM" "xterm-256color")) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment