From 9c8a39c2cbc02b07097a59de4c7a9fd87d6128b3 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 31 May 2013 17:13:52 +0900 Subject: [PATCH 1/4] add alias datenum --- bashrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bashrc b/bashrc index f305ecd..428d94c 100755 --- a/bashrc +++ b/bashrc @@ -134,6 +134,8 @@ fi _timeformat_iso="%Y-%m-%dT%H:%M:%S%z" _timeformat_rfc2822="%a, %d %b %Y %T %z" +_timeformat_num="%Y%m%d%H%M%S" +alias datenum="date +$_timeformat_num" alias ls="ls -hCF${_coloroption}${_timeoption}" if ! with_coreutils From 541caed66ad0674a42cf41cb826ff96e7c40f98c Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 3 Jun 2013 12:05:53 +0900 Subject: [PATCH 2/4] add view-mode-search-word, not tested with gtags yet --- emacs.el | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/emacs.el b/emacs.el index 60b1e57..5c3e874 100644 --- a/emacs.el +++ b/emacs.el @@ -889,10 +889,31 @@ found, otherwise returns nil." (define-key view-mode-map "?" 'isearch-backward-regexp) (define-key view-mode-map "n" 'isearch-repeat-forward) (define-key view-mode-map "N" 'isearch-repeat-backward) + (define-key view-mode-map (kbd "C-m") 'my-view-mode-search-word) )) (global-set-key "\M-r" 'view-mode) (setq view-read-only t) +(defun my-view-mode-search-word (word) + "Search for word current directory and subdirectories. +If called intearctively, find word at point." + (interactive (list (thing-at-point 'symbol))) + (if word + (if (and (require 'gtags nil t) + (gtags-get-rootpath)) + (gtags-goto-tag word "s") + (if (eq 0 + (shell-command "git rev-parse --git-dir")) + (compilation-start (format "git --no-pager grep -nH -e '%s'" + word) + 'grep-mode) + ;; TODO: handle ack + (grep (format "%s '%s' -r ." + grep-command + word)))) + (message "No word at point.") + nil)) + (add-hook 'Man-mode-hook (lambda () (view-mode 1) @@ -1796,7 +1817,7 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." ;; misc funcs (defun my-grep () - "Use git-grep if avaliable.." + "Use git-grep if avaliable. Only called interactively." (interactive) (require 'grep) (let ((--grep-command-bak grep-command) From 3a534be9934ddad3f03916d39e2d0e64128d5cf5 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 3 Jun 2013 14:41:27 +0900 Subject: [PATCH 3/4] add reflect_mirrorlist --- bashrc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bashrc b/bashrc index 428d94c..5fa705f 100755 --- a/bashrc +++ b/bashrc @@ -234,6 +234,18 @@ null type pacmatic && { export PACMAN="pacmatic" } +_pacman_update_mirrorlist_with_reflector(){ + ml=/etc/pacman.d/mirrorlist + cmd="$(expr "$(grep reflector $ml)" : '# With: *\(.*\)')" + if test -z "$cmd" + then + cmd="reflector --verbose -l 5 --sort rate --save /etc/pacman.d/mirrorlist" + fi + sudo $cmd +} +null type reflector && test -f /etc/pacman.d/mirrorlist && \ + alias reflect_mirrorlist=_pacman_update_mirrorlist_with_reflector + null type apt-get && { alias aupgrade="sudo apt-get autoremove --yes && \ sudo apt-get update --yes && sudo apt-get upgrade --yes" From 2a4201e74a784681a2db5f2d4828cfe696a6dd83 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 3 Jun 2013 16:29:53 +0900 Subject: [PATCH 4/4] fix search f --- emacs.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emacs.el b/emacs.el index 5c3e874..88caa18 100644 --- a/emacs.el +++ b/emacs.el @@ -902,14 +902,14 @@ If called intearctively, find word at point." (if (and (require 'gtags nil t) (gtags-get-rootpath)) (gtags-goto-tag word "s") + (require 'grep) (if (eq 0 (shell-command "git rev-parse --git-dir")) (compilation-start (format "git --no-pager grep -nH -e '%s'" word) 'grep-mode) ;; TODO: handle ack - (grep (format "%s '%s' -r ." - grep-command + (grep (format "grep -nH -e '%s' -r ." word)))) (message "No word at point.") nil))