From 53f1704516f3e0c2bc5b363a55e608629357a84b Mon Sep 17 00:00:00 2001 From: 10sr Date: Tue, 6 Dec 2011 13:04:30 +0900 Subject: [PATCH 1/3] changes for windows --- .bashrc | 10 ++++++---- .emacs.el | 59 ++++++++++++++++++++++++++++++------------------------- 2 files changed, 38 insertions(+), 31 deletions(-) mode change 100644 => 100755 .emacs.el diff --git a/.bashrc b/.bashrc index 5b8da69..09f6f72 100755 --- a/.bashrc +++ b/.bashrc @@ -209,10 +209,12 @@ prompt_function(){ # used by PS1 local c3="\e[37m" local cdef="\e[0m" fi - local pwd=$(echo "${PWD}/" | sed -e "s:${HOME}:~:") - local oldpwd=$(echo "${OLDPWD}/" | sed -e "s:${HOME}:~:") - local date=$(LANG=C safe-cmd date +"%a, %d %b %Y %T %z") - local jobnum=$(jobs | wc -l) + iscygwin || { + local pwd=$(echo "${PWD}/" | sed -e "s:${HOME}:~:") + local oldpwd=$(echo "${OLDPWD}/" | sed -e "s:${HOME}:~:") + local date=$(LANG=C safe-cmd date +"%a, %d %b %Y %T %z") + local jobnum=$(jobs | wc -l) + } local git=$(safe-cmd __git_ps1 [GIT:%s]) local svn=$(type svn >/dev/null 2>&1 && safe-cmd __my_svn_ps1 [SVN:%s]) printf "${_MEMO}" diff --git a/.emacs.el b/.emacs.el old mode 100644 new mode 100755 index 0ebe356..b43f73f --- a/.emacs.el +++ b/.emacs.el @@ -331,6 +331,7 @@ (font-spec :family (nth 2 list) :size (nth 3 list)))) ; font spec is available in emacs23 and later, cannot used in emacs22 ;; (my-set-ascii-and-jp-font-with-size '("dejavu sans mono" 90 "takaogothic" 13)) ;; (my-set-ascii-and-jp-font-with-size '("dejavu sans mono" 100 "takaogothic" 14)) +;; (my-set-ascii-and-jp-font-with-size '("dejavu sans mono" 100 "ms gothic" 14)) ;; (my-set-ascii-and-jp-font-with-size '("monaco" 75 "takaogothic" 11)) ;; (my-set-ascii-and-jp-font-with-size '("monaco" 90 "takaogothic" 13)) ;; (my-set-ascii-and-jp-font-with-size '("ProggyCleanTTSZ" 120 "takaogothic" 11)) @@ -801,32 +802,12 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." t) (require 'multi-term nil t)) -(defun my-term () - "" - (interactive) - (if (require 'multi-term nil t) - (multi-term) - (ansi-term "/bin/bash"))) - -(defvar my-frame-term-plist nil) -(setplist my-frame-term-plist nil) -(defun my-execute-or-find-term () - "" - (interactive) - (let* ((buf (get 'my-frame-term-plist (selected-frame)))) - (if (and buf - (buffer-name buf)) - (switch-to-buffer buf) - (put 'my-frame-term-plist - (selected-frame) - (my-term))))) - ;; http://d.hatena.ne.jp/goinger/20100416/1271399150 ;; (setq term-ansi-default-program shell-file-name) (add-hook 'term-setup-hook (lambda () (setq term-display-table (make-display-table)))) (add-hook 'term-mode-hook (lambda () - (unless (memq (current-buffer) (and (require 'multi-term nil t) ; current buffer is not multi-term buffer + (unless (memq (current-buffer) (and (featurep 'multi-term) ; current buffer is not multi-term buffer (multi-term-list))) ;; (define-key term-raw-map "\C-q" 'move-beginning-of-line) ;; (define-key term-raw-map "\C-r" 'term-send-raw) @@ -1453,9 +1434,9 @@ Optional prefix ARG says how many lines to unflag; default is one line." ;; (goto-line line)) ;; (view-file (pop args)))))) -(defun eshell/git (&rest args) - "" - (eshell-parse-arguments (point-at-bol) (point-at-eol))) +;; (defun eshell/git (&rest args) +;; "" +;; (eshell-parse-arguments (point-at-bol) (point-at-eol))) (defun eshell/o (&optional file) (my-x-open (or file "."))) @@ -1578,7 +1559,8 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." ("ut" "slogin 03110414@un001.ecc.u-tokyo.ac.jp") ("aptin" "sudo apt-get install") ("u" "uname") - ("eless" "cat >>> (with-current-buffer (get-buffer-create \"*eshell output\") (erase-buffer) (setq buffer-read-only nil) (current-buffer)); (view-buffer (get-buffer \"*eshell output*\"))"))) + ("eless" "cat >>> (with-current-buffer (get-buffer-create \"*eshell output\") (erase-buffer) (setq buffer-read-only nil) (current-buffer)); (view-buffer (get-buffer \"*eshell output*\"))") + ("g" "git"))) (add-to-list 'eshell-output-filter-functions 'eshell-truncate-buffer) (apply 'eshell/addpath exec-path) (set (make-variable-buffer-local 'scroll-margin) 0) @@ -1692,13 +1674,36 @@ when SEC is nil, stop auto save if enabled." (defun my-execute-terminal () "" (interactive) - (if window-system + (if (and window-system + (not (eq window-system 'w32))) (let ((process-environment (cons "TERM=xterm" process-environment))) (start-process "terminal" nil my-desktop-terminal)) (my-execute-or-find-term))) +(defun my-term () + "" + (interactive) + (if (eq window-system 'w32) + (eshell t) + (if (featurep 'multi-term) + (multi-term) + (ansi-term "/bin/bash")))) + +(defvar my-frame-term-plist nil) +(setplist my-frame-term-plist nil) +(defun my-execute-or-find-term () + "" + (interactive) + (let* ((buf (get 'my-frame-term-plist (selected-frame)))) + (if (and buf + (buffer-name buf)) + (switch-to-buffer buf) + (put 'my-frame-term-plist + (selected-frame) + (my-term))))) + (defun my-format-time-string (&optional time) "" (let ((system-time-locale "C")) @@ -2001,7 +2006,7 @@ this is test, does not rename files" "" (mapcar (lambda (path) (add-to-list 'exec-path (expand-file-name path))) - args) + (reverse args)) (setenv "PATH" (mapconcat 'convert-standard-filename exec-path From bb40ff8eb9b9549d42584b5db8f02a7ae4720873 Mon Sep 17 00:00:00 2001 From: 10sr Date: Thu, 8 Dec 2011 10:20:40 +0900 Subject: [PATCH 2/3] small changes for windows --- .bashrc | 1 + .emacs.el | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.bashrc b/.bashrc index 73488ec..5e08989 100755 --- a/.bashrc +++ b/.bashrc @@ -325,6 +325,7 @@ if iscygwin; then alias cygsu="cygstart /cygwinsetup.exe" alias emacs="CYGWIN=tty emacs" echo "cygwin bash" + export PS1=" [\[\e[33m\]\w\[\e[0m\]]\n\[\e[32m\]\u@\H\[\e[0m\] \d \t \s.\v\nhist:\# jobs:\j \$ " fi ####################### diff --git a/.emacs.el b/.emacs.el index 4afb0df..1cdfb53 100755 --- a/.emacs.el +++ b/.emacs.el @@ -1680,8 +1680,10 @@ when SEC is nil, stop auto save if enabled." (defun my-execute-terminal () "" (interactive) - (if (and window-system - (not (eq window-system 'w32))) + (if (and (or (eq system-type 'windows-nt) + window-system) + my-desktop-terminal + ) (let ((process-environment (cons "TERM=xterm" process-environment))) (start-process "terminal" nil @@ -1691,7 +1693,7 @@ when SEC is nil, stop auto save if enabled." (defun my-term () "" (interactive) - (if (eq window-system 'w32) + (if (eq system-type 'windows-nt) (eshell t) (if (featurep 'multi-term) (multi-term) From 9e9fb1c8d1867fabe27e1f99143b6d4879d88507 Mon Sep 17 00:00:00 2001 From: 10sr Date: Thu, 8 Dec 2011 10:50:43 +0900 Subject: [PATCH 3/3] small changes --- .bashrc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.bashrc b/.bashrc index 5e08989..8b7a51b 100755 --- a/.bashrc +++ b/.bashrc @@ -9,8 +9,6 @@ safe-cmd(){ test -r /etc/bashrc && . /etc/bashrc -# export PS1="\[\e[32m\]\u@\H \[\e[33m\]\w\[\e[0m\] \d \t\n\s \# \j \$ " -# export PS1="[\[\e[33m\]\w\[\e[0m\]]\n\[\e[32m\]\u@\H\[\e[0m\] \d \t \s.\v\nhist:\# jobs:\j \$ " export PS1="\$(prompt_function)\$ " # PROMPT_COMMAND=prompt_function export PAGER="less" @@ -323,8 +321,9 @@ if iscygwin; then : alias setclip="tee /dev/clipboard" : alias catclip="cat /dev/clipboard | tr -d \\r" alias cygsu="cygstart /cygwinsetup.exe" - alias emacs="CYGWIN=tty emacs" + alias em="CYGWIN=tty emacs -nw" echo "cygwin bash" + # export PS1=" \[\e[32m\]\u@\H \[\e[33m\]\w\[\e[0m\] \d \t\n\s \# \j \$ " export PS1=" [\[\e[33m\]\w\[\e[0m\]]\n\[\e[32m\]\u@\H\[\e[0m\] \d \t \s.\v\nhist:\# jobs:\j \$ " fi