From 2d055effba811660939ed3a5166fe65d5caa26a3 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 15 Nov 2013 12:17:18 +0900 Subject: [PATCH] __try_exec -> _safe_run --- emacs.el | 1 + shrc | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/emacs.el b/emacs.el index d5c6103..483d572 100644 --- a/emacs.el +++ b/emacs.el @@ -94,6 +94,7 @@ otherwise the path where the library installed." markdown-mode yaml-mode ;; ack + color-moccur ))) diff --git a/shrc b/shrc index ff12e9e..ea24abe 100755 --- a/shrc +++ b/shrc @@ -6,7 +6,7 @@ null(){ "$@" >/dev/null 2>&1 } -__try_exec(){ +__safe_run(){ type $1 >/dev/null 2>&1 && "$@" } @@ -764,15 +764,15 @@ alias dest="gpg_stream de" showinfo(){ echo "Japanese letters are 表示可能" - __try_exec diskinfo + __safe_run diskinfo ! isdarwin && test -n "${DISPLAY}" && { - __try_exec xrandr | \grep --color=never ^Screen + __safe_run xrandr | \grep --color=never ^Screen } - iswindows || __try_exec finger $USER - LANG=C __try_exec id - __try_exec xset q + iswindows || __safe_run finger $USER + LANG=C __safe_runc id + __safe_run xset q } x(){ @@ -1043,7 +1043,7 @@ GIT_PS1_SHOWUPSTREAM=t __my_ps1_git(){ null type __git_ps1 || return $last null git rev-parse --git-dir >/dev/null 2>&1 || return $last - __git_ps1 "[GIT:$(__try_exec git config --get user.name):%s]" + __git_ps1 "[GIT:$(__safe_run git config --get user.name):%s]" } __my_ps1_ipaddr(){