From c96c7d734ee328e4ffbdc00e49ea0e5384338ada Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 17 Jan 2013 13:58:04 +0900 Subject: [PATCH 1/7] change tmux title when ssh --- bashrc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bashrc b/bashrc index c5d9d87..c609c5c 100755 --- a/bashrc +++ b/bashrc @@ -261,7 +261,12 @@ fi alias setup.py="sudo python3 setup.py install --record files.txt" -clock(){ +ssh(){ + __my_set_screen_title ssh + command ssh "$@" +} + +clk(){ local tformat="%Y/%m/%d %H:%M:%S %z" cal while true @@ -760,7 +765,7 @@ ${__my_c4}:: ${__my_cdef}[${__my_c2}\u@\H${__my_cdef}:${__my_c1}\w/${__my_cdef}] ${__my_c4}:: ${__my_cdef}l${SHLVL}n\#j\js\$? $(__my_ps1_scale) \D{%T} $(__my_ps1_script)\$ " PS1=$_PS1 -__my_set_tmux_title(){ +__my_set_screen_title(){ if test -n "$TMUX" then echo -ne "\033k$1\033\\" @@ -779,7 +784,7 @@ __my_set_title(){ esac } PROMPT_COMMAND="__my_set_title \${USER}@\${HOSTNAME}\:\${PWD}; -__my_set_tmux_title \"\$(basename \$PWD)/\"" +__my_set_screen_title \"\$(basename \$PWD)/\"" # copied from https://wiki.archlinux.org/index.php/X_resources invader(){ From 3f310079901a8f650218995f424a077cb31322b8 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 17 Jan 2013 16:02:20 +0900 Subject: [PATCH 2/7] add prefs about major-mode detection --- emacs.el | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/emacs.el b/emacs.el index fe2a1bb..a761385 100644 --- a/emacs.el +++ b/emacs.el @@ -280,9 +280,9 @@ found, otherwise returns nil." system-name (abbreviate-file-name default-directory))) -(run-with-idle-timer 3 - t - 'my-message-current-info) +;; (run-with-idle-timer 3 +;; t +;; 'my-message-current-info) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; minibuffer @@ -653,6 +653,17 @@ found, otherwise returns nil." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; some modes and hooks +;; todo: reg major mode when set explicitly + +;; Detect file type from shebang and set major-mode. +(add-to-list 'interpreter-mode-alist + '("python3" . python-mode)) +(add-to-list 'interpreter-mode-alist + '("python2" . python-mode)) + +;; (add-hook default-majorg-mode +;; 'my-detect-major-mode-from-shebang) + ;; http://fukuyama.co/foreign-regexp '(and (fetch-library "https://raw.github.com/k-talo/foreign-regexp.el/master/foreign-regexp.el" From 2ff4f56f14740d63ee6f33843902e98451bcf1f0 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 17 Jan 2013 20:12:08 +0900 Subject: [PATCH 3/7] fix for emacs term-mode --- bashrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bashrc b/bashrc index c609c5c..83c8bbb 100755 --- a/bashrc +++ b/bashrc @@ -766,7 +766,7 @@ ${__my_c4}:: ${__my_cdef}l${SHLVL}n\#j\js\$? $(__my_ps1_scale) \D{%T} $(__my_ps1 PS1=$_PS1 __my_set_screen_title(){ - if test -n "$TMUX" + if test -n "$TMUX" && test -z "$INSIDE_EMACS" then echo -ne "\033k$1\033\\" fi From 4abd55621193531a05528f1fef982c7d5c476617 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 17 Jan 2013 20:41:25 +0900 Subject: [PATCH 4/7] update tmux.conf.pl --- tmux.conf.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/tmux.conf.pl b/tmux.conf.pl index 39438a2..025f8d8 100755 --- a/tmux.conf.pl +++ b/tmux.conf.pl @@ -45,6 +45,7 @@ sub set_prefs { # this does not workd because `run' do script asyncly set("base-index", "1"); set("pane-base-index", "1"); + set("renumber-windows", "on"); setw("mode-keys", "vi"); set("default-command", "/bin/bash"); set("default-path", $ENV{"HOME"}); From 5972e87b1e90a91a557b36cae796b110dbc51b0b Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 17 Jan 2013 20:41:36 +0900 Subject: [PATCH 5/7] remove tmux.conf --- tmux.conf | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) delete mode 100644 tmux.conf diff --git a/tmux.conf b/tmux.conf deleted file mode 100644 index 025377c..0000000 --- a/tmux.conf +++ /dev/null @@ -1,48 +0,0 @@ -# soruce ~/.dotfiles/tmux.conf - -unbind C-b -set -g prefix C-z -bind-key C-z send-prefix -bind-key c command-prompt "new-window '%%'" - -set -g base-index 1 -set -g pane-base-index 1 - -setw -g mode-keys vi -set -g default-command /bin/bash -#set -g default-terminal screen-256color -#set -g default-terminal screen-16color -set default-path "${HOME}" # not work as i expected -set -g set-titles on -set -g display-panes-time 5000 - -#set -g status-left "" -#set -g status-right "#H | %a, %d %b %Y %T %z #(tmux -V)" -set -g status-right "${USER}@#H | #(tmux -V) " - -# default-color -set -g status-bg green -set -g status-fg white -set -g mode-bg green -set -g mode-fg white - -if "test `hostname` = arch-aspireone" \ - "set -g status-bg blue; set -g status-fg white; \ - set -g mode-bg blue; set -g mode-fg white; \ - set -g pane-active-border-fg blue;" -if "test `hostname` = darwin-mba.local" \ - "set -g status-bg yellow; set -g status-fg black; \ - set -g mode-bg yellow; set -g mode-fg black; \ - set -g pane-active-border-fg yellow;" -if "test `hostname` = newkiwi" \ - "set -g status-bg magenta; set -g status-fg white; \ - set -g mode-bg magenta; set -g mode-fg white; \ - set -g pane-active-border-fg magenta;" - -# face of currently active window name in status bar -setw -g window-status-current-fg black -setw -g window-status-current-bg white -setw -g window-status-current-attr bold - -set message-bg white -set message-fg black From 932ce488b4493488b9fdfc838824ad76442ccb9a Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 18 Jan 2013 14:38:07 +0900 Subject: [PATCH 6/7] do not die when tmux command failed --- tmux.conf.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmux.conf.pl b/tmux.conf.pl index 025f8d8..4c3e920 100755 --- a/tmux.conf.pl +++ b/tmux.conf.pl @@ -19,7 +19,7 @@ sub tmux { push(@command, @_); # print "@command, \n"; system(@command) == 0 - or die "system @command failed: $?"; + or warn "system @command failed: $?"; } sub set { From 5c300009caf855edfceda68d9116c997ce82f2d7 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 18 Jan 2013 14:40:00 +0900 Subject: [PATCH 7/7] do not add alias when command not found --- bashrc | 8 ++++---- emacs.el | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bashrc b/bashrc index 83c8bbb..38aaac4 100755 --- a/bashrc +++ b/bashrc @@ -146,10 +146,10 @@ null type e3em && alias e3=e3em #alias dirs="dirs -v -l | \grep -v \$(printf '%s$' \$PWD)" alias po=popd alias pu=pushd -alias sudo="sudo " # use aliases through sudo -alias sudoe="sudoedit" -alias halt="sudo halt" -alias reboot="sudo reboot" +null type sudo && alias sudo="sudo " # use aliases through sudo +null type sudoedit && alias sudoe="sudoedit" +null type halt && alias halt="sudo halt" +null type reboot && alias reboot="sudo reboot" null type dbus-send && { alias suspend="dbus-send --system --print-reply --dest=org.freedesktop.UPower \ /org/freedesktop/UPower org.freedesktop.UPower.Suspend" diff --git a/emacs.el b/emacs.el index a761385..c7cc6f7 100644 --- a/emacs.el +++ b/emacs.el @@ -360,13 +360,15 @@ found, otherwise returns nil." trailing ; trailing blanks newline ; newlines newline-mark ; use display table for newline + tab-mark empty ; empty lines at beg or end of buffer lines-tail ; lines over 80 )) ;; (setq whitespace-newline 'font-lock-comment-face) (add-to-list 'whitespace-display-mappings - `(newline-mark ?\n ,(vconcat "$\n")) - ) + `(newline-mark ?\n ,(vconcat "$\n"))) + (add-to-list 'whitespace-display-mappings ; not work + `(tab-mark ?\t ,(vconcat "^I\t"))) (global-whitespace-mode t) (when (eq (display-color-cells) 256)