From d5194bc537d3e643acbcb67664be108ac627cb5b Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 30 Jan 2012 18:59:28 +0900 Subject: [PATCH 001/269] fix bug --- emacs.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/emacs.el b/emacs.el index d8d636c..d15339a 100644 --- a/emacs.el +++ b/emacs.el @@ -1131,14 +1131,15 @@ if arg is omitted use value of `buffer-list'." (defun my-dired-echo-file-head (&optional arg) "" - (interactive) + (interactive "P") (let ((f (dired-get-filename))) (message "%s" (with-temp-buffer (insert-file-contents f) (buffer-substring-no-properties (point-min) - (progn (goto-line (or arg - 10)) + (progn (goto-line (if arg + (prefix-numeric-value arg) + 10)) (point-at-eol))))))) (defun my-dired-diff () From 457612f170f804455eba8988fcfbd58788bd5a2f Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 30 Jan 2012 19:01:43 +0900 Subject: [PATCH 002/269] rm my-dired-find-file --- emacs.el | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/emacs.el b/emacs.el index d15339a..1925cfd 100644 --- a/emacs.el +++ b/emacs.el @@ -1328,22 +1328,6 @@ otherwise, use `pack-default-extension' for pack." (interactive) (my-x-open (dired-get-filename t t))) -(defun my-dired-up-directory () - "" - (interactive) - (my-dired-find-file "..")) - -(defun my-dired-find-file (&optional filename) - "if the file to open is a directory, kill current buffer after opening that file." - (interactive) - (let ((f (expand-file-name (or filename - (dired-get-filename)))) - (bf (current-buffer))) - (find-file f) - (when (and (file-directory-p f) - (not (get-buffer-window bf))) - (kill-buffer bf)))) - (if (eq window-system 'mac) (setq dired-listing-switches "-lhFG") (setq dired-listing-switches "-lhFG --time-style=long-iso") @@ -1412,9 +1396,6 @@ otherwise, use `pack-default-extension' for pack." (define-key dired-mode-map "P" 'my-dired-do-pack-or-unpack) (define-key dired-mode-map "a" 'my-dired-display-all-mode) (define-key dired-mode-map "/" 'dired-isearch-filenames) - ;; (substitute-key-definition 'dired-advertised-find-file 'my-dired-find-file dired-mode-map) - ;; (substitute-key-definition 'dired-up-directory 'my-dired-up-directory dired-mode-map) - ;; (define-key dired-mode-map (kbd "DEL") 'my-dired-up-directory) (define-key dired-mode-map (kbd "DEL") 'dired-up-directory) (substitute-key-definition 'dired-next-line 'my-dired-next-line dired-mode-map) (substitute-key-definition 'dired-previous-line 'my-dired-previous-line dired-mode-map) From 00149693d76252ba0f008ece508d283592866963 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 30 Jan 2012 19:02:29 +0900 Subject: [PATCH 003/269] rm commented pref and advice --- emacs.el | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/emacs.el b/emacs.el index 1925cfd..31c05aa 100644 --- a/emacs.el +++ b/emacs.el @@ -1405,21 +1405,6 @@ otherwise, use `pack-default-extension' for pack." (when (file-readable-p file) (delete-file file))))) -;; http://homepage1.nifty.com/blankspace/emacs/dired.html -;; (add-hook 'dired-load-hook -;; (lambda () -;; (load-library "ls-lisp") -;; (setq ls-lisp-dirs-first t) -;; (setq dired-listing-switches "-alhF"))) ;これ書く場所間違えてね? - -;; (defadvice dired-next-line (after dired-next-line-print-directory activate) -;; "print current directory when go down line" -;; (dired-print-current-dir-and-file)) - -;; (defadvice dired-previous-line (after dired-previous-line-print-directory activate) -;; "print current directory when go up line" -;; (dired-print-current-dir-and-file)) - ;; http://blog.livedoor.jp/tek_nishi/archives/4693204.html (defun my-dired-toggle-mark() From ead561d7cb092fead83449b2b1482adcbddfc2aa Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 30 Jan 2012 19:05:51 +0900 Subject: [PATCH 004/269] rm my delete-trailing-whitespace --- emacs.el | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/emacs.el b/emacs.el index 31c05aa..d9c0f27 100644 --- a/emacs.el +++ b/emacs.el @@ -1777,7 +1777,7 @@ when SEC is nil, stop auto save if enabled." sgml-mode c-mode c++-mode)) -(setq my-auto-indent-buffer-mode-list nil) +(setq my-auto-indent-buffer-mode-list nil) ;disable (defun my-indent-buffer () "indent whole buffer." (interactive) @@ -1856,15 +1856,6 @@ this is test, does not rename files" ;; nil ;; func)))) -;; delete-trailing-whitespace -;; (defun my-delete-blanks-on-eol () -;; "" -;; (interactive) -;; (save-excursion -;; (goto-char (point-min)) -;; (while (re-search-forward "[ \t]+$" nil t) -;; (replace-match "" nil nil)))) - (defvar my-revert-buffer-if-needed-last-buffer nil) (defun my-revert-buffer-if-needed () From c3b59b482f2466df2ac9679854601055cf0f5436 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 30 Jan 2012 19:11:29 +0900 Subject: [PATCH 005/269] rm comment --- emacs.el | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/emacs.el b/emacs.el index d9c0f27..27e5b8e 100644 --- a/emacs.el +++ b/emacs.el @@ -621,7 +621,7 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." 'executable-make-buffer-file-executable-if-script-p) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; mode関連 +;; mode (add-hook 'verilog-mode-hook (lambda () @@ -1971,14 +1971,6 @@ this is test, does not rename files" (modify-frame-parameters (selected-frame) default-frame-alist)))) t) - ;; (add-hook 'make-frame-hook - ;; (lambda () - ;; (run-with-timer 1 - ;; nil - ;; (lambda () - ;; (modify-frame-parameters (selected-frame) - ;; initial-frame-alist)))) - ;; t) (add-hook 'kill-emacs-hook 'my-window-size-save)) From 028432c35cd70587064803965997dfc5ab29ae56 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 30 Jan 2012 19:12:22 +0900 Subject: [PATCH 006/269] rm almost all buffer killing functions --- emacs.el | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/emacs.el b/emacs.el index 27e5b8e..b55000d 100644 --- a/emacs.el +++ b/emacs.el @@ -462,42 +462,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; buffer killing -(defun kill-buffer-by-major-mode (mode &optional exclude-current-buffer-p) ;mapcarとかつかって全部書き換える - "kill buffers. -if EXCLUDE-CURRENT-BUFFER-P is non-nil, never kill current buffer" - (interactive "xmajor mode of buffer to kill: ") - (save-excursion - (let ((bflist (buffer-list)) - (cbf (current-buffer)) - bf) - (while bflist - (setq bf (pop bflist)) - (set-buffer bf) - (if (and (eq mode major-mode) ;メジャーモードが一致し、かつ - (not (and exclude-current-buffer-p ;今のバッファを除外、今のバッファと一致 がともには満たされない - (eq bf cbf)))) - (kill-buffer bf)))))) - -(defun my-kill-this-buffer-when-hide (&optional buffer all-frames) - "" - (interactive) - (let ((bf (or buffer - (current-buffer)))) - (if (or (not buffer) (get-buffer-window bf all-frames)) - (run-with-timer 3 nil 'my-kill-this-buffer-when-hide bf all-frames) - (kill-buffer bf)))) -;; (add-hook 'dired-mode-hook -;; 'my-kill-this-buffer-when-hide) - -(defvar my-kill-previous-buffer nil) -(defun my-kill-previous-buffer () - "" - (when my-kill-previous-buffer - (kill-buffer my-kill-previous-buffer)) - (setq my-kill-previous-buffer (current-buffer))) -;; (add-hook 'dired-mode-hook -;; 'my-kill-previous-buffer) - (defun my-query-kill-this-buffer () "" (interactive) From 6a2c9aa556257fb372c390d39c8f877e09063700 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 31 Jan 2012 11:04:01 +0900 Subject: [PATCH 007/269] when windows x-clipboard-yank dont work --- emacs.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs.el b/emacs.el index d8d636c..8cef07b 100644 --- a/emacs.el +++ b/emacs.el @@ -605,7 +605,8 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ) (setq x-select-enable-clipboard t ; these settings seems to be useless when using emacs in terminal x-select-enable-primary nil) - (global-set-key "\C-y" 'x-clipboard-yank)) + ;; (global-set-key "\C-y" 'x-clipboard-yank) + ) ;; urlに細かい説明あり。でも設定は上記だけでよさそう ;; http://garin.jp/doc/Linux/xwindow_clipboard From 05cf8daae7a6950139a45538e4e93719ab54526a Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 31 Jan 2012 13:37:30 +0900 Subject: [PATCH 008/269] add comment --- emacs.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs.el b/emacs.el index b55000d..3fa4d48 100644 --- a/emacs.el +++ b/emacs.el @@ -72,6 +72,7 @@ (prefer-coding-system 'utf-8-unix) (setq system-time-locale "C") +;; my prefix map (defvar my-prefix-map (make-sparse-keymap)) (add-hook 'after-init-hook From 4634aa6ab4eb054b6a9f614e9946b1380a4cee48 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 31 Jan 2012 18:55:13 +0900 Subject: [PATCH 009/269] add jsm extension --- emacs.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs.el b/emacs.el index b5642d8..351889c 100644 --- a/emacs.el +++ b/emacs.el @@ -685,7 +685,8 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." "https://github.com/mooz/js2-mode/raw/master/js2-mode.el" t) (autoload 'js2-mode "js2-mode" nil t) - (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))) + (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode)) + (add-to-list 'auto-mode-alist '("\\.jsm$" . js2-mode))) ;; (add-hook 'js2-mode-hook ;; (lambda () ;; (add-hook 'before-save-hook From c89a964fa9adf6884231070522f669cca6b18161 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 1 Feb 2012 13:56:38 +0900 Subject: [PATCH 010/269] remove my func --- emacs.el | 8 -------- 1 file changed, 8 deletions(-) diff --git a/emacs.el b/emacs.el index 351889c..4063806 100644 --- a/emacs.el +++ b/emacs.el @@ -673,14 +673,6 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (c-toggle-hungry-state 1) )) -(defun my-compile-c-this-file () - "" - (interactive) - (compile (format "gcc -Wall -g -o %s %s" - (file-name-sans-extension buffer-file-name) - buffer-file-name))) -;; (when (require 'c nil t)(c-toggle-hungry-state t) - (when (dllib-if-unfound "js2-mode" "https://github.com/mooz/js2-mode/raw/master/js2-mode.el" t) From 3eb5e08dbcca3d2c85f685eca44e7254a9022ccf Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 1 Feb 2012 16:15:58 +0900 Subject: [PATCH 011/269] setPrefs to ext --- _keysnail.js | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/_keysnail.js b/_keysnail.js index 7ffd59f..1078bf1 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -27,25 +27,6 @@ function ignore(k, i) [k, null]; //// firefox // style.register("#bookmarksPanel > hbox,#history-panel > hbox {display: none !important;} //#urlbar-container{max-width: 500px !important;}"); -util.setPrefs( - { - "browser.tabs.loadDivertedInBackground": true, - "dom.disable_window_open_feature.location": false, - "dom.max_script_run_time": 30, - "browser.bookmarks.max_backups":0, - "browser.urlbar.autocomplete.enabled":false, - "browser.cache.memory.capacity":16384, - "browser.sessionhistory.max_total_viewers":8, - "browser.download.manager.closeWhenDone":true, - "browser.download.useDownloadDir":false, - "browser.tabs.closeWindowWithLastTab":false, - "network.dns.disableIPv6":true, - "browser.urlbar.trimURLs":false, - "browser.fullscreen.autohide":false, - "keyword.URL":"http://www.bing.com/search?q=", - } -); - /////////////////////////////////// //検索エンジン plugins.options["search-url-list"] = [ @@ -177,6 +158,27 @@ plugins.options["twitter_client.use_jmp"] = true; //////////////////////////////////////////// // エクステ +ext.add('my-setpref', function(){ + util.setPrefs( + { + "browser.tabs.loadDivertedInBackground": true, + "dom.disable_window_open_feature.location": false, + "dom.max_script_run_time": 30, + "browser.bookmarks.max_backups":0, + "browser.urlbar.autocomplete.enabled":false, + "browser.cache.memory.capacity":16384, + "browser.sessionhistory.max_total_viewers":8, + "browser.download.manager.closeWhenDone":true, + "browser.download.useDownloadDir":false, + "browser.tabs.closeWindowWithLastTab":false, + "network.dns.disableIPv6":true, + "browser.urlbar.trimURLs":false, + "browser.fullscreen.autohide":false, + "keyword.URL":"http://www.bing.com/search?q=", + } + ); +}, 'my setpref'); + ext.add('auto-install-plugins', function(ev, arg){ var urls = [ 'https://github.com/mooz/keysnail/raw/master/plugins/yet-another-twitter-client-keysnail.ks.js', From a5438bf367daee0ac543a552eb13f6367e196c74 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 1 Feb 2012 17:25:09 +0900 Subject: [PATCH 012/269] add eshell prefs --- emacs.el | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/emacs.el b/emacs.el index 4063806..4f4a6eb 100644 --- a/emacs.el +++ b/emacs.el @@ -805,6 +805,13 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (require 'multi-term nil t) (setq multi-term-switch-after-close nil)) +(defun my-term-quit-or-send-raw () + "" + (interactive) + (if (get-buffer-process (current-buffer)) + (call-interactively 'term-send-raw) + (kill-buffer))) + ;; http://d.hatena.ne.jp/goinger/20100416/1271399150 ;; (setq term-ansi-default-program shell-file-name) (add-hook 'term-setup-hook (lambda () @@ -820,6 +827,7 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ;; (define-key term-raw-map "\C-t" 'set-mark-command) (define-key term-raw-map "\C-x" (lookup-key (current-global-map) "\C-x")) (define-key term-raw-map "\C-z" (lookup-key (current-global-map) "\C-z"))) + (define-key term-raw-map "q" 'my-term-quit-or-send-raw) (define-key term-raw-map (kbd "ESC") 'term-send-raw) (define-key term-raw-map [delete] 'term-send-raw) (define-key term-raw-map "\C-h" 'term-send-backspace) @@ -1500,6 +1508,7 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." (eshell-send-input)))) (setq eshell-directory-name "~/.emacs.d/eshell/") +(setq eshell-term-name "eterm-color") (setq eshell-scroll-to-bottom-on-input t) (setq eshell-cmpl-ignore-case t) (setq eshell-cmpl-cycle-completions nil) @@ -1561,21 +1570,25 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." (mapcar (lambda (alias) (add-to-list 'eshell-command-aliases-list alias)) - '(("ll" "ls -l") - ("la" "ls -a") - ("lla" "ls -al") - ("ut" "slogin 03110414@un001.ecc.u-tokyo.ac.jp") - ("aptin" "sudo apt-get install") - ("u" "uname") + '( + ; ("ll" "ls -l $*") + ; ("la" "ls -a $*") + ; ("lla" "ls -al $*") + ("ut" "slogin 03110414@un001.ecc.u-tokyo.ac.jp $*") + ("aptin" "apt-get install $*") ("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"))) + ("g" "git $*") + )) + ; (eshell/alias "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) - (eshell/export "GIT_PAGER=") - (eshell/export "GIT_EDITOR=") + ;; (eshell/export "GIT_PAGER=") + ;; (eshell/export "GIT_EDITOR=") (eshell/export "LC_MESSAGES=C") - (eshell/export "TERM=xterm") + (add-to-list 'eshell-visual-commands "vim") + (add-to-list 'eshell-visual-commands "git") + (switch-to-buffer (current-buffer)) ; move buffer top of list )) ;; (eval-after-load "em-alias" From 105bb6ea0e976984f2808e3edfdd7037d28c129a Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 1 Feb 2012 18:08:43 +0900 Subject: [PATCH 013/269] rm eshell frame buffer func --- emacs.el | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/emacs.el b/emacs.el index 4f4a6eb..55b561d 100644 --- a/emacs.el +++ b/emacs.el @@ -1418,20 +1418,6 @@ Optional prefix ARG says how many lines to unflag; default is one line." (point)) (backward-delete-char 1))) -(defvar my-eshell-frame-buffer-alist nil) - -(defun my-eshell-frame-buffer (frame) - "get buffer associated with FRAME. if buffer doesnt exist or killed, return nil." - (let ((bf (cdr (assq frame my-eshell-frame-buffer-alist)))) - (and bf ;関連付けられたバッファが存在し - (buffer-name bf) ;かつkillされてない - bf))) - -(add-hook 'eshell-mode-hook - (lambda () - (add-to-list 'my-eshell-frame-buffer-alist - (cons (selected-frame) (current-buffer))))) - (defun my-file-owner-p (file) "t if FILE is owned by me." (eq (user-uid) (nth 2 (file-attributes file)))) @@ -1604,11 +1590,6 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." ;; ;; (eshell/alias "ut" "ssh g841105@un001.ecc.u-tokyo.ac.jp") ;; (add-to-list 'recentf-exclude (concat eshell-directory-name "alias")))) -;; (define-key my-prefix-map (kbd "C-s") (lambda () -;; (interactive) -;; (eshell-cd-default-directory (buffer-name (or (my-eshell-frame-buffer (selected-frame)) -;; (eshell t)))))) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 最終更新日時を得る From 9b29ec372f73931a37c1dd0b4a3d4fe0e2495dd1 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 1 Feb 2012 21:32:39 +0900 Subject: [PATCH 014/269] rearrange code --- emacs.el | 140 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 74 insertions(+), 66 deletions(-) diff --git a/emacs.el b/emacs.el index 55b561d..fa08600 100644 --- a/emacs.el +++ b/emacs.el @@ -94,16 +94,6 @@ (lambda () (kill-buffer "*scratch*"))) -(defun my-delete-frame-or-kill-emacs () - "delete frame when opening multiple frame, kill emacs when only one." - (interactive) - (if (eq 1 - (length (frame-list))) - (save-buffers-kill-emacs) - (delete-frame))) -(global-set-key (kbd "C-x C-c") 'my-delete-frame-or-kill-emacs) -(define-key my-prefix-map (kbd "C-x C-c") 'save-buffers-kill-emacs) - ;; modifier keys (setq mac-option-modifier 'control) (setq w32-apps-modifier 'meta) @@ -480,9 +470,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; global keys -(define-key my-prefix-map (kbd "C-f") 'make-frame-command) (define-key my-prefix-map (kbd "C-o") 'occur) -(define-key my-prefix-map (kbd "C-s") 'my-execute-terminal) ;; (define-key my-prefix-map (kbd "C-h") help-map) (global-set-key (kbd "C-\\") help-map) @@ -743,9 +731,9 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; frame buffer -;; (add-hook 'after-make-frame-functions -;; (lambda (frame) -;; (recentf-open-files))) +(add-hook 'after-make-frame-functions + (lambda (frame) + (switch-to-buffer (recentf-open-files)))) ;; (defvar aaa nil) ;; (plist-get aaa 'abc) @@ -754,24 +742,29 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (defvar my-frame-buffer-plist nil) ;; (setplist my-frame-buffer-plist nil) -(defun my-frame-buffer-add () +(defun my-frame-buffer-add (&optional buf frame) "" (setq my-frame-buffer-plist (plist-put my-frame-buffer-plist - (selected-frame) - (let ((lst (my-frame-buffer-get))) + (or frame + (selected-frame)) + (let ((lst (my-frame-buffer-get frame))) (if lst (add-to-list 'lst - (current-buffer)) - (list (current-buffer))))))) + (or buf + (current-buffer))) + (list (or buf + (current-buffer)))))))) -(defun my-frame-buffer-remove () +(defun my-frame-buffer-remove (&optional buf frame) "" (setq my-frame-buffer-plist (plist-put my-frame-buffer-plist - (selected-frame) - (delq (current-buffer) - (my-frame-buffer-get))))) + (or frame + (selected-frame)) + (delq (or buf + (current-buffer)) + (my-frame-buffer-get frame))))) (defun my-frame-buffer-get (&optional frame) "" @@ -779,21 +772,73 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (or frame (selected-frame)))) -(defun my-frame-buffer-kill-all-buffer (frame) +(defun my-frame-buffer-kill-all-buffer (&optional frame) "" (mapcar 'kill-buffer (my-frame-buffer-get frame))) (add-hook 'find-file-hook 'my-frame-buffer-add) -;; (add-hook 'dired-mode-hook -;; 'my-frame-buffer-add) +(add-hook 'term-mode-hook + 'my-frame-buffer-add) +(add-hook 'eshell-mode-hook + 'my-frame-buffer-add) + (add-hook 'kill-buffer-hook 'my-frame-buffer-remove) (add-hook 'delete-frame-functions 'my-frame-buffer-kill-all-buffer) -(frame-parameters (selected-frame)) + +(defvar my-desktop-terminal "roxterm") +(defun my-execute-terminal () + "" + (interactive) + (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 + my-desktop-terminal)) + (my-term))) + +(defun my-term () + "open terminal buffer and return that buffer." + (interactive) + (if (eq system-type 'windows-nt) + (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 (plist-get my-frame-term-plist (selected-frame)))) + (if (and buf + (buffer-name buf)) + (switch-to-buffer buf) + (setq my-frame-term-plist + (plist-put my-frame-term-plist + (selected-frame) + (my-term)))))) + +(defun my-delete-frame-or-kill-emacs () + "delete frame when opening multiple frame, kill emacs when only one." + (interactive) + (if (eq 1 + (length (frame-list))) + (save-buffers-kill-emacs) + (delete-frame))) + +(define-key my-prefix-map (kbd "C-s") 'my-execute-terminal) +(define-key my-prefix-map (kbd "C-f") 'make-frame-command) +(global-set-key (kbd "C-x C-c") 'my-delete-frame-or-kill-emacs) +(define-key my-prefix-map (kbd "C-x C-c") 'save-buffers-kill-emacs) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; term mode @@ -1438,7 +1483,7 @@ Optional prefix ARG says how many lines to unflag; default is one line." ;; (defun eshell/git (&rest args) ;; "" -;; (eshell-parse-arguments (point-at-bol) (point-at-eol))) +;; ) (defun eshell/o (&optional file) (my-x-open (or file "."))) @@ -1660,43 +1705,6 @@ when SEC is nil, stop auto save if enabled." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; misc funcs -(defvar my-desktop-terminal "roxterm") -(defun my-execute-terminal () - "" - (interactive) - (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 - my-desktop-terminal)) - (my-execute-or-find-term))) - -(defun my-term () - "open terminal buffer and return that buffer." - (interactive) - (if (eq system-type 'windows-nt) - (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 (plist-get my-frame-term-plist (selected-frame)))) - (if (and buf - (buffer-name buf)) - (switch-to-buffer buf) - (setq my-frame-term-plist - (plist-put my-frame-term-plist - (selected-frame) - (my-term)))))) - (defun my-format-time-string (&optional time) "" (let ((system-time-locale "C")) From b04a0fc4062c3aa34ceb67257baefcabd0541a2c Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 1 Feb 2012 21:34:12 +0900 Subject: [PATCH 015/269] rm frame term func --- emacs.el | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/emacs.el b/emacs.el index fa08600..6936069 100644 --- a/emacs.el +++ b/emacs.el @@ -813,20 +813,6 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (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 (plist-get my-frame-term-plist (selected-frame)))) - (if (and buf - (buffer-name buf)) - (switch-to-buffer buf) - (setq my-frame-term-plist - (plist-put my-frame-term-plist - (selected-frame) - (my-term)))))) - (defun my-delete-frame-or-kill-emacs () "delete frame when opening multiple frame, kill emacs when only one." (interactive) From 4bffcce8be1f180ed2b491a620b19db9764c5de2 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 1 Feb 2012 21:53:45 +0900 Subject: [PATCH 016/269] fix bug --- emacs.el | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/emacs.el b/emacs.el index 6936069..bdf2416 100644 --- a/emacs.el +++ b/emacs.el @@ -731,16 +731,11 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; frame buffer -(add-hook 'after-make-frame-functions - (lambda (frame) - (switch-to-buffer (recentf-open-files)))) - -;; (defvar aaa nil) -;; (plist-get aaa 'abc) -;; (setq aaa (plist-put aaa 'abc 'efg)) +(add-hook 'before-make-frame-hook + (lambda () + (switch-to-buffer "*Messages*"))) (defvar my-frame-buffer-plist nil) -;; (setplist my-frame-buffer-plist nil) (defun my-frame-buffer-add (&optional buf frame) "" From e8e1f43b2b48c7b9af1525aefc8b3537fb04b9fe Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 2 Feb 2012 15:50:30 +0900 Subject: [PATCH 017/269] rm buffer cycle func --- emacs.el | 65 -------------------------------------------------------- 1 file changed, 65 deletions(-) diff --git a/emacs.el b/emacs.el index bdf2416..f5dacdd 100644 --- a/emacs.el +++ b/emacs.el @@ -705,10 +705,6 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (define-key view-mode-map "q" 'bury-buffer))) (global-set-key "\M-r" 'view-mode) (setq view-read-only t) -;; (add-hook 'find-file-hook -;; (lambda () -;; (when buffer-read-only -;; (view-mode 1)))) (add-hook 'Man-mode-hook (lambda () @@ -899,56 +895,6 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (with-current-buffer bf (equal (expand-file-name default-directory) cdir)))) -(defun echo-buffer-list (&optional blist) - "echo buffer list as string. BLIST is list with buffer objects as elements. -if arg is omitted use value of `buffer-list'." - (interactive) - (message (or (mapconcat (lambda (bf) - (concat (buffer-name bf) - "\t" - (with-current-buffer bf - (symbol-name major-mode)) - "\t" - (abbreviate-file-name (buffer-file-name bf)))) - (or blist - (buffer-list)) - "\n") - ""))) - -(defun my-buffer-list () - "return buffer list." - (delq nil - (mapcar (lambda (bf) - (with-current-buffer bf - (and buffer-file-name - bf))) - (buffer-list (selected-frame))))) - -(defvar buffer-switch-list-function 'my-buffer-list) - -(defun switch-to-previous-buffer-cycle (&optional silent-p) - "" - (interactive) - (let ((bl (funcall buffer-switch-list-function))) - (when bl - (bury-buffer (car bl)) - (switch-to-buffer (or (nth 1 bl) - (car bl))) - (or silent-p - (echo-buffer-list (funcall buffer-switch-list-function)))))) - -(defun switch-to-next-buffer-cycle (&optional silent-p) - "" - (interactive) - (let* ((bl (funcall buffer-switch-list-function)) - (bf (nth (- (length bl) - 1) - bl))) - (when bl - (switch-to-buffer bf) - (or silent-p - (echo-buffer-list (funcall buffer-switch-list-function)))))) - (iswitchb-mode 1) (defun iswitchb-buffer-display-other-window () @@ -957,17 +903,6 @@ if arg is omitted use value of `buffer-list'." (let ((iswitchb-default-method 'display)) (call-interactively 'iswitchb-buffer))) -(defun switch-to-other-buffer () - "" - (interactive) - (let ((buffer-switch-list-function 'buffer-list)) - (switch-to-previous-buffer-cycle t))) - -(global-set-key (kbd "C-.") 'switch-to-previous-buffer-cycle) -(global-set-key (kbd "C-,") 'switch-to-next-buffer-cycle) -;; (global-set-key (kbd "C-\\") 'switch-to-other-buffer) -;; (global-set-key (kbd "C-\\") 'bury-buffer) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sdic From 424fbfdcae4548b9fd1cc7f733356b477b50de5c Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 2 Feb 2012 21:36:34 +0900 Subject: [PATCH 018/269] add python-mode pref --- emacs.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/emacs.el b/emacs.el index f5dacdd..03d39d4 100644 --- a/emacs.el +++ b/emacs.el @@ -603,8 +603,18 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (shell-command (buffer-substring-no-properties (point-at-bol) (point)))) +(add-hook 'python-mode-hook + (lambda () + ())) + +(defun my-python-run-as-command () + "" + (interactive) + (shell-command (concat python-command " " buffer-file-name))) + (add-hook 'inferior-python-mode-hook (lambda () + (set-window-text-height (display-buffer (current-buffer) t) 7) (define-key inferior-python-mode-map (kbd "") 'comint-previous-input) (define-key inferior-python-mode-map (kbd "") 'comint-next-input))) From 1381e544a199976749659bcfd1572cc4c077fd35 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 3 Feb 2012 15:32:15 +0900 Subject: [PATCH 019/269] change diff face --- emacs.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/emacs.el b/emacs.el index 03d39d4..2d004e4 100644 --- a/emacs.el +++ b/emacs.el @@ -585,11 +585,14 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (add-hook 'diff-mode-hook (lambda () (view-mode 1) + (set-face-foreground 'diff-file-header-face nil) + (set-face-foreground 'diff-header-face nil) (set-face-foreground 'diff-index-face "blue") - (set-face-foreground 'diff-hunk-header-face "magenda") + (set-face-foreground 'diff-hunk-header-face "cyan") + (set-face-foreground 'diff-context-face nil) (set-face-foreground 'diff-removed-face "red") - (set-face-foreground 'diff-added-face "blue") - (set-face-foreground 'diff-changed-face "syan") + (set-face-foreground 'diff-added-face "green") + (set-face-foreground 'diff-changed-face "magenda") )) ;; (ffap-bindings) From c5c935122d48157da9afe52b4e343b0950727853 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 3 Feb 2012 15:33:11 +0900 Subject: [PATCH 020/269] add some python-mode prefs and funcs --- emacs.el | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/emacs.el b/emacs.el index 2d004e4..d59fc9f 100644 --- a/emacs.el +++ b/emacs.el @@ -600,24 +600,27 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (add-hook 'sh-mode-hook (lambda () (define-key sh-mode-map (kbd "C-x C-e") 'my-execute-shell-command-current-line))) + (defun my-execute-shell-command-current-line () "" (interactive) (shell-command (buffer-substring-no-properties (point-at-bol) (point)))) -(add-hook 'python-mode-hook - (lambda () - ())) - (defun my-python-run-as-command () "" (interactive) (shell-command (concat python-command " " buffer-file-name))) +(add-hook 'python-mode-hook + (lambda () + (define-key python-mode-map (kbd "C-c C-e") 'my-python-run-as-command))) + (add-hook 'inferior-python-mode-hook (lambda () - (set-window-text-height (display-buffer (current-buffer) t) 7) + (set-window-text-height (display-buffer (current-buffer) + t) + 7) (define-key inferior-python-mode-map (kbd "") 'comint-previous-input) (define-key inferior-python-mode-map (kbd "") 'comint-next-input))) @@ -630,7 +633,7 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (define-key apropos-mode-map "j" 'next-line) (define-key apropos-mode-map "k" 'previous-line))) -(define-key minibuffer-local-map (kbd "C-u") (lambda () (interactive) (delete-region (point-at-bol) (point-at-eol)))) +(define-key minibuffer-local-map (kbd "C-u") (lambda () (interactive) (delete-region (point-at-bol) (point)))) (add-hook 'isearch-mode-hook (lambda () @@ -657,11 +660,6 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (outline-minor-mode 1) (set (make-local-variable 'comment-start) ";")))) -;; (add-hook 'c-mode-hook -;; (lambda () -;; (set (make-local-variable 'comment-start) "//") -;; (set (make-local-variable 'comment-end) ""))) - ;; http://d.hatena.ne.jp/emergent/20070203/1170512717 ;; c-mode ;; (setq c-default-style "bsd") From 76b6a4953177ac3cfc21e01bb2c9cc539e653a91 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 4 Feb 2012 16:13:17 +0900 Subject: [PATCH 021/269] LC_MESSAGES=C when text login --- profile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profile b/profile index 702f319..77c84fe 100755 --- a/profile +++ b/profile @@ -17,7 +17,7 @@ if [ -n "${DESKTOP_SESSION}" ]; then type feh >/dev/null 2>&1 && sh "$HOME/.fehbg" else - export LANG=C + export LC_MESSAGES=C fi # export PS1="\$ " From 32e24f3075a80d6497ad2f94899aedbdbc08e18e Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 5 Feb 2012 03:19:38 +0900 Subject: [PATCH 022/269] change way to display frame initial buffer --- emacs.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/emacs.el b/emacs.el index d59fc9f..bed8add 100644 --- a/emacs.el +++ b/emacs.el @@ -738,9 +738,10 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; frame buffer -(add-hook 'before-make-frame-hook - (lambda () - (switch-to-buffer "*Messages*"))) +(add-hook 'after-make-frame-functions + (lambda (frame) + (set-window-buffer (frame-selected-window frame) + "*Messages*"))) (defvar my-frame-buffer-plist nil) From fe9b57975de034bb573d8777fc960ac04a57dc46 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 5 Feb 2012 04:25:15 +0900 Subject: [PATCH 023/269] fix bug of modeline color --- emacs.el | 92 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/emacs.el b/emacs.el index bed8add..a550c97 100644 --- a/emacs.el +++ b/emacs.el @@ -98,52 +98,6 @@ (setq mac-option-modifier 'control) (setq w32-apps-modifier 'meta) -;; http://www.emacswiki.org/emacs/ChangingCursorDynamically -;; why saving buffer? -;; Change cursor color according to mode -(defvar hcz-set-cursor-color-color "") -(defvar hcz-set-cursor-color-buffer "") -(defun hcz-set-cursor-color-according-to-mode () - "change cursor color according to some minor modes." - ;; set-cursor-color is somewhat costly, so we only call it when needed: - (let ((color - (if buffer-read-only "blue" - (if overwrite-mode "yellow" - "black")))) - (unless (and - (string= color hcz-set-cursor-color-color) - (string= (buffer-name) hcz-set-cursor-color-buffer)) - (set-cursor-color (setq hcz-set-cursor-color-color color)) - (setq hcz-set-cursor-color-buffer (buffer-name))))) -(and window-system - (add-hook 'post-command-hook 'hcz-set-cursor-color-according-to-mode)) - -(defun my-set-mode-line-color-read-only () - "" - (let ((state (if buffer-read-only - 'readonly - (if overwrite-mode - 'overwrite - 'insert)))) - (unless (eq state my-set-mode-line-color-state) - (set-face-foreground 'modeline - (nth 1 - (assq state - my-set-mode-line-color-color))) - (set-face-background 'modeline - (nth 2 - (assq state - my-set-mode-line-color-color))) - (setq my-set-mode-line-color-state state)))) -(defvar my-set-mode-line-color-color nil "") -(setq my-set-mode-line-color-color - '((readonly "blue" "white") - (overwrite "red" "white") - (insert nil nil))) -(defvar my-set-mode-line-color-state nil "") -(add-hook 'post-command-hook 'my-set-mode-line-color-read-only) -(add-hook 'after-init-hook 'my-set-mode-line-color-read-only) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; mode-line @@ -344,6 +298,52 @@ ;; (my-set-ascii-and-jp-font-with-size '("ProggyCleanTTSZ" 120 "takaogothic" 11)) ;; あ a +;; http://www.emacswiki.org/emacs/ChangingCursorDynamically +;; why saving buffer? +;; Change cursor color according to mode +(defvar hcz-set-cursor-color-color "") +(defvar hcz-set-cursor-color-buffer "") +(defun hcz-set-cursor-color-according-to-mode () + "change cursor color according to some minor modes." + ;; set-cursor-color is somewhat costly, so we only call it when needed: + (let ((color + (if buffer-read-only "blue" + (if overwrite-mode "yellow" + "black")))) + (unless (and + (string= color hcz-set-cursor-color-color) + (string= (buffer-name) hcz-set-cursor-color-buffer)) + (set-cursor-color (setq hcz-set-cursor-color-color color)) + (setq hcz-set-cursor-color-buffer (buffer-name))))) +(and window-system + (add-hook 'post-command-hook 'hcz-set-cursor-color-according-to-mode)) + +(defun my-set-mode-line-color-read-only () + "" + (let ((state (if buffer-read-only + 'readonly + (if overwrite-mode + 'overwrite + 'insert)))) + (unless (eq state my-set-mode-line-color-state) + (set-face-foreground 'modeline + (nth 1 + (assq state + my-set-mode-line-color-color))) + (set-face-background 'modeline + (nth 2 + (assq state + my-set-mode-line-color-color))) + (setq my-set-mode-line-color-state state)))) +(defvar my-set-mode-line-color-color nil "") +(setq my-set-mode-line-color-color + `((readonly "blue" "white") + (overwrite "red" "white") + (insert ,(face-foreground 'modeline) ,(face-background 'modeline)))) +(defvar my-set-mode-line-color-state nil "") +(add-hook 'post-command-hook 'my-set-mode-line-color-read-only) +(add-hook 'after-init-hook 'my-set-mode-line-color-read-only) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; file handling From 9ba36aefec4c6fd792432f27f148da98ef1709f2 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 5 Feb 2012 09:18:41 +0900 Subject: [PATCH 024/269] update modeline color pref --- emacs.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/emacs.el b/emacs.el index a550c97..83ca86d 100644 --- a/emacs.el +++ b/emacs.el @@ -337,9 +337,13 @@ (setq my-set-mode-line-color-state state)))) (defvar my-set-mode-line-color-color nil "") (setq my-set-mode-line-color-color + (if window-system + `((readonly "white" "blue") + (overwrite "white" "red") + (insert ,(face-foreground 'modeline) ,(face-background 'modeline))) `((readonly "blue" "white") (overwrite "red" "white") - (insert ,(face-foreground 'modeline) ,(face-background 'modeline)))) + (insert ,(face-foreground 'modeline) ,(face-background 'modeline))))) (defvar my-set-mode-line-color-state nil "") (add-hook 'post-command-hook 'my-set-mode-line-color-read-only) (add-hook 'after-init-hook 'my-set-mode-line-color-read-only) From 544d5ff994a2a7d4b5c4ad552c481061f74bbb03 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 6 Feb 2012 08:36:53 +0900 Subject: [PATCH 025/269] fix prefs around gauche --- emacs.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/emacs.el b/emacs.el index 83ca86d..a4f0b52 100644 --- a/emacs.el +++ b/emacs.el @@ -975,6 +975,13 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (lambda () (define-key scheme-mode-map "\C-c\C-b" 'scheme-send-buffer))) +(add-hook 'inferior-scheme-mode-hook + (lambda () + (set-window-text-height (display-buffer (current-buffer) + t) + 7) + )) + ;; http://d.hatena.ne.jp/kobapan/20090305/1236261804 ;; http://www.katch.ne.jp/~leque/software/repos/gauche-mode/gauche-mode.el @@ -982,12 +989,12 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." "http://www.katch.ne.jp/~leque/software/repos/gauche-mode/gauche-mode.el" t) (setq auto-mode-alist - (cons '("\.scm$" . gauche-mode) auto-mode-alist)) + (cons '("\.gosh$" . gauche-mode) auto-mode-alist)) (autoload 'gauche-mode "gauche-mode" "Major mode for Scheme." t) (autoload 'run-scheme "gauche-mode" "Run an inferior Scheme process." t) (add-hook 'gauche-mode-hook (lambda () - (define-key scheme-mode-map "\C-c\C-z" 'run-gauche-other-window)))) + (define-key gauche-mode-map "\C-c\C-z" 'run-gauche-other-window)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; recentf-mode From c0cb79ab1697ed1268afb7d1a2646d60852a14e0 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 6 Feb 2012 10:08:00 +0900 Subject: [PATCH 026/269] rm comment --- emacs.el | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/emacs.el b/emacs.el index a4f0b52..6b905fc 100644 --- a/emacs.el +++ b/emacs.el @@ -509,26 +509,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; download library from web -;; (require 'url) - -;; (defun dllib-if-needed (lib url &optional callback bite-compile-p force-download-p) ; dont use it -;; "if LIB does not exist, download it from URL and rename to \"~/emacs.d/lisp/LIB.el\". -;; after download LIB successfully call CALLBACK. if LIB already exist, call CALLBACK immediately." -;; (let* ((dir (expand-file-name "~/.emacs.d/lisp/")) -;; (lpath (concat dir lib ".el"))) -;; (and (if (or force-download-p (not (locate-library lib))) -;; (condition-case nil -;; (progn (url-copy-file url -;; lpath -;; t) -;; (and bite-compile-p -;; (byte-compile-file lpath) -;; t)) -;; (error (message "downloading %s...something wrong happened!" url) -;; nil)) -;; t) -;; callback -;; (funcall callback)))) +(require 'url) (defun dllib-if-unfound (lib url &optional bite-compile-p force-download-p) ; new version "if LIB does not exist, download it from URL and locate it to \"~/emacs.d/lisp/LIB.el\". @@ -868,7 +849,7 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (define-key term-raw-map "q" 'my-term-quit-or-send-raw) (define-key term-raw-map (kbd "ESC") 'term-send-raw) (define-key term-raw-map [delete] 'term-send-raw) - (define-key term-raw-map "\C-h" 'term-send-backspace) + (define-key term-raw-map (kbd "DEL") 'term-send-backspace) (define-key term-raw-map "\C-y" 'term-paste) (define-key term-raw-map "\C-c" 'term-send-raw) ;; 'term-interrupt-subjob) ;; (dolist (key '("" "" "" "")) @@ -973,7 +954,7 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (add-hook 'scheme-mode-hook (lambda () - (define-key scheme-mode-map "\C-c\C-b" 'scheme-send-buffer))) + (define-key scheme-mode-map "\C-c\C-c" 'scheme-send-buffer))) (add-hook 'inferior-scheme-mode-hook (lambda () @@ -990,6 +971,8 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." t) (setq auto-mode-alist (cons '("\.gosh$" . gauche-mode) auto-mode-alist)) + (setq auto-mode-alist + (cons '("\.gaucherc$" . gauche-mode) auto-mode-alist)) (autoload 'gauche-mode "gauche-mode" "Major mode for Scheme." t) (autoload 'run-scheme "gauche-mode" "Run an inferior Scheme process." t) (add-hook 'gauche-mode-hook From 8f0e52ed2b6aed86c0952d51831c8b68f74eb615 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 8 Feb 2012 00:10:53 +0900 Subject: [PATCH 027/269] modify mode-line color, fix gauche prefs --- emacs.el | 65 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/emacs.el b/emacs.el index 6b905fc..eb82fbc 100644 --- a/emacs.el +++ b/emacs.el @@ -57,9 +57,6 @@ (add-hook 'after-init-hook (lambda () - ;; (message "init time: %d msec" - ;; (+ (* (- (nth 1 after-init-time) (nth 1 before-init-time)) 1000) - ;; (/ (- (nth 2 after-init-time) (nth 2 before-init-time)) 1000))) (message (emacs-init-time)) (switch-to-buffer "*Messages*") )) @@ -205,8 +202,9 @@ Man-mode)) (standard-display-ascii ?\n "$\n") -(copy-face 'default 'my-eol-face) -(set-face-foreground 'my-eol-face "green") +(set-face-foreground (copy-face 'default + 'my-eol-face) + "green") ;; (defface my-eol-face ;; '((t (:foreground "green"))) ;; "eol.") @@ -318,7 +316,7 @@ (and window-system (add-hook 'post-command-hook 'hcz-set-cursor-color-according-to-mode)) -(defun my-set-mode-line-color-read-only () +(defun my-set-mode-line-color-according-to-readily-state () "" (let ((state (if buffer-read-only 'readonly @@ -326,11 +324,11 @@ 'overwrite 'insert)))) (unless (eq state my-set-mode-line-color-state) - (set-face-foreground 'modeline + (set-face-foreground 'mode-line (nth 1 (assq state my-set-mode-line-color-color))) - (set-face-background 'modeline + (set-face-background 'mode-line (nth 2 (assq state my-set-mode-line-color-color))) @@ -341,12 +339,12 @@ `((readonly "white" "blue") (overwrite "white" "red") (insert ,(face-foreground 'modeline) ,(face-background 'modeline))) - `((readonly "blue" "white") - (overwrite "red" "white") - (insert ,(face-foreground 'modeline) ,(face-background 'modeline))))) + `((readonly "blue" "white") + (overwrite "red" "white") + (insert ,(face-foreground 'modeline) ,(face-background 'modeline))))) (defvar my-set-mode-line-color-state nil "") -(add-hook 'post-command-hook 'my-set-mode-line-color-read-only) -(add-hook 'after-init-hook 'my-set-mode-line-color-read-only) +(add-hook 'post-command-hook 'my-set-mode-line-color-according-to-readily-state) +(add-hook 'after-init-hook 'my-set-mode-line-color-according-to-readily-state) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; file handling @@ -379,7 +377,7 @@ (setq kill-whole-line t) (setq scroll-conservatively 35 scroll-margin 2 - scroll-step 0) ;4行ずつスクロール? + scroll-step 0) (setq default-major-mode 'text-mode) (setq next-line-add-newlines nil) (setq kill-read-only-ok t) @@ -538,9 +536,9 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; share clipboard with x (when (and window-system - ;; (getenv "DESKTOP_SESSION") - (not (eq window-system 'mac)) - ) + ;; (getenv "DESKTOP_SESSION") + (not (eq window-system 'mac)) + ) (setq x-select-enable-clipboard t ; these settings seems to be useless when using emacs in terminal x-select-enable-primary nil) ;; (global-set-key "\C-y" 'x-clipboard-yank) @@ -934,7 +932,8 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; gauche-mode -(setq scheme-program-name "gosh") +(setq scheme-program-name + (setq gauche-program-name "gosh")) (defun run-gauche-other-window () "Run gauche on other window" @@ -945,21 +944,25 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (defun run-gauche () "run gauche" - (run-scheme "gosh")) + (run-scheme gauche-program-name) + ) (defun scheme-send-buffer () "" (interactive) - (scheme-send-region (point-min) (point-max))) + (scheme-send-region (point-min) (point-max)) + (set-window-text-height (display-buffer "*scheme*" + t) + 7) + ) (add-hook 'scheme-mode-hook (lambda () - (define-key scheme-mode-map "\C-c\C-c" 'scheme-send-buffer))) + nil)) (add-hook 'inferior-scheme-mode-hook (lambda () - (set-window-text-height (display-buffer (current-buffer) - t) + (set-window-text-height (display-buffer "*scheme*") 7) )) @@ -977,7 +980,9 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (autoload 'run-scheme "gauche-mode" "Run an inferior Scheme process." t) (add-hook 'gauche-mode-hook (lambda () - (define-key gauche-mode-map "\C-c\C-z" 'run-gauche-other-window)))) + (define-key gauche-mode-map "\C-c\C-z" 'run-gauche-other-window) + (define-key scheme-mode-map "\C-c\C-c" 'scheme-send-buffer) + ))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; recentf-mode @@ -1302,8 +1307,8 @@ otherwise, use `pack-default-extension' for pack." (setq ls-lisp-dirs-first t) (setq ls-lisp-use-localized-time-format t) (setq ls-lisp-format-time-list - '("%Y-%m-%d %H:%M" - "%Y-%m-%d ")) + '("%Y-%m-%d %H:%M" + "%Y-%m-%d ")) (setq dired-dwim-target t) @@ -1524,15 +1529,15 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." (add-to-list 'eshell-command-aliases-list alias)) '( - ; ("ll" "ls -l $*") - ; ("la" "ls -a $*") - ; ("lla" "ls -al $*") + ; ("ll" "ls -l $*") + ; ("la" "ls -a $*") + ; ("lla" "ls -al $*") ("ut" "slogin 03110414@un001.ecc.u-tokyo.ac.jp $*") ("aptin" "apt-get install $*") ("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 $*") )) - ; (eshell/alias "g" "git $*") + ; (eshell/alias "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) From afa1569f72cfe0ae89068a29345c0b29f4cb9c7b Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 8 Feb 2012 00:11:14 +0900 Subject: [PATCH 028/269] add sh prefs --- bashrc | 2 +- profile | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bashrc b/bashrc index 461567e..3ea6c3d 100755 --- a/bashrc +++ b/bashrc @@ -89,7 +89,7 @@ alias reloadrc="test -f ~/.bashrc && source ~/.bashrc" alias sudo="sudo " # use aliases through sudo alias e3=e3em alias mytime="date +%Y%m%d-%H%M%S" -alias sh="ENV=$HOME/.shrc sh" +alias sh="ENV=$HOME/.shrc PS1=\$\ sh" if isdarwin then alias upgrade="port selfupdate && port sync && port upgrade installed" diff --git a/profile b/profile index 77c84fe..b62ac19 100755 --- a/profile +++ b/profile @@ -25,6 +25,7 @@ export LC_TIME=C export TERMCAP="${TERMCAP}:vb=" export HOSTNAME export BROWSER=firefox +export ENV=~/.shrc # export TMP=/tmp # export TEMP=/tmp From d16e0c2b2258e6c7c8465ad8eebcf2f10fb844fc Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 8 Feb 2012 00:12:08 +0900 Subject: [PATCH 029/269] rm cursor color change func --- emacs.el | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/emacs.el b/emacs.el index eb82fbc..1002291 100644 --- a/emacs.el +++ b/emacs.el @@ -296,26 +296,6 @@ ;; (my-set-ascii-and-jp-font-with-size '("ProggyCleanTTSZ" 120 "takaogothic" 11)) ;; あ a -;; http://www.emacswiki.org/emacs/ChangingCursorDynamically -;; why saving buffer? -;; Change cursor color according to mode -(defvar hcz-set-cursor-color-color "") -(defvar hcz-set-cursor-color-buffer "") -(defun hcz-set-cursor-color-according-to-mode () - "change cursor color according to some minor modes." - ;; set-cursor-color is somewhat costly, so we only call it when needed: - (let ((color - (if buffer-read-only "blue" - (if overwrite-mode "yellow" - "black")))) - (unless (and - (string= color hcz-set-cursor-color-color) - (string= (buffer-name) hcz-set-cursor-color-buffer)) - (set-cursor-color (setq hcz-set-cursor-color-color color)) - (setq hcz-set-cursor-color-buffer (buffer-name))))) -(and window-system - (add-hook 'post-command-hook 'hcz-set-cursor-color-according-to-mode)) - (defun my-set-mode-line-color-according-to-readily-state () "" (let ((state (if buffer-read-only From 49a57dc4e9024886bd2ab0b55fe58754fe93105d Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 8 Feb 2012 00:21:11 +0900 Subject: [PATCH 030/269] disable hl-mode in term-mode, fix bug --- emacs.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/emacs.el b/emacs.el index 1002291..94e4cc5 100644 --- a/emacs.el +++ b/emacs.el @@ -833,12 +833,15 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ;; (dolist (key '("" "" "" "")) ;; (define-key term-raw-map (kbd key) 'term-send-raw)) ;; (define-key term-raw-map "\C-d" 'delete-char) - (set (make-variable-buffer-local 'scroll-margin) 0) - ;; (set (make-variable-buffer-local 'cua-enable-cua-keys) nil) + (set (make-local-variable 'scroll-margin) 0) + ;; (set (make-local-variable 'cua-enable-cua-keys) nil) ;; (cua-mode 0) ;; (and cua-mode ;; (local-unset-key (kbd "C-c"))) ;; (define-key cua--prefix-override-keymap "\C-c" 'term-interrupt-subjob) + (set (make-local-variable 'hl-line-range-function) + (lambda () + '(0 0))) )) ;; (add-hook 'term-exec-hook 'forward-char) @@ -861,7 +864,7 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (setq bs-default-configuration "this-frame") ;; (and bs--show-all ;; (call-interactively 'bs-toggle-show-all)) - (set (make-variable-buffer-local 'scroll-margin) 0) + (set (make-local-variable 'scroll-margin) 0) )) (defun buffer-same-dir-p (bf) @@ -1520,7 +1523,7 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." ; (eshell/alias "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) + (set (make-local-variable 'scroll-margin) 0) ;; (eshell/export "GIT_PAGER=") ;; (eshell/export "GIT_EDITOR=") (eshell/export "LC_MESSAGES=C") From 65f33038bd612ee74641a6d253079193b42c4ef6 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 8 Feb 2012 00:42:07 +0900 Subject: [PATCH 031/269] fix bug --- emacs.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/emacs.el b/emacs.el index 94e4cc5..94f680d 100644 --- a/emacs.el +++ b/emacs.el @@ -296,7 +296,7 @@ ;; (my-set-ascii-and-jp-font-with-size '("ProggyCleanTTSZ" 120 "takaogothic" 11)) ;; あ a -(defun my-set-mode-line-color-according-to-readily-state () +(defun my-set-mode-line-color-according-to-readonly-state () "" (let ((state (if buffer-read-only 'readonly @@ -304,11 +304,11 @@ 'overwrite 'insert)))) (unless (eq state my-set-mode-line-color-state) - (set-face-foreground 'mode-line + (set-face-foreground 'modeline (nth 1 (assq state my-set-mode-line-color-color))) - (set-face-background 'mode-line + (set-face-background 'modeline (nth 2 (assq state my-set-mode-line-color-color))) @@ -323,8 +323,11 @@ (overwrite "red" "white") (insert ,(face-foreground 'modeline) ,(face-background 'modeline))))) (defvar my-set-mode-line-color-state nil "") -(add-hook 'post-command-hook 'my-set-mode-line-color-according-to-readily-state) -(add-hook 'after-init-hook 'my-set-mode-line-color-according-to-readily-state) +(add-hook 'post-command-hook 'my-set-mode-line-color-according-to-readonly-state) +(add-hook 'after-init-hook 'my-set-mode-line-color-according-to-readonly-state) + +;; (set-face-foreground 'mode-line-inactive (if window-system "gray" "white")) +;; (set-face-background 'mode-line-inactive (if window-system "white" "gray")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; file handling From cc4b41efa931f6bf110b4208e4ff34b4f06d2d46 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 8 Feb 2012 00:46:21 +0900 Subject: [PATCH 032/269] fix bug --- emacs.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs.el b/emacs.el index 94f680d..f9ad918 100644 --- a/emacs.el +++ b/emacs.el @@ -844,7 +844,7 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ;; (define-key cua--prefix-override-keymap "\C-c" 'term-interrupt-subjob) (set (make-local-variable 'hl-line-range-function) (lambda () - '(0 0))) + '(0 . 0))) )) ;; (add-hook 'term-exec-hook 'forward-char) From b6d7900e5e85395b443afd3a03aac433b1eb786d Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 8 Feb 2012 09:01:53 +0900 Subject: [PATCH 033/269] rename some command --- bashrc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bashrc b/bashrc index 3ea6c3d..58cc4ca 100755 --- a/bashrc +++ b/bashrc @@ -33,7 +33,7 @@ fi null(){ "$@" >/dev/null 2>&1 } -safe-cmd(){ +__try_exec(){ type $1 >/dev/null 2>&1 && "$@" } replace-cmd(){ @@ -85,7 +85,7 @@ alias q=exit alias p="$PAGER" alias c=cat alias pcalc="python -i -c 'from math import *' " -alias reloadrc="test -f ~/.bashrc && source ~/.bashrc" +alias _reloadrc="test -f ~/.bashrc && source ~/.bashrc" alias sudo="sudo " # use aliases through sudo alias e3=e3em alias mytime="date +%Y%m%d-%H%M%S" @@ -221,7 +221,7 @@ convmv-sjis2utf8-test(){ convmv-sjis2utf8-notest(){ convmv -r -f sjis -t utf8 * --notest } -_my-dl-init-files(){ +_my_dl_init_files(){ for file in .bashrc .vimrc .emacs do local flag=0 @@ -314,10 +314,10 @@ __my_prompt_function(){ # used by PS1 local pwd=$(echo "${PWD}/" | sed -e "s#${HOME}#~#") local oldpwd=$(echo "${OLDPWD}/" | sed -e "s#${HOME}#~#") local jobnum=$(jobs | wc -l) - local git=$(safe-cmd __git_ps1 [GIT:%s]) - local date=$(LANG=C safe-cmd date +"%a, %d %b %Y %T %z") + local git=$(__try_exec __git_ps1 [GIT:%s]) + local date=$(LANG=C __try_exec date +"%a, %d %b %Y %T %z") fi - local svn=$(type svn >/dev/null 2>&1 && safe-cmd __my_svn_ps1 [SVN:%s]) + local svn=$(type svn >/dev/null 2>&1 && __try_exec __my_svn_ps1 [SVN:%s]) printf "${_MEMO}" printf "$(test -f ~/.prompt.sh && bash ~/.prompt.sh)\n" printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}\n" @@ -426,12 +426,12 @@ _testjp uname -a test -f /etc/issue.net && cat /etc/issue.net -safe-cmd diskinfo +__try_exec diskinfo ! isdarwin && test -n "${DESKTOP_SESSION}" && type xrandr >/dev/null 2>&1 && { xrandr | grep --color=never ^Screen } -iswindows || safe-cmd finger $USER -LANG=C safe-cmd id +iswindows || __try_exec finger $USER +LANG=C __try_exec id From b7833f912851db43a07d2b6fcc05330fbdc46bb1 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 8 Feb 2012 09:10:08 +0900 Subject: [PATCH 034/269] rm my_dl_init_files --- bashrc | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/bashrc b/bashrc index 58cc4ca..c56f106 100755 --- a/bashrc +++ b/bashrc @@ -4,7 +4,6 @@ test -r /etc/bashrc && . /etc/bashrc ########################## # system type -# $OSTYPEとか使えるのかな if uname | grep -E "^MINGW32" >/dev/null 2>&1 then @@ -63,7 +62,7 @@ export LESS="-iRMX" export GIT_PAGER="$PAGER" export GIT_EDITOR="$EDITOR" -alias ls="ls -hCFG $(test "$TERM" == dumb || echo --color=auto) --time-style=long-iso" +alias ls="ls -hCFG $(test "$TERM" == dumb || echo --color=auto\ )--time-style=long-iso" # alias ll="ls -l" # alias la="ls -A" # alias lla="ls -Al" @@ -85,6 +84,7 @@ alias q=exit alias p="$PAGER" alias c=cat alias pcalc="python -i -c 'from math import *' " +alias py3=python3 alias _reloadrc="test -f ~/.bashrc && source ~/.bashrc" alias sudo="sudo " # use aliases through sudo alias e3=e3em @@ -221,25 +221,6 @@ convmv-sjis2utf8-test(){ convmv-sjis2utf8-notest(){ convmv -r -f sjis -t utf8 * --notest } -_my_dl_init_files(){ - for file in .bashrc .vimrc .emacs - do - local flag=0 - if test -f ~/${file}.new - then - mv ~/${file}.new ~/${file}.old - echo "${file}.new already exist. Rename it to ${file}.old." - flag=1 - fi - wget https://dl.dropbox.com/u/1751156/${file} -O ~/${file}.new - local wgetreturn=$? - if test ${flag} -eq 1 -a ${wgetreturn} -eq 0 - then - rm ~/${file}.old - echo "${file}.old deleted." - fi - done -} _mygitconfig(){ git config --global user.name '10sr' git config --global user.email '8slashes+git@gmail.com' @@ -328,7 +309,7 @@ __my_prompt_function(){ # used by PS1 # type date >/dev/null 2>&1 || alias date=":" # "cmd /c echo %time%" if [ "${EMACS}" = "t" ]; then # emacs shell用 - : export PS1="\u@\H \d \t \w\nemacs shell\$ " + true export PS1="\u@\H \d \t \w\nemacs shell\$ " elif echo "$EMACS" | grep term >/dev/null 2>&1; then # emacs term用 echo "emacs term" fi From 67144d4a0df0b6264762db70b9d95aa2b45712d7 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 8 Feb 2012 12:14:51 +0900 Subject: [PATCH 035/269] fix python and gauche prefs for inferior process --- emacs.el | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/emacs.el b/emacs.el index f9ad918..380e9d5 100644 --- a/emacs.el +++ b/emacs.el @@ -573,20 +573,29 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (shell-command (buffer-substring-no-properties (point-at-bol) (point)))) +(setq python-python-command (executable-find "python3")) (defun my-python-run-as-command () "" (interactive) - (shell-command (concat python-command " " buffer-file-name))) + (shell-command (concat python-python-command " " buffer-file-name))) +(defun my-python-display-python-buffer () + "" + (interactive) + ;; (or python-buffer + ;; (save-excursion + ;; (run-python))) + (set-window-text-height (display-buffer python-buffer + t) + 7)) (add-hook 'python-mode-hook (lambda () - (define-key python-mode-map (kbd "C-c C-e") 'my-python-run-as-command))) + (define-key python-mode-map (kbd "C-c C-e") 'my-python-run-as-command) + (define-key python-mode-map (kbd "C-c C-b") 'my-python-display-python-buffer))) (add-hook 'inferior-python-mode-hook (lambda () - (set-window-text-height (display-buffer (current-buffer) - t) - 7) + (my-python-display-python-buffer) (define-key inferior-python-mode-map (kbd "") 'comint-previous-input) (define-key inferior-python-mode-map (kbd "") 'comint-next-input))) @@ -937,21 +946,24 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." "" (interactive) (scheme-send-region (point-min) (point-max)) - (set-window-text-height (display-buffer "*scheme*" - t) - 7) + (my-scheme-display-scheme-buffer) ) +(defun my-scheme-display-scheme-buffer () + "" + (interactive) + (set-window-text-height (display-buffer scheme-buffer + t) + 7)) + (add-hook 'scheme-mode-hook (lambda () nil)) (add-hook 'inferior-scheme-mode-hook (lambda () - (set-window-text-height (display-buffer "*scheme*") - 7) + ;; (my-scheme-display-scheme-buffer) )) - ;; http://d.hatena.ne.jp/kobapan/20090305/1236261804 ;; http://www.katch.ne.jp/~leque/software/repos/gauche-mode/gauche-mode.el @@ -966,8 +978,9 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (autoload 'run-scheme "gauche-mode" "Run an inferior Scheme process." t) (add-hook 'gauche-mode-hook (lambda () - (define-key gauche-mode-map "\C-c\C-z" 'run-gauche-other-window) - (define-key scheme-mode-map "\C-c\C-c" 'scheme-send-buffer) + (define-key gauche-mode-map (kbd "C-c C-z") 'run-gauche-other-window) + (define-key scheme-mode-map (kbd "C-c C-c") 'scheme-send-buffer) + (define-key scheme-mode-map (kbd "C-c C-b") 'my-scheme-display-scheme-buffer) ))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; From 716ea095fdc3192b4b8a916676de3652a02594ab Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 9 Feb 2012 12:58:44 +0900 Subject: [PATCH 036/269] fix indent --- emacs.el | 66 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/emacs.el b/emacs.el index 380e9d5..20de40a 100644 --- a/emacs.el +++ b/emacs.el @@ -823,38 +823,40 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ;; 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 (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) - ;; (define-key term-raw-map "\C-s" 'term-send-raw) - ;; (define-key term-raw-map "\C-f" 'forward-char) - ;; (define-key term-raw-map "\C-b" 'backward-char) - ;; (define-key term-raw-map "\C-t" 'set-mark-command) - (define-key term-raw-map "\C-x" (lookup-key (current-global-map) "\C-x")) - (define-key term-raw-map "\C-z" (lookup-key (current-global-map) "\C-z"))) - (define-key term-raw-map "q" 'my-term-quit-or-send-raw) - (define-key term-raw-map (kbd "ESC") 'term-send-raw) - (define-key term-raw-map [delete] 'term-send-raw) - (define-key term-raw-map (kbd "DEL") 'term-send-backspace) - (define-key term-raw-map "\C-y" 'term-paste) - (define-key term-raw-map "\C-c" 'term-send-raw) ;; 'term-interrupt-subjob) - ;; (dolist (key '("" "" "" "")) - ;; (define-key term-raw-map (kbd key) 'term-send-raw)) - ;; (define-key term-raw-map "\C-d" 'delete-char) - (set (make-local-variable 'scroll-margin) 0) - ;; (set (make-local-variable 'cua-enable-cua-keys) nil) - ;; (cua-mode 0) - ;; (and cua-mode - ;; (local-unset-key (kbd "C-c"))) - ;; (define-key cua--prefix-override-keymap "\C-c" 'term-interrupt-subjob) - (set (make-local-variable 'hl-line-range-function) - (lambda () - '(0 . 0))) - )) +(add-hook 'term-setup-hook + (lambda () + (setq term-display-table (make-display-table)))) +(add-hook 'term-mode-hook + (lambda () + (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) + ;; (define-key term-raw-map "\C-s" 'term-send-raw) + ;; (define-key term-raw-map "\C-f" 'forward-char) + ;; (define-key term-raw-map "\C-b" 'backward-char) + ;; (define-key term-raw-map "\C-t" 'set-mark-command) + (define-key term-raw-map "\C-x" (lookup-key (current-global-map) "\C-x")) + (define-key term-raw-map "\C-z" (lookup-key (current-global-map) "\C-z"))) + (define-key term-raw-map "q" 'my-term-quit-or-send-raw) + (define-key term-raw-map (kbd "ESC") 'term-send-raw) + (define-key term-raw-map [delete] 'term-send-raw) + (define-key term-raw-map (kbd "DEL") 'term-send-backspace) + (define-key term-raw-map "\C-y" 'term-paste) + (define-key term-raw-map "\C-c" 'term-send-raw) ;; 'term-interrupt-subjob) + ;; (dolist (key '("" "" "" "")) + ;; (define-key term-raw-map (kbd key) 'term-send-raw)) + ;; (define-key term-raw-map "\C-d" 'delete-char) + (set (make-local-variable 'scroll-margin) 0) + ;; (set (make-local-variable 'cua-enable-cua-keys) nil) + ;; (cua-mode 0) + ;; (and cua-mode + ;; (local-unset-key (kbd "C-c"))) + ;; (define-key cua--prefix-override-keymap "\C-c" 'term-interrupt-subjob) + (set (make-local-variable 'hl-line-range-function) + (lambda () + '(0 . 0))) + )) ;; (add-hook 'term-exec-hook 'forward-char) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; From 31e10e39c0e37f2b679c0f93c2860cbf4b43da6f Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 9 Feb 2012 12:59:15 +0900 Subject: [PATCH 037/269] modify prompt function, rm memo func --- bashrc | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/bashrc b/bashrc index c56f106..5d0779b 100755 --- a/bashrc +++ b/bashrc @@ -35,9 +35,6 @@ null(){ __try_exec(){ type $1 >/dev/null 2>&1 && "$@" } -replace-cmd(){ - type $1 1>/dev/null || alias $1=true -} export PS1="\$(__my_prompt_function)\$ " # PROMPT_COMMAND=prompt_function @@ -77,7 +74,6 @@ alias ut="ssh t110414@un001.ecc.u-tokyo.ac.jp" alias rand="echo \$RANDOM" alias xunp="file-roller -h" alias pacome="sudo \paco -D" -alias destroy="rm -rf" alias psall="ps auxww" alias g=git alias q=exit @@ -155,12 +151,6 @@ di(){ fi ${diffcmd} -u "$@" | ${PAGER} } -memo(){ - __MYMEMO="# $*\n" -} -rmmemo(){ - __MYMEMO="" -} throw-away(){ mkdir -p ~/bu/tb for file in "$@" @@ -299,8 +289,7 @@ __my_prompt_function(){ # used by PS1 local date=$(LANG=C __try_exec date +"%a, %d %b %Y %T %z") fi local svn=$(type svn >/dev/null 2>&1 && __try_exec __my_svn_ps1 [SVN:%s]) - printf "${_MEMO}" - printf "$(test -f ~/.prompt.sh && bash ~/.prompt.sh)\n" + jobs printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}\n" printf "${c2}${USER}@${HOSTNAME}${cdef} ${date} ${BASH} ${BASH_VERSION}\n" printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " From 3300e7678a3d269acb806e66ad355c1b57ff33f1 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 12 Feb 2012 14:24:28 +0900 Subject: [PATCH 038/269] eshell/git not works --- emacs.el | 48 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/emacs.el b/emacs.el index 20de40a..cbb54b5 100644 --- a/emacs.el +++ b/emacs.el @@ -1439,6 +1439,18 @@ Optional prefix ARG says how many lines to unflag; default is one line." (defun eshell/v () (view-mode 1)) +(defun eshell/git (&rest args) + "" + (if (member (car args) + '("di" "diff" "log" "show")) + (apply 'eshell-exec-visual "git" args) + (shell-command (mapconcat 'shell-quote-argument + `("git" ,@args) + " ") + t) + ;; (eshell-external-command "git" args) + )) + (defalias 'eshell/: 'ignore) (defalias 'eshell/type 'eshell/which) ;; (defalias 'eshell/vim 'eshell/vi) @@ -1472,7 +1484,9 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." (setq eshell-cmpl-ignore-case t) (setq eshell-cmpl-cycle-completions nil) (setq eshell-highlight-prompt nil) -(setq eshell-ls-initial-args "-FG") ; "-hF") +(setq eshell-ls-initial-args '("-hCFG" + "--color=auto" + "--time-style=long-iso")) ; "-hF") (setq eshell-prompt-function (lambda () (with-temp-buffer @@ -1526,6 +1540,28 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." (define-key eshell-mode-map (kbd "DEL") 'my-eshell-backward-delete-char) (define-key eshell-mode-map (kbd "C-p") 'eshell-previous-matching-input-from-input) (define-key eshell-mode-map (kbd "C-n") 'eshell-next-matching-input-from-input) + (apply 'eshell/addpath exec-path) + (set (make-local-variable 'scroll-margin) 0) + ;; (eshell/export "GIT_PAGER=") + ;; (eshell/export "GIT_EDITOR=") + (eshell/export "LC_MESSAGES=C") + (switch-to-buffer (current-buffer)) ; move buffer top of list + (set (make-local-variable 'hl-line-range-function) + (lambda () + '(0 . 0))) + (add-to-list 'eshell-virtual-targets + '("/dev/less" + (lambda (str) + (if str + (with-current-buffer nil))) + nil)) + )) + +(add-hook 'eshell-mode-hook + (lambda () + (add-to-list 'eshell-visual-commands "vim") + ;; (add-to-list 'eshell-visual-commands "git") + (add-to-list 'eshell-output-filter-functions 'eshell-truncate-buffer) (mapcar (lambda (alias) (add-to-list 'eshell-command-aliases-list alias)) @@ -1538,16 +1574,6 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." ("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 $*") )) - ; (eshell/alias "g" "git $*") - (add-to-list 'eshell-output-filter-functions 'eshell-truncate-buffer) - (apply 'eshell/addpath exec-path) - (set (make-local-variable 'scroll-margin) 0) - ;; (eshell/export "GIT_PAGER=") - ;; (eshell/export "GIT_EDITOR=") - (eshell/export "LC_MESSAGES=C") - (add-to-list 'eshell-visual-commands "vim") - (add-to-list 'eshell-visual-commands "git") - (switch-to-buffer (current-buffer)) ; move buffer top of list )) ;; (eval-after-load "em-alias" From fa8988fbbc30cbc839ac68ef5f28ba814cb42ccd Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 15 Feb 2012 00:38:06 +0900 Subject: [PATCH 039/269] update my-dired-next/previous-line --- emacs.el | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/emacs.el b/emacs.el index cbb54b5..9e85086 100644 --- a/emacs.el +++ b/emacs.el @@ -1069,7 +1069,7 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (require 'dired) -(defun my-dired-echo-file-head (&optional arg) +(defun my-dired-echo-file-head (arg) "" (interactive "P") (let ((f (dired-get-filename))) @@ -1217,11 +1217,11 @@ otherwise, use `pack-default-extension' for pack." (while (search-forward "なし" nil t) (replace-match "none"))))) -(defun dired-get-du () ;em-unix.el使えるかも +(defun dired-get-du () "dired get disk usage" (interactive) (message "calculating du...") - (dired-do-shell-command "du -hs * " nil (dired-get-marked-files))) + (dired-do-shell-command "du -hsD * " nil (dired-get-marked-files))) (defun my-dired-scroll-up () "" @@ -1233,17 +1233,33 @@ otherwise, use `pack-default-extension' for pack." (interactive) (my-dired-next-line (- (window-height) 1))) -(defun my-dired-previous-line (&optional arg) +(defun my-dired-previous-line (arg) "" - (interactive) - (dired-previous-line (or arg 1)) - (my-dired-print-current-dir-and-file)) + (interactive "p") + (when (> arg 0) + ;; (ignore 'my-dired-print-current-dir-and-file) + (dired-previous-line 1) + (when (eq (line-number-at-pos) + 2) + (goto-line (- (line-number-at-pos (point-max)) + 1)) + (dired-move-to-filename)) + (my-dired-next-line (- arg + 1)) + )) -(defun my-dired-next-line (&optional arg) +(defun my-dired-next-line (arg) "" - (interactive) - (dired-next-line (or arg 1)) - (my-dired-print-current-dir-and-file)) + (interactive "p") + (when (> arg 0) + ;; (ignore 'my-dired-print-current-dir-and-file) + (dired-next-line 1) + (when (eq (point) + (point-max)) + (goto-line 3) + (dired-move-to-filename)) + (my-dired-next-line (- arg 1)) + )) (defun my-dired-print-current-dir-and-file () (message "%s %s" From 03d62a75cd0966a572e026b06ee88ea8965421b2 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 15 Feb 2012 00:38:25 +0900 Subject: [PATCH 040/269] add radikox ext --- _keysnail.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/_keysnail.js b/_keysnail.js index 1078bf1..870bb38 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -158,6 +158,15 @@ plugins.options["twitter_client.use_jmp"] = true; //////////////////////////////////////////// // エクステ +ext.add('radikox-play-pause', function(){ + radikox.turn_power(); + radikox.power(); +}, 'radikox toggle play/pause'); + +ext.add('radikox-select-station', function(){ + var m = document.getElementById("radikox_menupopup"); +}, 'radikox station'); + ext.add('my-setpref', function(){ util.setPrefs( { From 10de91f14cec761494a148dea711f817f3c8afc8 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 15 Feb 2012 00:44:30 +0900 Subject: [PATCH 041/269] fix bug --- emacs.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs.el b/emacs.el index 9e85086..f798436 100644 --- a/emacs.el +++ b/emacs.el @@ -1244,7 +1244,7 @@ otherwise, use `pack-default-extension' for pack." (goto-line (- (line-number-at-pos (point-max)) 1)) (dired-move-to-filename)) - (my-dired-next-line (- arg + (my-dired-previous-line (- arg 1)) )) From b7e3d7c4213ff302b288e0e65b76b30e51b5bff2 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 18 Feb 2012 13:10:07 +0900 Subject: [PATCH 042/269] fix bug --- emacs.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/emacs.el b/emacs.el index f798436..f19c7bb 100644 --- a/emacs.el +++ b/emacs.el @@ -332,7 +332,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; file handling -(setq revert-without-query ".+") +(setq revert-without-query '(".+")) ;; カーソルの場所を保存する (when (require 'saveplace nil t) @@ -1244,8 +1244,7 @@ otherwise, use `pack-default-extension' for pack." (goto-line (- (line-number-at-pos (point-max)) 1)) (dired-move-to-filename)) - (my-dired-previous-line (- arg - 1)) + (my-dired-previous-line (- arg 1)) )) (defun my-dired-next-line (arg) From a983335a86cbdf0074c8ec11f594076273c21a1d Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 18 Feb 2012 13:11:35 +0900 Subject: [PATCH 043/269] rm radikox ext because they are used for plugin --- _keysnail.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/_keysnail.js b/_keysnail.js index 870bb38..1078bf1 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -158,15 +158,6 @@ plugins.options["twitter_client.use_jmp"] = true; //////////////////////////////////////////// // エクステ -ext.add('radikox-play-pause', function(){ - radikox.turn_power(); - radikox.power(); -}, 'radikox toggle play/pause'); - -ext.add('radikox-select-station', function(){ - var m = document.getElementById("radikox_menupopup"); -}, 'radikox station'); - ext.add('my-setpref', function(){ util.setPrefs( { From 5efa5a58d6b8df5c512a371c368f3dc3538a87a5 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 21 Feb 2012 17:21:20 +0900 Subject: [PATCH 044/269] make pack.el library --- emacs.el | 121 +++++-------------------------------------------------- 1 file changed, 11 insertions(+), 110 deletions(-) diff --git a/emacs.el b/emacs.el index f19c7bb..e8b4951 100644 --- a/emacs.el +++ b/emacs.el @@ -625,6 +625,8 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (add-to-list 'auto-mode-alist (cons "\\.ol$" 'outline-mode)) (add-to-list 'auto-mode-alist (cons "\\.md$" 'outline-mode)) +(setq markdown-command (or (executable-find "markdown") + (executable-find "markdown.pl"))) (when (dllib-if-unfound "markdown-mode" "http://jblevins.org/projects/markdown-mode/markdown-mode.el" t) @@ -1091,115 +1093,6 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (diff (cadr files) (dired-get-filename)) (message "One files must be marked!")))) -(require 'dired-aux) ;; needed to use dired-dwim-target-directory -(defun my-dired-do-pack-or-unpack () - "pack or unpack files. -if targetting one file and that is archive file defined in `pack-program-alist', unpack that. -otherwise, pack marked files. prompt user to decide filename for archive." - (interactive) - (let* ((infiles (dired-get-marked-files t)) - (onefile (and (eq 1 ; filename if only one file targeted, otherwise nil. - (length infiles)) - (car infiles)))) - (if (and onefile - (my-pack-file-name-association onefile)) - (when (y-or-n-p (format "unpack %s? " onefile)) - (my-unpack onefile)) - (let* ((dir-default (dired-dwim-target-directory)) - (archive-default (my-pack-file-extension (file-name-nondirectory (car infiles)))) - (archive ;; (if (interactive-p) - (read-file-name "Output file to pack : " - dir-default - nil - nil - archive-default) - ;; (concat dir-default archive-default) - )) - (apply 'my-pack - archive - infiles)))) - (revert-buffer) - ;; (dired-unmark-all-marks) - ) - -(defun my-file-name-extension-with-tar (filename) - "if FILENAME has extension with tar, like \"tar.gz\", return that. -otherwise, return extension normally." - (if (string-equal "tar" (file-name-extension (file-name-sans-extension filename))) - (concat "tar." - (file-name-extension filename)) - (file-name-extension filename))) - -(defun my-pack-file-extension (filename) - "if FILENAME has extension and it can be used for pack, return FILENAME. -otherwise, return FILENAME with `my-pack-default-extension'" - (if (my-pack-file-name-association filename) - filename - (concat filename "." my-pack-default-extension))) - -(defvar my-7z-program-name - (or (executable-find "7z") - (executable-find "7za") - (executable-find "7zr")) - "7z program.") - -(defvar my-pack-default-extension - "7z" - "default suffix for packing. filename with this suffix must matches one of `pack-program-alist'") - -(defun my-pack-file-name-association (filename) - "if the pattern matching FILENAME is found at car of the list in `pack-program-alist', return cdr of that list. -otherwise, return nil." - (let ((case-fold-search nil)) - (assoc-default filename - my-pack-program-alist - 'string-match-p - nil))) - -(defvar my-pack-program-alist - `( - ("\\.7z\\'" ,(concat my-7z-program-name " a") ,(concat my-7z-program-name " x")) - ("\\.zip\\'" "zip -r" "unzip") - ("\\.tar\\'" "tar cf" "tar xf") - ("\\.tgz\\'" "tar czf" "tar xzf") - ("\\.tar\\.gz\\'" "tar czf" "tar xzf") - ) - "Alist of filename patterns, command for pack and unpack. -Each element looks like (REGEXP PACKING-COMMAND UNPACKING-COMMAND). -PACKING-COMMAND and UNPACKING-COMMAND can be nil if the command is not available. -alist is searched from the beginning so pattern for \".tar.gz\" should be ahead of pattern for \".gz\"") -;; (string-match-p "\\.gz\\'" "aaa.gz") ; \' matches string end, $ also matches the point before newline. - -(defun my-unpack (archive) - "unpack ARCHIVE. command for unpacking is defined in `pack-program-alist'" - (interactive "fArchive to extract: ") - (let* ((earchive (expand-file-name archive)) - (cmd (nth 1 - (my-pack-file-name-association earchive))) - ) - (if cmd - (shell-command (concat cmd - " " - (shell-quote-argument earchive))) - (message "this is not archive file defined in `pack-program-alist'!")))) - -(defun my-pack (archive &rest files) - "pack FILES into ARCHIVE. -if ARCHIVE have extension defined in `pack-program-alist', use that command. -otherwise, use `pack-default-extension' for pack." - (let* ((archive-ext (my-pack-file-extension (expand-file-name archive))) - (cmd (car (my-pack-file-name-association archive-ext))) - ) - (if cmd - (shell-command (concat cmd - " " - (shell-quote-argument archive-ext) - " " - (mapconcat 'shell-quote-argument - files - " "))) - (message "invalid extension for packing!")))) - (defun my-pop-to-buffer-erase-noselect (buffer-or-name) "pop up buffer using `display-buffer' and return that buffer." (let ((bf (get-buffer-create buffer-or-name))) @@ -1348,7 +1241,7 @@ otherwise, use `pack-default-extension' for pack." (define-key dired-mode-map "h" 'my-dired-echo-file-head) (define-key dired-mode-map "@" (lambda () (interactive) (my-x-open "."))) (define-key dired-mode-map (kbd "TAB") 'other-window) - (define-key dired-mode-map "P" 'my-dired-do-pack-or-unpack) + ;; (define-key dired-mode-map "P" 'my-dired-do-pack-or-unpack) (define-key dired-mode-map "a" 'my-dired-display-all-mode) (define-key dired-mode-map "/" 'dired-isearch-filenames) (define-key dired-mode-map (kbd "DEL") 'dired-up-directory) @@ -1360,6 +1253,14 @@ otherwise, use `pack-default-extension' for pack." (when (file-readable-p file) (delete-file file))))) +(and (dllib-if-unfound "pack" + "https://github.com/10sr/emacs-lisp/raw/master/pack.el" + t) + (require 'pack nil t) + (add-hook 'dired-mode-hook + (lambda () + (define-key dired-mode-map "P" 'dired-do-pack-or-unpack)))) + ;; http://blog.livedoor.jp/tek_nishi/archives/4693204.html (defun my-dired-toggle-mark() From 8aff948df7566202de981fd51359111022d3a4a4 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 21 Feb 2012 17:21:54 +0900 Subject: [PATCH 045/269] cleanse code --- bashrc | 55 +++++++++++++++++-------------------------------------- 1 file changed, 17 insertions(+), 38 deletions(-) diff --git a/bashrc b/bashrc index 5d0779b..3814e33 100755 --- a/bashrc +++ b/bashrc @@ -96,7 +96,7 @@ fi # type trash >/dev/null 2>&1 && alias rm=trash export __MYGITBAREREP="${HOME}/dbx/.git-bare" -git-make-bare-rep(){ +git-make-local-rep(){ test $# -eq 0 && { echo "specify repository name." 1>&2 return 1 @@ -108,38 +108,18 @@ git-make-bare-rep(){ then echo "dir $dir already exist!" 1>&2 else - mkdir -p "$dir" && - pushd "$dir" && - git init --bare --shared=all - popd - fi -} - -git-add-bare-rep(){ - test $# -ne 2 && { - echo "specify repository name and shortname." 1>&2 - return 1 - } - - dir="${__MYGITBAREREP}/$2.git" - - # git-make-bare-rep $2 && - # git remote add $1 "$dir" - # git remote -v - - if test -d "$dir" - then - git remote add $1 "$dir" - git remote -v - else - echo "dir $dir does not exist!" 1>&2 + mkdir -p "$dir" && { + pushd "$dir" && + git init --bare --shared=all + popd + } fi } bak(){ for file in "$@" do - cp ${file} ${file}.bak + mv -v ${file} ${file}.bak done } di(){ @@ -388,20 +368,19 @@ fi ####################### -_testjp(){ - echo "Japanese letters are 表示可能" -} -_testjp - uname -a test -f /etc/issue.net && cat /etc/issue.net -__try_exec diskinfo +showinfo(){ + echo "Japanese letters are 表示可能" -! isdarwin && test -n "${DESKTOP_SESSION}" && type xrandr >/dev/null 2>&1 && { - xrandr | grep --color=never ^Screen -} + __try_exec diskinfo + + ! isdarwin && test -n "${DESKTOP_SESSION}" && type xrandr >/dev/null 2>&1 && { + xrandr | grep --color=never ^Screen + } -iswindows || __try_exec finger $USER -LANG=C __try_exec id + iswindows || __try_exec finger $USER + LANG=C __try_exec id +} From f795709f35c1550e385b3d51c7697d8c2c764086 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 21 Feb 2012 18:24:47 +0900 Subject: [PATCH 046/269] add windate, waiting to be tested --- bashrc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bashrc b/bashrc index 3814e33..bba53d1 100755 --- a/bashrc +++ b/bashrc @@ -92,6 +92,7 @@ then else alias upgrade="sudo apt-get autoremove --yes && sudo apt-get update --yes && sudo apt-get upgrade --yes" fi +iswindows && ! type windate >/dev/null 2>&1 && alias windate="/c/Windows/System32/cmd.exe //c 'echo %DATE%-%TIME%'" # alias diff="$(type colordiff >/dev/null 2>&1 && test $TERM != dumb && echo color)diff -u" # type trash >/dev/null 2>&1 && alias rm=trash @@ -103,17 +104,19 @@ git-make-local-rep(){ } dir="${__MYGITBAREREP}/$1.git" + cdir=$PWD if test -d "$dir" then echo "dir $dir already exist!" 1>&2 else mkdir -p "$dir" && { - pushd "$dir" && + cd "$dir" && git init --bare --shared=all - popd } fi + + cd ${cdir} } bak(){ @@ -382,5 +385,4 @@ showinfo(){ iswindows || __try_exec finger $USER LANG=C __try_exec id - } From dd35e7661b5724e6a2b22fcbddc97d4c20723c64 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 22 Feb 2012 21:20:56 +0900 Subject: [PATCH 047/269] do not attempt to load /etc/bashrc --- bashrc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bashrc b/bashrc index bba53d1..3433a5e 100755 --- a/bashrc +++ b/bashrc @@ -1,6 +1,6 @@ #!/bin/bash -test -r /etc/bashrc && . /etc/bashrc +# test -r /etc/bashrc && . /etc/bashrc ########################## # system type @@ -352,8 +352,6 @@ winln(){ fi } -######################## - if iscygwin; then alias cygsu="cygstart /cygwinsetup.exe" alias emacs="CYGWIN=tty emacs -nw" From 26dd276ca9419297a8da98ab6c52ef071838d355 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 22 Feb 2012 21:21:45 +0900 Subject: [PATCH 048/269] rm window-size-save --- emacs.el | 62 +------------------------------------------------------- 1 file changed, 1 insertion(+), 61 deletions(-) diff --git a/emacs.el b/emacs.el index e8b4951..bb0c201 100644 --- a/emacs.el +++ b/emacs.el @@ -1232,6 +1232,7 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (lambda () (define-key dired-mode-map "o" 'my-dired-x-open) (define-key dired-mode-map "i" 'dired-get-du) + (define-key dired-mode-map "f" 'find-file) (define-key dired-mode-map "!" 'shell-command) (define-key dired-mode-map "&" 'async-shell-command) (define-key dired-mode-map "X" 'dired-do-async-shell-command) @@ -1751,67 +1752,6 @@ this is test, does not rename files" (beep)))))))) ;; (aref (read-key-sequence-vector "aa") 0) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; save and restore frame size -;;http://www.bookshelf.jp/soft/meadow_30.html#SEC416 -(defun my-window-size-save () - (let* ((rlist (frame-parameters (selected-frame))) - (ilist initial-frame-alist) - (nCHeight (frame-height)) - (nCWidth (frame-width)) - (tMargin (if (integerp (cdr (assoc 'top rlist))) - (cdr (assoc 'top rlist)) 0)) - (lMargin (if (integerp (cdr (assoc 'left rlist))) - (cdr (assoc 'left rlist)) 0)) - buf - (file "~/.emacs.d/.framesize.el") - (recentf-exclude '("\\.emacs\\.d/\\.framesize\\.el$"))) - (if (get-file-buffer (expand-file-name file)) - (setq buf (get-file-buffer (expand-file-name file))) - (setq buf (find-file-noselect file))) - (set-buffer buf) - (erase-buffer) - (insert (concat - ;; 初期値をいじるよりも modify-frame-parameters - ;; で変えるだけの方がいい? - "(delete 'width default-frame-alist)\n" - "(delete 'height default-frame-alist)\n" - "(delete 'top default-frame-alist)\n" - "(delete 'left default-frame-alist)\n" - "(setq default-frame-alist (append (list\n" - "'(width . " (int-to-string nCWidth) ")\n" - "'(height . " (int-to-string nCHeight) ")\n" - "'(top . " (int-to-string tMargin) ")\n" - "'(left . " (int-to-string lMargin) "))\n" - "default-frame-alist))\n" - ;;"(setq default-frame-alist default-frame-alist)" - )) - (save-buffer) - )) -(defun my-window-size-load () - (let* ((file "~/.emacs.d/.framesize.el")) - (if (file-exists-p file) - (load file)))) -(when window-system - (my-window-size-load) - (add-hook 'after-init-hook ;何かがframeの大きさ勝手に変えやがる - (lambda () - (run-with-timer 1 - nil - (lambda () - (modify-frame-parameters (selected-frame) - default-frame-alist)))) - t) - (add-hook 'kill-emacs-hook - 'my-window-size-save)) - -;; windowサイズを固定 -;; setq default-frame-alist -;; (append (list '(width . 80) -;; '(height . 35) -;; ) -;; default-frame-alist) -;; ) ;;デフォルトのフレーム設定 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; emacsを殺伐とさせる From 7615ca56f4db581a2e0fe5d5ab117ad1f9e6e668 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 23 Feb 2012 17:48:10 +0900 Subject: [PATCH 049/269] add memo of colortable16.sh url --- bashrc | 1 + 1 file changed, 1 insertion(+) diff --git a/bashrc b/bashrc index 3433a5e..2e65b14 100755 --- a/bashrc +++ b/bashrc @@ -329,6 +329,7 @@ _echocolors(){ "\e[37;1mBright White\n" \ "\e[0m" } +# http://myminios.googlecode.com/svn-history/r10/trunk/colortable16.sh null type stty && { stty stop undef # unbind C-s to stop displaying output From 7091182d10c68eb9ca76b932f618eaa94c4a3cf9 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 23 Feb 2012 17:48:24 +0900 Subject: [PATCH 050/269] update auto-revert --- emacs.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/emacs.el b/emacs.el index bb0c201..680ad38 100644 --- a/emacs.el +++ b/emacs.el @@ -1695,10 +1695,12 @@ this is test, does not rename files" (interactive) (unless (eq my-revert-buffer-if-needed-last-buffer (current-buffer)) (setq my-revert-buffer-if-needed-last-buffer (current-buffer)) - (when (or (eq major-mode 'dired-mode) + (when (or (and (eq major-mode 'dired-mode) + (dired-directory-changed-p default-directory)) (not (verify-visited-file-modtime (current-buffer)))) (revert-buffer t t) - (message "%s reverted." (buffer-name))))) + (message "%s reverted." (buffer-name)) + ))) (add-hook 'post-command-hook ; 'window-configuration-change-hook 'my-revert-buffer-if-needed) @@ -1766,7 +1768,7 @@ this is test, does not rename files" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ubuntu +;; japanese input method (defun my-load-scim () "use scim-bridge.el as japanese im." From 8109a7847739387cd4539468cb3c0374c1e27d61 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 23 Feb 2012 22:38:57 +0900 Subject: [PATCH 051/269] add my-kill-buffers --- emacs.el | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/emacs.el b/emacs.el index 680ad38..c371b17 100644 --- a/emacs.el +++ b/emacs.el @@ -1208,11 +1208,11 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (add-hook 'dired-mode-hook 'my-dired-display-all-set) -(put 'dired-find-alternate-file 'disabled nil) +(put 'dired-find-alternate-file 'disabled nil) ; when using dired-find-alternate-file reuse current dired buffer for the file to open (setq dired-ls-F-marks-symlinks t) (require 'ls-lisp) -(setq ls-lisp-use-insert-directory-program nil) +(setq ls-lisp-use-insert-directory-program nil) ; always use ls-lisp (setq ls-lisp-dirs-first t) (setq ls-lisp-use-localized-time-format t) (setq ls-lisp-format-time-list @@ -1292,10 +1292,11 @@ Optional prefix ARG says how many lines to unflag; default is one line." (interactive "p") (my-dired-mark (- arg))) -(defun dired-mode-hooks() - (local-set-key (kbd "SPC") 'my-dired-mark) - (local-set-key (kbd "S-SPC") 'my-dired-mark-backward)) -(add-hook 'dired-mode-hook 'dired-mode-hooks) +(add-hook 'dired-mode-hook + (lambda () + (local-set-key (kbd "SPC") 'my-dired-mark) + (local-set-key (kbd "S-SPC") 'my-dired-mark-backward)) + ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; eshell @@ -1576,6 +1577,14 @@ when SEC is nil, stop auto save if enabled." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; misc funcs +(defun my-kill-buffers () + "" + (interactive) + (mapcar (lambda (buf) + (when (buffer-file-name buf) + (kill-buffer buf))) + (buffer-list))) + (defun my-format-time-string (&optional time) "" (let ((system-time-locale "C")) From e84cfc2a52334ceb8084ce32c04a9af2f23d8996 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 2 Mar 2012 23:41:46 +0900 Subject: [PATCH 052/269] add my-git-shell-command and make small changes --- emacs.el | 53 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/emacs.el b/emacs.el index c371b17..711b1d2 100644 --- a/emacs.el +++ b/emacs.el @@ -70,11 +70,11 @@ (setq system-time-locale "C") ;; my prefix map -(defvar my-prefix-map - (make-sparse-keymap)) +(define-prefix-command 'my-prefix-map) (add-hook 'after-init-hook (lambda () - (define-key ctl-x-map (kbd "C-x") my-prefix-map))) + (define-key ctl-x-map (kbd "C-x") 'my-prefix-map) + )) (define-key my-prefix-map (kbd "C-q") 'quoted-insert) (define-key my-prefix-map (kbd "C-z") 'suspend-frame) @@ -381,8 +381,10 @@ ;; (global-set-key (kbd "M-h") 'backward-char) ;; (global-set-key (kbd "M-l") 'forward-char) ;;(keyboard-translate ?\M-j ?\C-j) -(global-set-key (kbd "M-p") 'backward-paragraph) -(global-set-key (kbd "M-n") 'forward-paragraph) +;; (global-set-key (kbd "M-p") 'backward-paragraph) +(define-key esc-map "p" 'backward-paragraph) +;; (global-set-key (kbd "M-n") 'forward-paragraph) +(define-key esc-map "n" 'forward-paragraph) (global-set-key (kbd "C-") (lambda () (interactive)(scroll-down 1))) (global-set-key (kbd "C-") (lambda () (interactive)(scroll-up 1))) (global-set-key (kbd "C-") 'scroll-down) @@ -511,6 +513,10 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (locate-library lib)) locate-p))) +'(setq package-archives '(("ELPA" . "http://tromey.com/elpa/") + ("gnu" . "http://elpa.gnu.org/packages/") + ("marmalade" . "http://marmalade-repo.org/packages/"))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;requireが必要なelispおよびhook @@ -1110,11 +1116,17 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (while (search-forward "なし" nil t) (replace-match "none"))))) -(defun dired-get-du () +(defun dired-get-file-info () "dired get disk usage" (interactive) - (message "calculating du...") - (dired-do-shell-command "du -hsD * " nil (dired-get-marked-files))) + (let ((f (dired-get-filename))) + (if (file-directory-p f) + (progn + (message "calculating du...") + (shell-command (concat "du -hsD " + f))) + (shell-command (concat "file " + f))))) (defun my-dired-scroll-up () "" @@ -1231,7 +1243,7 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (add-hook 'dired-mode-hook (lambda () (define-key dired-mode-map "o" 'my-dired-x-open) - (define-key dired-mode-map "i" 'dired-get-du) + (define-key dired-mode-map "i" 'dired-get-file-info) (define-key dired-mode-map "f" 'find-file) (define-key dired-mode-map "!" 'shell-command) (define-key dired-mode-map "&" 'async-shell-command) @@ -1577,6 +1589,29 @@ when SEC is nil, stop auto save if enabled." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; misc funcs +(when (require 'ansi-color nil t) + (ansi-color-for-comint-mode-on)) +(defvar git-command-history nil + "History list for git command.") +(defun my-git-shell-command (cmd) + "" + (interactive (list (read-shell-command "git: " + nil + 'git-command-history))) + (let ((bf (get-buffer-create "*Git Output*")) + ;; (process-environment `(,@process-environment)) + ;; (comint-preoutput-filter-functions '(ansi-color-apply . nil)) + ;; (comint-output-filter-functions (cons 'ansi-color-process-output + ;; comint-output-filter-functions)) + ) + (shell-command (concat "git " + cmd) + bf) + (with-current-buffer bf + (ansi-color-apply-on-region (point-min) + (point-max))))) +(define-key ctl-x-map "g" 'my-git-shell-command) + (defun my-kill-buffers () "" (interactive) From 83eda5263443329a9bf667c51e343cb2aae39b10 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 2 Mar 2012 23:46:11 +0900 Subject: [PATCH 053/269] misc changes --- bashrc | 2 +- emacs.el | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bashrc b/bashrc index 2e65b14..8f02e1a 100755 --- a/bashrc +++ b/bashrc @@ -207,7 +207,7 @@ _mygitconfig(){ git config --global alias.ci "commit --verbose" git config --global alias.co "checkout" git config --global alias.cim "commit --verbose -m" - git config --global alias.di "diff" + git config --global alias.di "diff --color" git config --global alias.me "merge --no-ff --stat -v" git config --global alias.ls "ls-files -v --full-name" git config --global alias.sl "!sl" diff --git a/emacs.el b/emacs.el index 711b1d2..3eaea86 100644 --- a/emacs.el +++ b/emacs.el @@ -1589,8 +1589,8 @@ when SEC is nil, stop auto save if enabled." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; misc funcs -(when (require 'ansi-color nil t) - (ansi-color-for-comint-mode-on)) +;; (when (require 'ansi-color nil t) +;; (ansi-color-for-comint-mode-on)) (defvar git-command-history nil "History list for git command.") (defun my-git-shell-command (cmd) From 9027b059faebbbe25d04d0f424c8f2cfd764084b Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 4 Mar 2012 19:13:38 +0900 Subject: [PATCH 054/269] use python as python-python-command when python3 is not found --- emacs.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/emacs.el b/emacs.el index 3eaea86..0c9a0a7 100644 --- a/emacs.el +++ b/emacs.el @@ -155,6 +155,7 @@ read-buffer-completion-ignore-case t) (setq resize-mini-window t) (temp-buffer-resize-mode 1) +(savehist-mode 1) (fset 'yes-or-no-p 'y-or-n-p) @@ -579,7 +580,8 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (shell-command (buffer-substring-no-properties (point-at-bol) (point)))) -(setq python-python-command (executable-find "python3")) +(setq python-python-command (or (executable-find "python3") + (executable-find "python"))) (defun my-python-run-as-command () "" (interactive) @@ -597,7 +599,8 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (add-hook 'python-mode-hook (lambda () (define-key python-mode-map (kbd "C-c C-e") 'my-python-run-as-command) - (define-key python-mode-map (kbd "C-c C-b") 'my-python-display-python-buffer))) + (define-key python-mode-map (kbd "C-c C-b") 'my-python-display-python-buffer) + (define-key python-mode-map (kbd "C-m") 'newline-and-indent))) (add-hook 'inferior-python-mode-hook (lambda () From 13cacbba769dbe1e8d0edd607e377d5ffbff889f Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 5 Mar 2012 13:35:11 +0900 Subject: [PATCH 055/269] modify --- emacs.el | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/emacs.el b/emacs.el index 0c9a0a7..e4e5b3f 100644 --- a/emacs.el +++ b/emacs.el @@ -589,13 +589,9 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (defun my-python-display-python-buffer () "" (interactive) - ;; (or python-buffer - ;; (save-excursion - ;; (run-python))) (set-window-text-height (display-buffer python-buffer t) 7)) - (add-hook 'python-mode-hook (lambda () (define-key python-mode-map (kbd "C-c C-e") 'my-python-run-as-command) @@ -935,13 +931,16 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ;; vc ;; (require 'vc) -(setq vc-handled-backends nil) +(setq vc-handled-backends '()) +(and (executable-find "git") + (add-to-list 'vc-handled-backends 'GIT)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; gauche-mode -(setq scheme-program-name - (setq gauche-program-name "gosh")) +(let ((s (executable-find "gosh"))) + (setq scheme-program-name s + gauche-program-name s)) (defun run-gauche-other-window () "Run gauche on other window" @@ -1049,11 +1048,18 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (buffer-substring-no-properties (point-at-bol) (point-at-eol)))) -(setq recentf-save-file (expand-file-name "~/.emacs.d/.recentf") +(setq recentf-save-file (expand-file-name "~/.emacs.d/recentf") recentf-max-menu-items 20 recentf-max-saved-items 30 recentf-show-file-shortcuts-flag nil) +(defun my-recentf-pop-to-buffer () + "" + (interactive) + (let ((bf (save-excursion + (recentf-open-files)))) + (pop-to-buffer bf))) + (when (require 'recentf nil t) (global-set-key "\C-x\C-r" 'recentf-open-files) ;; (add-hook 'find-file-hook @@ -1061,7 +1067,7 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ;; (recentf-add-file default-directory))) (recentf-mode 1) (add-to-list 'recentf-filename-handlers 'abbreviate-file-name) - (add-to-list 'recentf-exclude "\\.emacs\\.d/\\.recentf")) + (add-to-list 'recentf-exclude "\\.emacs\\.d/recentf")) (add-hook 'recentf-dialog-mode-hook (lambda () From 20488b2078a1e841b0ca741fe4f3f0ce8c6ab23c Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 7 Mar 2012 20:56:25 +0900 Subject: [PATCH 056/269] split profile into 2 files, for console and for x --- profile | 19 ------------------- xinitrc | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 19 deletions(-) create mode 100644 xinitrc diff --git a/profile b/profile index b62ac19..14cd0db 100755 --- a/profile +++ b/profile @@ -1,25 +1,6 @@ #!/bin/sh env > $HOME/.env.txt -if [ -n "${DESKTOP_SESSION}" ]; then - xmodmap -e 'keycode 135 = Alt_R Meta_R' # menu key as alt - xmodmap -e 'keycode 101 = Alt_R Meta_R' # hiragana key as alt - xmodmap -e 'remove Lock = Caps_Lock' - xmodmap -e 'add Control = Caps_Lock' - - synclient VertEdgeScroll=0 - synclient HorizEdgeScroll=0 - synclient MaxTapTime=0 - synclient MaxSpeed=0.4 - synclient MinSpeed=0.2 - - test -f "$HOME/.fehbg" && - type feh >/dev/null 2>&1 && - sh "$HOME/.fehbg" -else - export LC_MESSAGES=C -fi - # export PS1="\$ " export LC_TIME=C export TERMCAP="${TERMCAP}:vb=" diff --git a/xinitrc b/xinitrc new file mode 100644 index 0000000..9cc0520 --- /dev/null +++ b/xinitrc @@ -0,0 +1,18 @@ +xmodmap -e 'keycode 135 = Alt_R Meta_R' # menu key as alt +xmodmap -e 'keycode 101 = Alt_R Meta_R' # hiragana key as alt +#xmodmap -e 'remove Lock = Caps_Lock' +#xmodmap -e 'add Control = Caps_Lock' + +synclient VertEdgeScroll=0 +synclient HorizEdgeScroll=0 +synclient MaxTapTime=0 +synclient MaxSpeed=0.4 +synclient MinSpeed=0.2 + +test -f "$HOME/.fehbg" && +type feh >/dev/null 2>&1 && +sh "$HOME/.fehbg" + +#export LC_MESSAGES=C +LANG=ja_JP.utf8 + From 42dcd437d50ae50b9e87308267806c1874a6c818 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 7 Mar 2012 21:03:07 +0900 Subject: [PATCH 057/269] disable auto indent when text-mode --- emacs.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emacs.el b/emacs.el index e4e5b3f..32499c8 100644 --- a/emacs.el +++ b/emacs.el @@ -604,6 +604,10 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (define-key inferior-python-mode-map (kbd "") 'comint-previous-input) (define-key inferior-python-mode-map (kbd "") 'comint-next-input))) +(add-hook 'text-mode-hook + (lambda () + (define-key text-mode-map (kbd "C-m") 'newline))) + (add-to-list 'Info-default-directory-list (expand-file-name "~/.info/emacs-ja")) (setq bookmark-default-file "~/.emacs.d/bmk") From 142850189ad69df53fb7bbfb6340c40c9c8dfdc6 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 7 Mar 2012 21:07:30 +0900 Subject: [PATCH 058/269] modify README --- README.txt | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/README.txt b/README.txt index 987c90a..5bca638 100644 --- a/README.txt +++ b/README.txt @@ -1,13 +1,12 @@ -~/.xsessionrc <= graphical login +~/.bash_profile <= console login | -`-- ~/.profile <= text login - | - |-- ~/.dotfiles/profile - | - * if shell is bash - | - `-- ~/.bashrc <= run bash - | - `-- ~/.dotfiles/bashrc - | - `-- /etc/bashrc +|--~/.dotfiles/profile +| +`--~/.bashrc + | + `--~/.dotfiles/bashrc + +~/.xinitrc <= startx (~/.config/openbox/autostart also executed) +| +`--~/.dotfiles/xinitrc + From 6f28af40c47db1c10e483a66743360d344ff1756 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 7 Mar 2012 21:10:54 +0900 Subject: [PATCH 059/269] modify xinitrc --- xinitrc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/xinitrc b/xinitrc index 9cc0520..57aa27d 100644 --- a/xinitrc +++ b/xinitrc @@ -2,12 +2,15 @@ xmodmap -e 'keycode 135 = Alt_R Meta_R' # menu key as alt xmodmap -e 'keycode 101 = Alt_R Meta_R' # hiragana key as alt #xmodmap -e 'remove Lock = Caps_Lock' #xmodmap -e 'add Control = Caps_Lock' +setxkbmap -model "acer_laptop" -layout "jp" -option "ctrl:nocaps" -synclient VertEdgeScroll=0 -synclient HorizEdgeScroll=0 -synclient MaxTapTime=0 -synclient MaxSpeed=0.4 -synclient MinSpeed=0.2 +type synclient >/dev/null 2&>1 && { + synclient VertEdgeScroll=0 + synclient HorizEdgeScroll=0 + synclient MaxTapTime=0 + synclient MaxSpeed=0.4 + synclient MinSpeed=0.2 +} test -f "$HOME/.fehbg" && type feh >/dev/null 2>&1 && From f1a996ce2d9f11c82355a18ea4f67002e61b1dfc Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 7 Mar 2012 21:19:23 +0900 Subject: [PATCH 060/269] fix stupid bug --- xinitrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xinitrc b/xinitrc index 57aa27d..b7c5604 100644 --- a/xinitrc +++ b/xinitrc @@ -4,7 +4,7 @@ xmodmap -e 'keycode 101 = Alt_R Meta_R' # hiragana key as alt #xmodmap -e 'add Control = Caps_Lock' setxkbmap -model "acer_laptop" -layout "jp" -option "ctrl:nocaps" -type synclient >/dev/null 2&>1 && { +type synclient >/dev/null 2>&1 && { synclient VertEdgeScroll=0 synclient HorizEdgeScroll=0 synclient MaxTapTime=0 From d3dd1beafd25278a891024fe186b5e891018116d Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 8 Mar 2012 00:34:41 +0900 Subject: [PATCH 061/269] fix language environment --- bashrc | 2 +- xinitrc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bashrc b/bashrc index 8f02e1a..537426b 100755 --- a/bashrc +++ b/bashrc @@ -53,7 +53,7 @@ else fi export VISUAL="$EDITOR" export LESS="-iRMX" -# export LC_MESSAGES="C" +export LC_MESSAGES=C # export LANG=ja_JP.UTF-8 # export CDPATH=".:~" # 使い方がよく分からない export GIT_PAGER="$PAGER" diff --git a/xinitrc b/xinitrc index b7c5604..b505e65 100644 --- a/xinitrc +++ b/xinitrc @@ -8,7 +8,7 @@ type synclient >/dev/null 2>&1 && { synclient VertEdgeScroll=0 synclient HorizEdgeScroll=0 synclient MaxTapTime=0 - synclient MaxSpeed=0.4 + synclient MaxSpeed=2.0 synclient MinSpeed=0.2 } @@ -17,5 +17,5 @@ type feh >/dev/null 2>&1 && sh "$HOME/.fehbg" #export LC_MESSAGES=C -LANG=ja_JP.utf8 +export LANG=ja_JP.utf8 From 7a173ff7118009a8e68ca193b2d09809244330df Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 8 Mar 2012 14:59:21 +0900 Subject: [PATCH 062/269] split x files into two files, background program prefs and others --- xinitrc | 6 +----- xprograms | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) create mode 100755 xprograms diff --git a/xinitrc b/xinitrc index b505e65..cd24894 100644 --- a/xinitrc +++ b/xinitrc @@ -12,10 +12,6 @@ type synclient >/dev/null 2>&1 && { synclient MinSpeed=0.2 } -test -f "$HOME/.fehbg" && -type feh >/dev/null 2>&1 && -sh "$HOME/.fehbg" - -#export LC_MESSAGES=C +unset LC_MESSAGES export LANG=ja_JP.utf8 diff --git a/xprograms b/xprograms new file mode 100755 index 0000000..8559952 --- /dev/null +++ b/xprograms @@ -0,0 +1,22 @@ +#!/bin/sh +# Programs run in background when starting x. +# These programs are basically for Openbox Window Manager. +# Japanese IM settings are not included in this list. + +test -f "$HOME/.fehbg" && +type feh >/dev/null 2>&1 && +sh "$HOME/.fehbg" + +tint2 & + +#dropboxd & # done by ~/.config/autostart/dropbox.desktop + +volumeicon & +#wicd-client --tray & # done by /etc/xdg/autostart/wicd-client.desktop +# Detection of insertion of an optical disk +if ! pgrep -lf "udisks-daemon: polling /dev/sr0"; then + udisks --poll-for-media /dev/sr0 +fi + +udisksvm >/dev/null & + From 5481fd19c029616008087437f6c5006789ced339 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 8 Mar 2012 21:45:17 +0900 Subject: [PATCH 063/269] fix bug of keyboard prefs --- xinitrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xinitrc b/xinitrc index cd24894..9796e14 100644 --- a/xinitrc +++ b/xinitrc @@ -1,8 +1,8 @@ +setxkbmap -model "acer_laptop" -layout "jp" -option "ctrl:nocaps" # this line must comes first xmodmap -e 'keycode 135 = Alt_R Meta_R' # menu key as alt xmodmap -e 'keycode 101 = Alt_R Meta_R' # hiragana key as alt #xmodmap -e 'remove Lock = Caps_Lock' #xmodmap -e 'add Control = Caps_Lock' -setxkbmap -model "acer_laptop" -layout "jp" -option "ctrl:nocaps" type synclient >/dev/null 2>&1 && { synclient VertEdgeScroll=0 From c1cb4f6ca54d2c863923c0cb416738615724975b Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 8 Mar 2012 21:45:42 +0900 Subject: [PATCH 064/269] fix url of js2-mode --- emacs.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs.el b/emacs.el index 32499c8..fb0cdd4 100644 --- a/emacs.el +++ b/emacs.el @@ -659,7 +659,7 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." )) (when (dllib-if-unfound "js2-mode" - "https://github.com/mooz/js2-mode/raw/master/js2-mode.el" + "https://raw.github.com/mooz/js2-mode/master/js2-mode.el" t) (autoload 'js2-mode "js2-mode" nil t) (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode)) From c94e8214449a5e864f4780111501b9908112fb87 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 8 Mar 2012 21:51:52 +0900 Subject: [PATCH 065/269] fix git-command bug --- emacs.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/emacs.el b/emacs.el index fb0cdd4..0df29c7 100644 --- a/emacs.el +++ b/emacs.el @@ -1621,8 +1621,9 @@ when SEC is nil, stop auto save if enabled." cmd) bf) (with-current-buffer bf - (ansi-color-apply-on-region (point-min) - (point-max))))) + (and (require 'ansi-color nil t) + (ansi-color-apply-on-region (point-min) + (point-max)))))) (define-key ctl-x-map "g" 'my-git-shell-command) (defun my-kill-buffers () From d5c97807e2fd474ef32b9b759fae52258e25c2d3 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 9 Mar 2012 00:53:43 +0900 Subject: [PATCH 066/269] update auto-install-plugins urls --- _keysnail.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/_keysnail.js b/_keysnail.js index 1078bf1..f397139 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -181,14 +181,15 @@ ext.add('my-setpref', function(){ ext.add('auto-install-plugins', function(ev, arg){ var urls = [ - 'https://github.com/mooz/keysnail/raw/master/plugins/yet-another-twitter-client-keysnail.ks.js', - 'https://github.com/mooz/keysnail/raw/master/plugins/site-local-keymap.ks.js', - 'https://github.com/azu/KeySnail-Plugins/raw/master/JSReference/js-referrence.ks.js', + 'https://raw.github.com/mooz/keysnail/master/plugins/yet-another-twitter-client-keysnail.ks.js', + 'https://raw.github.com/mooz/keysnail/master/plugins/site-local-keymap.ks.js', + 'https://raw.github.com/azu/KeySnail-Plugins/master/JSReference/js-referrence.ks.js', 'https://raw.github.com/gongo/keysnail_plugin/master/linksnail.ks.js', - 'https://github.com/tkosaka/keysnail-plugin/raw/master/nicontroller.ks.js', + 'https://raw.github.com/tkosaka/keysnail-plugin/master/nicontroller.ks.js', 'https://raw.github.com/10sr/keysnail-plugin/master/shiitake.ks.js', 'https://raw.github.com/10sr/keysnail-plugin/master/dig-url.ks.js', 'https://raw.github.com/10sr/keysnail-plugin/master/instapaper.ks.js', + 'https://raw.github.com/gist/1976942/firefox-addon-manager.ks.js' ]; function inst(a){ From 381771060b7985fb1d521ab629a741561498e96f Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 9 Mar 2012 00:58:41 +0900 Subject: [PATCH 067/269] update git-command --- emacs.el | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/emacs.el b/emacs.el index 0df29c7..3631fee 100644 --- a/emacs.el +++ b/emacs.el @@ -336,6 +336,8 @@ (setq revert-without-query '(".+")) ;; カーソルの場所を保存する +(setq save-place-file (concat user-emacs-directory + "places")) (when (require 'saveplace nil t) (setq-default save-place t)) @@ -711,11 +713,6 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." 'newframe 'pushy)) -;; (when (and (executable-find "git") -;; (require 'sgit-mode nil t)) -;; (add-hook 'find-file-hook -;; 'sgit-load)) - (require 'session nil t) (when (require 'gtkbm nil t) @@ -1352,10 +1349,6 @@ 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) -;; "" -;; ) - (defun eshell/o (&optional file) (my-x-open (or file "."))) @@ -1608,10 +1601,11 @@ when SEC is nil, stop auto save if enabled." "History list for git command.") (defun my-git-shell-command (cmd) "" - (interactive (list (read-shell-command "git: " + (interactive (list (read-shell-command (format "[%s] $ git : " + (abbreviate-file-name default-directory)) nil 'git-command-history))) - (let ((bf (get-buffer-create "*Git Output*")) + (let ((dir default-directory) (bf (get-buffer-create "*Git Output*")) ;; (process-environment `(,@process-environment)) ;; (comint-preoutput-filter-functions '(ansi-color-apply . nil)) ;; (comint-output-filter-functions (cons 'ansi-color-process-output @@ -1621,6 +1615,7 @@ when SEC is nil, stop auto save if enabled." cmd) bf) (with-current-buffer bf + (cd dir) (and (require 'ansi-color nil t) (ansi-color-apply-on-region (point-min) (point-max)))))) From 4e5a98df6c4cc19a90f61475e90e2ac987c04dea Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 9 Mar 2012 03:37:30 +0900 Subject: [PATCH 068/269] add pacman and yaourt prefs --- bashrc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bashrc b/bashrc index 537426b..f4e4a38 100755 --- a/bashrc +++ b/bashrc @@ -67,9 +67,6 @@ alias ls="ls -hCFG $(test "$TERM" == dumb || echo --color=auto\ )--time-style=lo alias vl=/usr/share/vim/vimcurrent/macros/less.sh alias em="emacs -nw" # alias apt-get="sudo apt-get" -alias aptin="apt-get install" -alias aptsearch="apt-cache search" -alias aptshow="apt-cache show" alias ut="ssh t110414@un001.ecc.u-tokyo.ac.jp" alias rand="echo \$RANDOM" alias xunp="file-roller -h" @@ -86,6 +83,14 @@ alias sudo="sudo " # use aliases through sudo alias e3=e3em alias mytime="date +%Y%m%d-%H%M%S" alias sh="ENV=$HOME/.shrc PS1=\$\ sh" + +alias aptin="apt-get install" +alias aptsearch="apt-cache search" +alias aptshow="apt-cache show" + +alias yt=yaourt +export PACMAN=pacman-color + if isdarwin then alias upgrade="port selfupdate && port sync && port upgrade installed" From 5de6736e03d5260f47ca5d1b6ce9279172982169 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 9 Mar 2012 03:37:51 +0900 Subject: [PATCH 069/269] small change --- _keysnail.js | 1 + 1 file changed, 1 insertion(+) diff --git a/_keysnail.js b/_keysnail.js index f397139..94b87b0 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -177,6 +177,7 @@ ext.add('my-setpref', function(){ "keyword.URL":"http://www.bing.com/search?q=", } ); + display.showPopup("Keysnail", "My prefs done."); }, 'my setpref'); ext.add('auto-install-plugins', function(ev, arg){ From 4c6cfd4c2c724e2542acab6464785485dc7b5cf9 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 9 Mar 2012 03:38:42 +0900 Subject: [PATCH 070/269] add lang setting to profile --- bashrc | 1 - profile | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/bashrc b/bashrc index f4e4a38..13317e5 100755 --- a/bashrc +++ b/bashrc @@ -54,7 +54,6 @@ fi export VISUAL="$EDITOR" export LESS="-iRMX" export LC_MESSAGES=C -# export LANG=ja_JP.UTF-8 # export CDPATH=".:~" # 使い方がよく分からない export GIT_PAGER="$PAGER" export GIT_EDITOR="$EDITOR" diff --git a/profile b/profile index 14cd0db..9819fba 100755 --- a/profile +++ b/profile @@ -2,6 +2,7 @@ env > $HOME/.env.txt # export PS1="\$ " +export LANG=ja_JP.UTF-8 export LC_TIME=C export TERMCAP="${TERMCAP}:vb=" export HOSTNAME From 90c10f979450f1820b89480a009415920e4cdcda Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 9 Mar 2012 16:50:36 +0900 Subject: [PATCH 071/269] add some user prefs --- _keysnail.js | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/_keysnail.js b/_keysnail.js index 94b87b0..8ff0b77 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -161,20 +161,37 @@ plugins.options["twitter_client.use_jmp"] = true; ext.add('my-setpref', function(){ util.setPrefs( { - "browser.tabs.loadDivertedInBackground": true, - "dom.disable_window_open_feature.location": false, - "dom.max_script_run_time": 30, "browser.bookmarks.max_backups":0, - "browser.urlbar.autocomplete.enabled":false, "browser.cache.memory.capacity":16384, - "browser.sessionhistory.max_total_viewers":8, "browser.download.manager.closeWhenDone":true, "browser.download.useDownloadDir":false, + "browser.fullscreen.autohide":false, + "browser.search.openintab":true, + "browser.sessionhistory.max_total_viewers":8, "browser.tabs.closeWindowWithLastTab":false, - "network.dns.disableIPv6":true, + "browser.tabs.loadDivertedInBackground": true, + "browser.urlbar.autocomplete.enabled":false, "browser.urlbar.trimURLs":false, - "browser.fullscreen.autohide":false, + "dom.disable_window_open_feature.location": false, + "dom.max_script_run_time": 30, "keyword.URL":"http://www.bing.com/search?q=", + "network.dns.disableIPv6":true, + "extensions.chaika.bbsmenu.open_new_tab":true, + "extensions.chaika.bbsmenu.open_single_click":false, + "extensions.chaika.board.open_new_tab":true, + "extensions.chaika.board.open_single_click":false, + "extensions.foxage2ch.openThreadInTab":true, + "extensions.saveimageinfolder.general-fileprefixvalue":"%yyyy%%MM%%dd%-%hh%%mm%%ss%_", + "extensions.saveimageinfolder.general-duplicatefilenamevalue":1, + "extensions.saveimageinfolder.usecache":true, + "extensions.tabutils.openTabNext":1, + "extensions.tabutils.styles.current":"{\"bold\":true,\"italic\":false,\"underline\":true,\"strikethrough\":false,\"color\":true,\"colorCode\":\"#EEEEEE\",\"bgColor\":true,\"bgColorCode\":\"#000000\",\"outline\":true,\"outlineColorCode\":\"#000000\"}", + "extensions.yass.edgetype":0, + "extensions.yass.selectedpreset":"red", + "font.default.x-western":"sans-serif", + "general.warnOnAboutConfig":false, + "refcontrol.actions":"@DEFAULT=@FORGE", + "scrapbook.tabs.open":true } ); display.showPopup("Keysnail", "My prefs done."); From a65183179d847b2d68fd85ca9ee378dfb7f16a15 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 9 Mar 2012 18:58:14 +0900 Subject: [PATCH 072/269] update user prefs --- _keysnail.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/_keysnail.js b/_keysnail.js index 8ff0b77..94c3245 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -168,21 +168,20 @@ ext.add('my-setpref', function(){ "browser.fullscreen.autohide":false, "browser.search.openintab":true, "browser.sessionhistory.max_total_viewers":8, + "browser.sessionstore.restore_on_demand":true, "browser.tabs.closeWindowWithLastTab":false, "browser.tabs.loadDivertedInBackground": true, "browser.urlbar.autocomplete.enabled":false, "browser.urlbar.trimURLs":false, "dom.disable_window_open_feature.location": false, "dom.max_script_run_time": 30, - "keyword.URL":"http://www.bing.com/search?q=", - "network.dns.disableIPv6":true, "extensions.chaika.bbsmenu.open_new_tab":true, "extensions.chaika.bbsmenu.open_single_click":false, "extensions.chaika.board.open_new_tab":true, "extensions.chaika.board.open_single_click":false, "extensions.foxage2ch.openThreadInTab":true, - "extensions.saveimageinfolder.general-fileprefixvalue":"%yyyy%%MM%%dd%-%hh%%mm%%ss%_", "extensions.saveimageinfolder.general-duplicatefilenamevalue":1, + "extensions.saveimageinfolder.general-fileprefixvalue":"%yyyy%%MM%%dd%-%hh%%mm%%ss%_", "extensions.saveimageinfolder.usecache":true, "extensions.tabutils.openTabNext":1, "extensions.tabutils.styles.current":"{\"bold\":true,\"italic\":false,\"underline\":true,\"strikethrough\":false,\"color\":true,\"colorCode\":\"#EEEEEE\",\"bgColor\":true,\"bgColorCode\":\"#000000\",\"outline\":true,\"outlineColorCode\":\"#000000\"}", @@ -190,6 +189,8 @@ ext.add('my-setpref', function(){ "extensions.yass.selectedpreset":"red", "font.default.x-western":"sans-serif", "general.warnOnAboutConfig":false, + "keyword.URL":"http://www.bing.com/search?q=", + "network.dns.disableIPv6":true, "refcontrol.actions":"@DEFAULT=@FORGE", "scrapbook.tabs.open":true } From 7e049ab0e844e267d2f5d4cff06f79d371bde652 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 9 Mar 2012 18:58:26 +0900 Subject: [PATCH 073/269] add alias halt and reboot --- bashrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bashrc b/bashrc index 13317e5..9d8c52f 100755 --- a/bashrc +++ b/bashrc @@ -82,6 +82,8 @@ alias sudo="sudo " # use aliases through sudo alias e3=e3em alias mytime="date +%Y%m%d-%H%M%S" alias sh="ENV=$HOME/.shrc PS1=\$\ sh" +alias halt="sudo halt" +alias reboot="sudo reboot" alias aptin="apt-get install" alias aptsearch="apt-cache search" From 61631c9d3699e6c52bae4fb3740b7ee3c2ddc825 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 10 Mar 2012 13:58:12 +0900 Subject: [PATCH 074/269] update git-command --- emacs.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/emacs.el b/emacs.el index 3631fee..5244b96 100644 --- a/emacs.el +++ b/emacs.el @@ -1605,12 +1605,14 @@ when SEC is nil, stop auto save if enabled." (abbreviate-file-name default-directory)) nil 'git-command-history))) - (let ((dir default-directory) (bf (get-buffer-create "*Git Output*")) + (let ((dir default-directory) + (bf (get-buffer-create "*Git Output*")) ;; (process-environment `(,@process-environment)) ;; (comint-preoutput-filter-functions '(ansi-color-apply . nil)) ;; (comint-output-filter-functions (cons 'ansi-color-process-output ;; comint-output-filter-functions)) ) + (delete-windows-on bf t) (shell-command (concat "git " cmd) bf) From a2895dad6c3b1a5499a769b7d38c105d72e2aa03 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 10 Mar 2012 13:58:29 +0900 Subject: [PATCH 075/269] update prefs --- _keysnail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_keysnail.js b/_keysnail.js index 94c3245..d55d783 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -184,7 +184,7 @@ ext.add('my-setpref', function(){ "extensions.saveimageinfolder.general-fileprefixvalue":"%yyyy%%MM%%dd%-%hh%%mm%%ss%_", "extensions.saveimageinfolder.usecache":true, "extensions.tabutils.openTabNext":1, - "extensions.tabutils.styles.current":"{\"bold\":true,\"italic\":false,\"underline\":true,\"strikethrough\":false,\"color\":true,\"colorCode\":\"#EEEEEE\",\"bgColor\":true,\"bgColorCode\":\"#000000\",\"outline\":true,\"outlineColorCode\":\"#000000\"}", + "extensions.tabutils.styles.current":"{\"bold\":true,\"italic\":false,\"underline\":true,\"strikethrough\":false,\"color\":true,\"colorCode\":\"#EEEEEE\",\"bgColor\":true,\"bgColorCode\":\"#000000\",\"outline\":false,\"outlineColorCode\":\"#000000\"}", "extensions.yass.edgetype":0, "extensions.yass.selectedpreset":"red", "font.default.x-western":"sans-serif", From 48de0226ef2564fcedb6892eed5b3015eef68127 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 10 Mar 2012 15:45:40 +0900 Subject: [PATCH 076/269] cleanse code --- bashrc | 143 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 74 insertions(+), 69 deletions(-) diff --git a/bashrc b/bashrc index 9d8c52f..5ceb928 100755 --- a/bashrc +++ b/bashrc @@ -1,10 +1,14 @@ #!/bin/bash -# test -r /etc/bashrc && . /etc/bashrc - ########################## # system type +alias ismsys=false +alias iscygwin=false +alias isdarwin=false +alias iswindows="iscygwin || ismsys" +alias islinux="! iswindows && ! isdarwin" # i havent used unix yet + if uname | grep -E "^MINGW32" >/dev/null 2>&1 then alias ismsys=true @@ -19,8 +23,6 @@ else alias iscygwin=false fi -alias iswindows="iscygwin || ismsys" - if uname | grep -E 'Darwin' >/dev/null 2>&1 then alias isdarwin=true @@ -45,7 +47,7 @@ else export PAGER="less" fi -if type vim >/dev/null 2>&1 +if null type vim then export EDITOR=vim else @@ -54,10 +56,39 @@ fi export VISUAL="$EDITOR" export LESS="-iRMX" export LC_MESSAGES=C -# export CDPATH=".:~" # 使い方がよく分からない +export CDPATH=".:~" export GIT_PAGER="$PAGER" export GIT_EDITOR="$EDITOR" +null type stty && { + stty stop undef # unbind C-s to stop displaying output + stty erase '^h' +} + +if iswindows; then + # export TMP=/tmp + # export TEMP=/tmp + # 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 USER=$USERNAME +fi + +####################### + +uname -a +if test -f /etc/issue.net +then + cat /etc/issue.net +else + if test -f /etc/issue + then + cat /etc/issue + fi +fi + +################################### +# some aliases and functions + alias ls="ls -hCFG $(test "$TERM" == dumb || echo --color=auto\ )--time-style=long-iso" # alias ll="ls -l" # alias la="ls -A" @@ -66,12 +97,11 @@ alias ls="ls -hCFG $(test "$TERM" == dumb || echo --color=auto\ )--time-style=lo alias vl=/usr/share/vim/vimcurrent/macros/less.sh alias em="emacs -nw" # alias apt-get="sudo apt-get" -alias ut="ssh t110414@un001.ecc.u-tokyo.ac.jp" +alias ut="ssh 6365454829@un001.ecc.u-tokyo.ac.jp" alias rand="echo \$RANDOM" alias xunp="file-roller -h" alias pacome="sudo \paco -D" alias psall="ps auxww" -alias g=git alias q=exit alias p="$PAGER" alias c=cat @@ -84,6 +114,7 @@ alias mytime="date +%Y%m%d-%H%M%S" alias sh="ENV=$HOME/.shrc PS1=\$\ sh" alias halt="sudo halt" alias reboot="sudo reboot" +# type trash >/dev/null 2>&1 && alias rm=trash alias aptin="apt-get install" alias aptsearch="apt-cache search" @@ -92,15 +123,36 @@ alias aptshow="apt-cache show" alias yt=yaourt export PACMAN=pacman-color -if isdarwin +alias ubuntu-upgrade="sudo apt-get autoremove --yes && sudo apt-get update --yes && sudo apt-get upgrade --yes" +alias arch-upgrade="yaourt -Syu" +alias port-upgrade="port selfupdate && port sync && port upgrade installed" + +if iscygwin; then + ! null type windate && alias windate="/c/Windows/System32/cmd.exe //c 'echo %DATE%-%TIME%'" + alias cygsu="cygstart /cygwinsetup.exe" + alias emacs="CYGWIN=tty emacs -nw" + alias ls="ls -CFG $(test "$TERM" == dumb || echo --color=auto)" +fi + +alias g=git +if null type _git # enable programmable completion for g then - alias upgrade="port selfupdate && port sync && port upgrade installed" -else - alias upgrade="sudo apt-get autoremove --yes && sudo apt-get update --yes && sudo apt-get upgrade --yes" + complete -o bashdefault -o default -o nospace -F _git g 2>/dev/null \ + || complete -o default -o nospace -F _git g fi -iswindows && ! type windate >/dev/null 2>&1 && alias windate="/c/Windows/System32/cmd.exe //c 'echo %DATE%-%TIME%'" -# alias diff="$(type colordiff >/dev/null 2>&1 && test $TERM != dumb && echo color)diff -u" -# type trash >/dev/null 2>&1 && alias rm=trash + +showinfo(){ + echo "Japanese letters are 表示可能" + + __try_exec diskinfo + + ! isdarwin && test -n "${DESKTOP_SESSION}" && type xrandr >/dev/null 2>&1 && { + xrandr | grep --color=never ^Screen + } + + iswindows || __try_exec finger $USER + LANG=C __try_exec id +} export __MYGITBAREREP="${HOME}/dbx/.git-bare" git-make-local-rep(){ @@ -132,7 +184,7 @@ bak(){ done } di(){ - if type colordiff >/dev/null 2>&1 && test $TERM != dumb + if null type colordiff && test $TERM != dumb then local diffcmd=colordiff else @@ -141,10 +193,10 @@ di(){ ${diffcmd} -u "$@" | ${PAGER} } throw-away(){ - mkdir -p ~/bu/tb + mkdir -p ~/.backup/tb for file in "$@" do - mv $file ~/bu/tb + mv $file ~/.backup/tb done } mkcd(){ @@ -225,12 +277,6 @@ _mygitconfig(){ fi } -if type _git >/dev/null 2>&1 # enable programmable completion of g -then - complete -o bashdefault -o default -o nospace -F _git g 2>/dev/null \ - || complete -o default -o nospace -F _git g -fi - __my_parse_svn_branch() { local LANG=C local svn_url=$(svn info 2>/dev/null | sed -ne 's#^URL: ##p') @@ -278,17 +324,15 @@ __my_prompt_function(){ # used by PS1 local date=$(LANG=C __try_exec date +"%a, %d %b %Y %T %z") fi local svn=$(type svn >/dev/null 2>&1 && __try_exec __my_svn_ps1 [SVN:%s]) - jobs printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}\n" + jobs printf "${c2}${USER}@${HOSTNAME}${cdef} ${date} ${BASH} ${BASH_VERSION}\n" printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " } -# type date >/dev/null 2>&1 || alias date=":" # "cmd /c echo %time%" - -if [ "${EMACS}" = "t" ]; then # emacs shell用 +if [ "${EMACS}" = "t" ]; then # for emacs shell true export PS1="\u@\H \d \t \w\nemacs shell\$ " -elif echo "$EMACS" | grep term >/dev/null 2>&1; then # emacs term用 +elif echo "$EMACS" | grep term >/dev/null 2>&1; then # for emacs term echo "emacs term" fi @@ -337,15 +381,8 @@ _echocolors(){ } # http://myminios.googlecode.com/svn-history/r10/trunk/colortable16.sh -null type stty && { - stty stop undef # unbind C-s to stop displaying output - stty erase '^h' -} - -######################### -# for windose - winln(){ + # for windose make link (actually junction) if test $# -eq 0 then { @@ -359,35 +396,3 @@ winln(){ fi } -if iscygwin; then - alias cygsu="cygstart /cygwinsetup.exe" - alias emacs="CYGWIN=tty emacs -nw" - echo "cygwin bash" -fi - -if iswindows; then - # export TMP=/tmp - # export TEMP=/tmp - # 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 \$ " - alias ls="ls -CFG $(test "$TERM" == dumb || echo --color=auto)" - export USER=$USERNAME -fi - -####################### - -uname -a -test -f /etc/issue.net && cat /etc/issue.net - -showinfo(){ - echo "Japanese letters are 表示可能" - - __try_exec diskinfo - - ! isdarwin && test -n "${DESKTOP_SESSION}" && type xrandr >/dev/null 2>&1 && { - xrandr | grep --color=never ^Screen - } - - iswindows || __try_exec finger $USER - LANG=C __try_exec id -} From f33fd535a5374b1899e7787cb9cae0c1275d8020 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 10 Mar 2012 15:46:04 +0900 Subject: [PATCH 077/269] modify tabutil style --- _keysnail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_keysnail.js b/_keysnail.js index d55d783..cda0ff2 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -184,7 +184,7 @@ ext.add('my-setpref', function(){ "extensions.saveimageinfolder.general-fileprefixvalue":"%yyyy%%MM%%dd%-%hh%%mm%%ss%_", "extensions.saveimageinfolder.usecache":true, "extensions.tabutils.openTabNext":1, - "extensions.tabutils.styles.current":"{\"bold\":true,\"italic\":false,\"underline\":true,\"strikethrough\":false,\"color\":true,\"colorCode\":\"#EEEEEE\",\"bgColor\":true,\"bgColorCode\":\"#000000\",\"outline\":false,\"outlineColorCode\":\"#000000\"}", + "extensions.tabutils.styles.current":"{\"bold\":false,\"italic\":false,\"underline\":true,\"strikethrough\":false,\"color\":true,\"colorCode\":\"#EEEEEE\",\"bgColor\":true,\"bgColorCode\":\"#000000\",\"outline\":false,\"outlineColorCode\":\"#000000\"}", "extensions.yass.edgetype":0, "extensions.yass.selectedpreset":"red", "font.default.x-western":"sans-serif", From 77f823e7d5744ade53e4ba65f19a3c11c33afcd8 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 10 Mar 2012 15:58:54 +0900 Subject: [PATCH 078/269] fix --- bashrc | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/bashrc b/bashrc index 5ceb928..4c863ea 100755 --- a/bashrc +++ b/bashrc @@ -76,14 +76,16 @@ fi ####################### uname -a -if test -f /etc/issue.net + +if [ "${EMACS}" = "t" ]; then # for emacs shell + true export PS1="\u@\H \d \t \w\nemacs shell\$ " +elif echo "$EMACS" | grep term >/dev/null 2>&1; then # for emacs term + echo "Emacs Term" +fi + +if test -f /etc/issue then - cat /etc/issue.net -else - if test -f /etc/issue - then - cat /etc/issue - fi + cat /etc/issue fi ################################### @@ -128,7 +130,7 @@ alias arch-upgrade="yaourt -Syu" alias port-upgrade="port selfupdate && port sync && port upgrade installed" if iscygwin; then - ! null type windate && alias windate="/c/Windows/System32/cmd.exe //c 'echo %DATE%-%TIME%'" + null type windate || alias windate="/c/Windows/System32/cmd.exe //c 'echo %DATE%-%TIME%'" alias cygsu="cygstart /cygwinsetup.exe" alias emacs="CYGWIN=tty emacs -nw" alias ls="ls -CFG $(test "$TERM" == dumb || echo --color=auto)" @@ -330,12 +332,6 @@ __my_prompt_function(){ # used by PS1 printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " } -if [ "${EMACS}" = "t" ]; then # for emacs shell - true export PS1="\u@\H \d \t \w\nemacs shell\$ " -elif echo "$EMACS" | grep term >/dev/null 2>&1; then # for emacs term - echo "emacs term" -fi - #Change ANSI Colors _chengecolors(){ echo -e \ From 331e67ff2e2b75276d57b08672df1d2ec1a4c5be Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 10 Mar 2012 16:31:23 +0900 Subject: [PATCH 079/269] refactoring system type command --- bashrc | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/bashrc b/bashrc index 4c863ea..615bd2f 100755 --- a/bashrc +++ b/bashrc @@ -9,26 +9,11 @@ alias isdarwin=false alias iswindows="iscygwin || ismsys" alias islinux="! iswindows && ! isdarwin" # i havent used unix yet -if uname | grep -E "^MINGW32" >/dev/null 2>&1 -then - alias ismsys=true -else - alias ismsys=false -fi - -if uname | grep -E "^CYGWIN" >/dev/null 2>&1 -then - alias iscygwin=true -else - alias iscygwin=false -fi - -if uname | grep -E 'Darwin' >/dev/null 2>&1 -then - alias isdarwin=true -else - alias isdarwin=false -fi +case `uname` in + (MINGW32*) alias ismsys=true ;; + (CYGWIN*) alias iscygwin=true ;; + (Darwin*) alias isdarwin=true ;; +esac ########################################## null(){ @@ -327,7 +312,6 @@ __my_prompt_function(){ # used by PS1 fi local svn=$(type svn >/dev/null 2>&1 && __try_exec __my_svn_ps1 [SVN:%s]) printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}\n" - jobs printf "${c2}${USER}@${HOSTNAME}${cdef} ${date} ${BASH} ${BASH_VERSION}\n" printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " } From 6ee19f82f82076ee8271a357375cc0b3d08ff062 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 11 Mar 2012 00:06:03 +0900 Subject: [PATCH 080/269] add battery-status, runs very very slow --- bashrc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bashrc b/bashrc index 615bd2f..f8e86e0 100755 --- a/bashrc +++ b/bashrc @@ -376,3 +376,14 @@ winln(){ fi } +battery-status(){ + local dir=/sys/class/power_supply/BAT0 + st=$(cat $dir/status) + full=$(cat $dir/charge_full) + now=$(cat $dir/charge_now) + # . $dir/uevent + # rate=$(expr $POWER_SUPPLY_CHARGE_NOW \* 100 / $POWER_SUPPLY_CHARGE_FULL) + rate=$(expr $now \* 100 / $full) + echo ${st}:${rate}\% +} + From f2d32d2a164d9fe8b850aa26405a251757a518dd Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 11 Mar 2012 00:59:51 +0900 Subject: [PATCH 081/269] modify battery function --- bashrc | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/bashrc b/bashrc index f8e86e0..3105387 100755 --- a/bashrc +++ b/bashrc @@ -311,7 +311,8 @@ __my_prompt_function(){ # used by PS1 local date=$(LANG=C __try_exec date +"%a, %d %b %Y %T %z") fi local svn=$(type svn >/dev/null 2>&1 && __try_exec __my_svn_ps1 [SVN:%s]) - printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}\n" + # local battery=$(battery-status "[%s]" | sed -e 's"%"%%"g') # very slow + printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}${battery}\n" printf "${c2}${USER}@${HOSTNAME}${cdef} ${date} ${BASH} ${BASH_VERSION}\n" printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " } @@ -378,12 +379,21 @@ winln(){ battery-status(){ local dir=/sys/class/power_supply/BAT0 - st=$(cat $dir/status) - full=$(cat $dir/charge_full) - now=$(cat $dir/charge_now) - # . $dir/uevent - # rate=$(expr $POWER_SUPPLY_CHARGE_NOW \* 100 / $POWER_SUPPLY_CHARGE_FULL) - rate=$(expr $now \* 100 / $full) - echo ${st}:${rate}\% + if test -d $dir + then + local st=$(cat $dir/status) + local full=$(cat $dir/charge_full) + local now=$(cat $dir/charge_now) + local rate=$(expr $now \* 100 / $full) + printf $1 "${st}:${rate}%" + fi +} +alias bat='battery-status %s\\n' + +battery-status2(){ + local dir=/sys/class/power_supply/BAT0 + . $dir/uevent + local rate=$(expr $POWER_SUPPLY_CHARGE_NOW \* 100 / $POWER_SUPPLY_CHARGE_FULL) + echo ${POWER_SUPPLY_STATUS}:${rate}% } From a69a8b2ffad2c4686c8d488882771d1b3c77c05f Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 11 Mar 2012 02:11:49 +0900 Subject: [PATCH 082/269] change to use ~/.batterystatus --- bashrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bashrc b/bashrc index 3105387..4ac39fc 100755 --- a/bashrc +++ b/bashrc @@ -302,7 +302,6 @@ __my_prompt_function(){ # used by PS1 local git= fi local date=$(/c/Windows/System32/cmd.exe //c 'echo %DATE%-%TIME%') - : else local pwd=$(echo "${PWD}/" | sed -e "s#${HOME}#~#") local oldpwd=$(echo "${OLDPWD}/" | sed -e "s#${HOME}#~#") @@ -311,7 +310,8 @@ __my_prompt_function(){ # used by PS1 local date=$(LANG=C __try_exec date +"%a, %d %b %Y %T %z") fi local svn=$(type svn >/dev/null 2>&1 && __try_exec __my_svn_ps1 [SVN:%s]) - # local battery=$(battery-status "[%s]" | sed -e 's"%"%%"g') # very slow + test -f ~/.batterystatus && local battery="[Battery:$(cat ~/.batterystatus | sed -e 's`%`%%`g')]" + # local battery=$(battery-state [%s] | sed -e 's`%`%%`g') # very slow printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}${battery}\n" printf "${c2}${USER}@${HOSTNAME}${cdef} ${date} ${BASH} ${BASH_VERSION}\n" printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " From 286b89366097e85961a3b3c1a790233e0f926f04 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 11 Mar 2012 03:09:43 +0900 Subject: [PATCH 083/269] add function ip-address --- bashrc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bashrc b/bashrc index 4ac39fc..cb28d21 100755 --- a/bashrc +++ b/bashrc @@ -311,8 +311,9 @@ __my_prompt_function(){ # used by PS1 fi local svn=$(type svn >/dev/null 2>&1 && __try_exec __my_svn_ps1 [SVN:%s]) test -f ~/.batterystatus && local battery="[Battery:$(cat ~/.batterystatus | sed -e 's`%`%%`g')]" + local ip=$(ip-address [Addr:%s]) # local battery=$(battery-state [%s] | sed -e 's`%`%%`g') # very slow - printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}${battery}\n" + printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}${battery}${ip}\n" printf "${c2}${USER}@${HOSTNAME}${cdef} ${date} ${BASH} ${BASH_VERSION}\n" printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " } @@ -397,3 +398,7 @@ battery-status2(){ echo ${POWER_SUPPLY_STATUS}:${rate}% } +ip-address(){ + local ip=$(LANG=C ifconfig | grep "inet " | grep -v "127.0.0.1" | awk '{print $2}') + test -n $ip && printf $1 $ip +} From 0579015031bd5d2f94555600db43f1a2f507f1e6 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 11 Mar 2012 16:50:46 +0900 Subject: [PATCH 084/269] screen go blank after 30 min --- bashrc | 7 ++++--- xinitrc | 2 ++ xprograms | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/bashrc b/bashrc index cb28d21..350f5e9 100755 --- a/bashrc +++ b/bashrc @@ -133,12 +133,13 @@ showinfo(){ __try_exec diskinfo - ! isdarwin && test -n "${DESKTOP_SESSION}" && type xrandr >/dev/null 2>&1 && { - xrandr | grep --color=never ^Screen + ! isdarwin && test -n "${DISPLAY}" && { + __try_exec xrandr | grep --color=never ^Screen } iswindows || __try_exec finger $USER LANG=C __try_exec id + __try_exec xset q } export __MYGITBAREREP="${HOME}/dbx/.git-bare" @@ -400,5 +401,5 @@ battery-status2(){ ip-address(){ local ip=$(LANG=C ifconfig | grep "inet " | grep -v "127.0.0.1" | awk '{print $2}') - test -n $ip && printf $1 $ip + test -n "$ip" && printf $1 $ip } diff --git a/xinitrc b/xinitrc index 9796e14..ec48f75 100644 --- a/xinitrc +++ b/xinitrc @@ -12,6 +12,8 @@ type synclient >/dev/null 2>&1 && { synclient MinSpeed=0.2 } +xset s 1800 # go blank after 30 min + unset LC_MESSAGES export LANG=ja_JP.utf8 diff --git a/xprograms b/xprograms index 8559952..454be90 100755 --- a/xprograms +++ b/xprograms @@ -12,11 +12,12 @@ tint2 & #dropboxd & # done by ~/.config/autostart/dropbox.desktop volumeicon & + #wicd-client --tray & # done by /etc/xdg/autostart/wicd-client.desktop + # Detection of insertion of an optical disk if ! pgrep -lf "udisks-daemon: polling /dev/sr0"; then udisks --poll-for-media /dev/sr0 fi - udisksvm >/dev/null & From dcfc9f8f534f144f597e8716aa7a8998cb54acf6 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 11 Mar 2012 17:19:30 +0900 Subject: [PATCH 085/269] terminal go blank when 3 min passes --- profile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/profile b/profile index 9819fba..86c953c 100755 --- a/profile +++ b/profile @@ -1,5 +1,4 @@ #!/bin/sh -env > $HOME/.env.txt # export PS1="\$ " export LANG=ja_JP.UTF-8 @@ -23,3 +22,7 @@ addtopath ${HOME}/bin test -f "${HOME}/.pythonrc" && export PYTHONSTARTUP="${HOME}/.pythonrc" export PYTHONPATH=~/.py +type setterm >/dev/null 2>&1 && setterm -blank 3 -powersave on # -powerdown 10 +# in my environment powerdown does not work + +env > $HOME/.env.txt From 2673f0e939a3fe4c6d40b5ee1dd15a5a08167fbf Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 11 Mar 2012 20:30:20 +0900 Subject: [PATCH 086/269] disable displaying svn status in PS1 --- bashrc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bashrc b/bashrc index 350f5e9..f95b3c8 100755 --- a/bashrc +++ b/bashrc @@ -273,8 +273,11 @@ __my_parse_svn_branch() { } __my_svn_ps1(){ - local svn_branch=$(__my_parse_svn_branch) - test -n "${svn_branch}" && printf "$1" "{$svn_branch}" + if svn status >/dev/null 2>&1 + then + local svn_branch=$(__my_parse_svn_branch) + test -n "${svn_branch}" && printf "$1" "{$svn_branch}" + fi } __my_prompt_function(){ # used by PS1 @@ -310,7 +313,7 @@ __my_prompt_function(){ # used by PS1 local git=$(__try_exec __git_ps1 [GIT:%s]) local date=$(LANG=C __try_exec date +"%a, %d %b %Y %T %z") fi - local svn=$(type svn >/dev/null 2>&1 && __try_exec __my_svn_ps1 [SVN:%s]) + # local svn=$(type svn >/dev/null 2>&1 && __try_exec __my_svn_ps1 [SVN:%s]) test -f ~/.batterystatus && local battery="[Battery:$(cat ~/.batterystatus | sed -e 's`%`%%`g')]" local ip=$(ip-address [Addr:%s]) # local battery=$(battery-state [%s] | sed -e 's`%`%%`g') # very slow From c5f8f7343d0e55be8c3c886c5ec2fd2b07638c57 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 12 Mar 2012 11:37:15 +0900 Subject: [PATCH 087/269] misc changes --- bashrc | 9 +++++---- profile | 9 ++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bashrc b/bashrc index f95b3c8..721509d 100755 --- a/bashrc +++ b/bashrc @@ -68,10 +68,10 @@ elif echo "$EMACS" | grep term >/dev/null 2>&1; then # for emacs term echo "Emacs Term" fi -if test -f /etc/issue -then - cat /etc/issue -fi +# if test -f /etc/issue +# then +# cat /etc/issue +# fi ################################### # some aliases and functions @@ -108,6 +108,7 @@ alias aptsearch="apt-cache search" alias aptshow="apt-cache show" alias yt=yaourt +null type pacman-color && alias pacman=pacman-color export PACMAN=pacman-color alias ubuntu-upgrade="sudo apt-get autoremove --yes && sudo apt-get update --yes && sudo apt-get upgrade --yes" diff --git a/profile b/profile index 86c953c..e7c860a 100755 --- a/profile +++ b/profile @@ -1,7 +1,7 @@ #!/bin/sh # export PS1="\$ " -export LANG=ja_JP.UTF-8 +export LANG=C # ja_JP.UTF-8 export LC_TIME=C export TERMCAP="${TERMCAP}:vb=" export HOSTNAME @@ -9,6 +9,8 @@ export BROWSER=firefox export ENV=~/.shrc # export TMP=/tmp # export TEMP=/tmp +test -f "${HOME}/.pythonrc" && export PYTHONSTARTUP="${HOME}/.pythonrc" +export PYTHONPATH=~/.py addtopath(){ for p in "$@" @@ -19,10 +21,7 @@ addtopath(){ # export PATH="${PATH}:${HOME}/bin" addtopath ${HOME}/bin -test -f "${HOME}/.pythonrc" && export PYTHONSTARTUP="${HOME}/.pythonrc" -export PYTHONPATH=~/.py - -type setterm >/dev/null 2>&1 && setterm -blank 3 -powersave on # -powerdown 10 +type setterm >/dev/null 2>&1 && setterm -blank 30 -powersave on # -powerdown 10 # in my environment powerdown does not work env > $HOME/.env.txt From c07a646e9b5706404226d8f4b017c5d2da094dec Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 13 Mar 2012 00:16:59 +0900 Subject: [PATCH 088/269] add tty display in prompt --- bashrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bashrc b/bashrc index 721509d..4547478 100755 --- a/bashrc +++ b/bashrc @@ -317,9 +317,10 @@ __my_prompt_function(){ # used by PS1 # local svn=$(type svn >/dev/null 2>&1 && __try_exec __my_svn_ps1 [SVN:%s]) test -f ~/.batterystatus && local battery="[Battery:$(cat ~/.batterystatus | sed -e 's`%`%%`g')]" local ip=$(ip-address [Addr:%s]) + local tty=$(__try_exec tty | sed -e 's:/dev/::') # local battery=$(battery-state [%s] | sed -e 's`%`%%`g') # very slow printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}${battery}${ip}\n" - printf "${c2}${USER}@${HOSTNAME}${cdef} ${date} ${BASH} ${BASH_VERSION}\n" + printf "${c2}${USER}@${HOSTNAME}${cdef} ${tty} ${date} ${BASH} ${BASH_VERSION}\n" printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " } From 22ee46031b64ef9244f5a8de76cf156ba88ab572 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 13 Mar 2012 01:22:22 +0900 Subject: [PATCH 089/269] add function x, modify document --- README.txt | 6 +++++- bashrc | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.txt b/README.txt index 5bca638..678cf35 100644 --- a/README.txt +++ b/README.txt @@ -8,5 +8,9 @@ ~/.xinitrc <= startx (~/.config/openbox/autostart also executed) | -`--~/.dotfiles/xinitrc +`--openbox-session + | + |--~/.dotfiles/xprofile + | + `--~/.dotfiles/xprograms diff --git a/bashrc b/bashrc index 4547478..d49b570 100755 --- a/bashrc +++ b/bashrc @@ -143,6 +143,14 @@ showinfo(){ __try_exec xset q } +x(){ + if [[ -z $DISPLAY ]] && ! [[ -e /tmp/.X11-unix/X0 ]] && (( EUID )); then + nohup startx >~/.xorg.log 2>&1 & + else + echo "X cant be started! Maybe another X is already started!" 1>&2 + fi +} + export __MYGITBAREREP="${HOME}/dbx/.git-bare" git-make-local-rep(){ test $# -eq 0 && { From e33a0f74d11eb89c4cf02106e82833344a3886e9 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 13 Mar 2012 01:26:58 +0900 Subject: [PATCH 090/269] fix some ENVs --- README.txt | 2 +- bashrc | 1 + profile | 3 +-- xinitrc | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.txt b/README.txt index 678cf35..afbcd80 100644 --- a/README.txt +++ b/README.txt @@ -6,7 +6,7 @@ | `--~/.dotfiles/bashrc -~/.xinitrc <= startx (~/.config/openbox/autostart also executed) +~/.xinitrc <= startx | `--openbox-session | diff --git a/bashrc b/bashrc index d49b570..c4fe1cb 100755 --- a/bashrc +++ b/bashrc @@ -83,6 +83,7 @@ alias ls="ls -hCFG $(test "$TERM" == dumb || echo --color=auto\ )--time-style=lo # alias less="" alias vl=/usr/share/vim/vimcurrent/macros/less.sh alias em="emacs -nw" +alias pstree="LANG=C pstree" # alias apt-get="sudo apt-get" alias ut="ssh 6365454829@un001.ecc.u-tokyo.ac.jp" alias rand="echo \$RANDOM" diff --git a/profile b/profile index e7c860a..e49d88c 100755 --- a/profile +++ b/profile @@ -1,11 +1,10 @@ #!/bin/sh # export PS1="\$ " -export LANG=C # ja_JP.UTF-8 +# export LANG=ja_JP.UTF-8 export LC_TIME=C export TERMCAP="${TERMCAP}:vb=" export HOSTNAME -export BROWSER=firefox export ENV=~/.shrc # export TMP=/tmp # export TEMP=/tmp diff --git a/xinitrc b/xinitrc index ec48f75..ffede58 100644 --- a/xinitrc +++ b/xinitrc @@ -16,4 +16,5 @@ xset s 1800 # go blank after 30 min unset LC_MESSAGES export LANG=ja_JP.utf8 +export BROWSER=firefox From e7bdd6c128fd6f5008445a4f22f6da42d9868dd1 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 13 Mar 2012 16:24:54 +0900 Subject: [PATCH 091/269] use mstranslator --- _keysnail.js | 39 ++++++++++++++------------------------- bashrc | 2 +- 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/_keysnail.js b/_keysnail.js index cda0ff2..7588e92 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -208,7 +208,8 @@ ext.add('auto-install-plugins', function(ev, arg){ 'https://raw.github.com/10sr/keysnail-plugin/master/shiitake.ks.js', 'https://raw.github.com/10sr/keysnail-plugin/master/dig-url.ks.js', 'https://raw.github.com/10sr/keysnail-plugin/master/instapaper.ks.js', - 'https://raw.github.com/gist/1976942/firefox-addon-manager.ks.js' + 'https://raw.github.com/gist/1976942/firefox-addon-manager.ks.js', + 'https://raw.github.com/gist/1450594/mstranslator.ks.js' ]; function inst(a){ @@ -271,6 +272,7 @@ ext.add("close-and-next-tab", function (ev, arg) { ///////////////////////////////////// // google itranslate +// use mstranslator instead (function(){ let targetLang = "ja"; // target lang to translate into let alternativeLang = "en"; // if given word is in targetLang, use this instead as a target lang @@ -532,11 +534,11 @@ key.suspendKey = "Not defined"; // ================================= Hooks ================================= // -hook.addToHook('KeySnailInitialized', function () { +hook.setHook('KeySnailInitialized', function () { ext.exec("shiitake-enable-style"); }); -hook.addToHook('KeyBoardQuit', function (aEvent) { +hook.setHook('KeyBoardQuit', function (aEvent) { ext.exec("hide-sidebar"); let(elem = document.commandDispatcher.focusedElement) elem && elem.blur(); gBrowser.focus(); @@ -562,16 +564,6 @@ hook.setHook('Unload', function () { }); }); -// hook.addToHook('LocationChange', function (aNsURI) { -// if(window.content.document.body){ -// display.prettyPrint(window.content.document.title); -// }else{ -// window.addEventListener("load", function(){ -// disp = display; -// disp.prettyPrint(window.content.document.title); -// }, false); -// } -// }); // ============================= Key bindings ============================== // @@ -673,10 +665,6 @@ key.setViewKey('z', function (ev, arg) { ext.exec("keysnail-setting-menu", arg, ev); }, 'open keysnail setting menu', true); -key.setViewKey('T', function (ev, arg) { - ext.exec("google-itranslate", arg, ev); -}, 'google itranslate', true); - key.setViewKey('C-SPC', function (ev, arg) { MultipleTabService.toggleSelection(gBrowser.selectedTab); }, 'タブの選択をトグル'); @@ -744,7 +732,8 @@ key.setViewKey([[''], ['']], function (ev, arg) { }, 'ignore'); key.setViewKey(':', function (ev, arg) { - return !document.getElementById("keysnail-prompt").hidden && document.getElementById("keysnail-prompt-textbox").focus(); + return !document.getElementById("keysnail-prompt").hidden && + document.getElementById("keysnail-prompt-textbox").focus(); }, 'KeySnail のプロンプトへフォーカス', true); key.setViewKey('H', function (ev, arg) { @@ -767,14 +756,14 @@ key.setViewKey('C-', function (ev, arg) { ext.exec("list-tab-history", arg, ev); }, 'List tab history', true); +key.setViewKey('I', function (ev, arg) { + ext.exec("instapaper-post-page-with-comment", arg, ev); +}, 'post page and comment', true); + key.setEditKey('C-', function (ev) { command.walkInputElement(command.elementsRetrieverTextarea, true, true); }, '次のテキストエリアへフォーカス'); -key.setViewKey('I', function (ev, arg) { - ext.exec('instapaper-post-page-with-comment', arg, ev); -}, 'post page and comment', true); - -key.setViewKey('C-', function (ev, arg) { - ext.exec('list-tab-history', arg, ev); -}, 'List tab history', true); +key.setViewKey('T', function (ev, arg) { + ext.exec('mstranslator-open-prompt', arg, ev); +}, 'MSTranslator - Open prompt', true); diff --git a/bashrc b/bashrc index c4fe1cb..f250bbc 100755 --- a/bashrc +++ b/bashrc @@ -148,7 +148,7 @@ x(){ if [[ -z $DISPLAY ]] && ! [[ -e /tmp/.X11-unix/X0 ]] && (( EUID )); then nohup startx >~/.xorg.log 2>&1 & else - echo "X cant be started! Maybe another X is already started!" 1>&2 + echo "X cant be started! Maybe another X is already running!" 1>&2 fi } From e0b84e94fecb4a2f03ffdcc7a26b7a20e191c3dd Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 14 Mar 2012 02:56:58 +0900 Subject: [PATCH 092/269] add conky config file --- bashrc | 2 +- conkyrc | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ conkyrc.2 | 39 +++++++++++++++++++++++++++++++++++++ profile | 2 +- xprograms | 3 +++ 5 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 conkyrc create mode 100644 conkyrc.2 diff --git a/bashrc b/bashrc index f250bbc..5138167 100755 --- a/bashrc +++ b/bashrc @@ -146,7 +146,7 @@ showinfo(){ x(){ if [[ -z $DISPLAY ]] && ! [[ -e /tmp/.X11-unix/X0 ]] && (( EUID )); then - nohup startx >~/.xorg.log 2>&1 & + nohup startx >~/.backup/log/xorg.log 2>&1 & else echo "X cant be started! Maybe another X is already running!" 1>&2 fi diff --git a/conkyrc b/conkyrc new file mode 100644 index 0000000..9c7e812 --- /dev/null +++ b/conkyrc @@ -0,0 +1,58 @@ +# ~/.conkyrc +# +double_buffer yes +background no + +use_xft yes +xftfont DejaVu Sans Mono:size=10 +xftalpha 0.8 + +update_interval 1.0 + +total_run_times 0 + +own_window yes +own_window_type override +own_window_transparent yes +own_window_colour hotpink +own_window_hints undecorated,below,skip_taskbar,sticky,skip_pager + +minimum_size 200 +draw_shades no +draw_outline no +draw_borders no +stippled_borders 0 +border_width 1 +default_color green # slategrey +default_shade_color lightgrey +default_outline_color black +alignment top_right +gap_x 20 +gap_y 50 +no_buffers yes +uppercase no +format_human_readable yes + +TEXT +${color white}${alignr}Arch Linux +${color white}${hr} +${color}host ${color black}:${color white} ${nodename} +${color}os ${color black}:${color white} ${sysname} ${kernel} +${color}freq ${color black}:${color white} ${freq 1}Mhz | ${freq 2}Mhz +${color}upt ${color black}:${color white} ${uptime} +#${color}btry ${color black}:${color white} ${battery} +#${color}btime${color black}:${color white} ${battery_time} +${color white}${hr} +${color}cpu ${color black}:${color white} ${cpu cpu0}% ${cpubar cpu0} +${color}ram ${color black}:${color white} ${memperc}% ${membar} +${color white}${stippled_hr} +${color}root ${color black}:${color white} ${fs_free /} ${fs_bar /} +${color}/tmp ${color black}:${color white} ${fs_free /tmp} ${fs_bar /tmp} +${color white}${stippled_hr} +${color}addr ${color black}:${color white} ${addr} +${color}down ${color black}:${color white} ${downspeed}/s +${color #888888}${downspeedgraph ff0000 0000ff} +${color}up ${color black}:${color white} ${upspeed}/s +${color #888888}${upspeedgraph 0000ff ff0000} +${color white}${hr} +#${color white}${alignr}${execi 900 cal -1} diff --git a/conkyrc.2 b/conkyrc.2 new file mode 100644 index 0000000..679691b --- /dev/null +++ b/conkyrc.2 @@ -0,0 +1,39 @@ +# ~/.conkyrc +# +double_buffer yes +background no + +use_xft yes +xftfont DejaVu Sans Mono:size=10 +xftalpha 0.8 + +update_interval 1.0 + +total_run_times 0 + +own_window yes +own_window_type override +own_window_transparent yes +own_window_colour hotpink +own_window_hints undecorated,below,skip_taskbar,sticky,skip_pager + +minimum_size 200 +draw_shades no +draw_outline no +draw_borders no +stippled_borders 0 +border_width 1 +default_color green # slategrey +default_shade_color lightgrey +default_outline_color black +alignment bottom_left +gap_x 20 +gap_y 20 +no_buffers yes +uppercase no +format_human_readable yes + +TEXT + +${color yellow}/var/log/dmesg.log: +${color white}${tail /var/log/dmesg.log 15} diff --git a/profile b/profile index e49d88c..251e76d 100755 --- a/profile +++ b/profile @@ -23,4 +23,4 @@ addtopath ${HOME}/bin type setterm >/dev/null 2>&1 && setterm -blank 30 -powersave on # -powerdown 10 # in my environment powerdown does not work -env > $HOME/.env.txt +mkdir -p ~/.backup/log diff --git a/xprograms b/xprograms index 454be90..8dc6556 100755 --- a/xprograms +++ b/xprograms @@ -13,6 +13,9 @@ tint2 & volumeicon & +conky -c ~/.dotfiles/conkyrc >~/.backup/log/conky.log 2>&1 & +conky -c ~/.dotfiles/conkyrc.2 >~/.backup/log/conky.2.log 2>&1 & + #wicd-client --tray & # done by /etc/xdg/autostart/wicd-client.desktop # Detection of insertion of an optical disk From e0a391551c3b11b2d54c1968a13f00afc735140c Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 14 Mar 2012 15:33:04 +0900 Subject: [PATCH 093/269] update conkyrc --- conkyrc | 60 ++++++++++++++++++++++++++++++++----------------------- conkyrc.2 | 5 +++-- emacs.el | 2 ++ 3 files changed, 40 insertions(+), 27 deletions(-) diff --git a/conkyrc b/conkyrc index 9c7e812..6334786 100644 --- a/conkyrc +++ b/conkyrc @@ -23,36 +23,46 @@ draw_outline no draw_borders no stippled_borders 0 border_width 1 -default_color green # slategrey -default_shade_color lightgrey -default_outline_color black alignment top_right gap_x 20 gap_y 50 + +default_color green # slategrey +default_shade_color lightgrey +default_outline_color black +color0 white +color1 black +color2 green + no_buffers yes uppercase no format_human_readable yes TEXT -${color white}${alignr}Arch Linux -${color white}${hr} -${color}host ${color black}:${color white} ${nodename} -${color}os ${color black}:${color white} ${sysname} ${kernel} -${color}freq ${color black}:${color white} ${freq 1}Mhz | ${freq 2}Mhz -${color}upt ${color black}:${color white} ${uptime} -#${color}btry ${color black}:${color white} ${battery} -#${color}btime${color black}:${color white} ${battery_time} -${color white}${hr} -${color}cpu ${color black}:${color white} ${cpu cpu0}% ${cpubar cpu0} -${color}ram ${color black}:${color white} ${memperc}% ${membar} -${color white}${stippled_hr} -${color}root ${color black}:${color white} ${fs_free /} ${fs_bar /} -${color}/tmp ${color black}:${color white} ${fs_free /tmp} ${fs_bar /tmp} -${color white}${stippled_hr} -${color}addr ${color black}:${color white} ${addr} -${color}down ${color black}:${color white} ${downspeed}/s -${color #888888}${downspeedgraph ff0000 0000ff} -${color}up ${color black}:${color white} ${upspeed}/s -${color #888888}${upspeedgraph 0000ff ff0000} -${color white}${hr} -#${color white}${alignr}${execi 900 cal -1} +${color0}${alignr}${conky_build_arch} +${color0}${alignr}${execi 30000 whoami}@${nodename} +${color0}${hr} +#${color2}host ${color1}:${color0} ${nodename} +${color2}uptm ${color1}:${color0} ${uptime} +${color2}lgin ${color1}:${color0} ${uptime} +#${color2}os ${color1}:${color0} ${sysname} ${kernel} +${color0}${stippled_hr} +${color2}freq ${color1}:${color0} ${freq 1}Mhz | ${freq 2}Mhz +${color2}cpu ${color1}:${color0} ${cpu cpu0}% ${cpubar cpu0} +#${color2}btry ${color1}:${color0} ${battery} +#${color2}btime${color1}:${color0} ${battery_time} +${color0}${hr} +${color2}ram ${color1}:${color0} ${memperc}% ${membar} +${color2}swap ${color1}:${color0} None +${color0}${stippled_hr} +${color2}root ${color1}:${color0} ${fs_free /} ${fs_bar /} +${color2}/tmp ${color1}:${color0} ${fs_free /tmp} ${fs_bar /tmp} +${color0}${hr} +${color2}addr ${color1}:${color0} ${addr} +${color0}${stippled_hr} +${color2}down ${color1}:${color0} ${downspeed eth0}/s +${color #888888}${downspeedgraph eth0 ff0000 0000ff} +${color2}up ${color1}:${color0} ${upspeed eth0}/s +${color #888888}${upspeedgraph eth0 0000ff ff0000} +${color0}${hr} +#${color0}${alignr}${execi 900 cal -1} diff --git a/conkyrc.2 b/conkyrc.2 index 679691b..c0d4251 100644 --- a/conkyrc.2 +++ b/conkyrc.2 @@ -35,5 +35,6 @@ format_human_readable yes TEXT -${color yellow}/var/log/dmesg.log: -${color white}${tail /var/log/dmesg.log 15} +${color yellow}$$ tail -f /var/log/everything.log +${color white}${tail /var/log/everything.log 30} +${time %b %d %T} diff --git a/emacs.el b/emacs.el index 5244b96..85ceb86 100644 --- a/emacs.el +++ b/emacs.el @@ -769,6 +769,8 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." 'my-frame-buffer-add) (add-hook 'eshell-mode-hook 'my-frame-buffer-add) +(add-hook 'Man-mode-hook + 'my-frame-buffer-add) (add-hook 'kill-buffer-hook 'my-frame-buffer-remove) From 3510a3f30b13ddc1ebf11632cdcae6c600d40622 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 15 Mar 2012 11:43:30 +0900 Subject: [PATCH 094/269] small fix --- conkyrc.2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conkyrc.2 b/conkyrc.2 index c0d4251..f88b945 100644 --- a/conkyrc.2 +++ b/conkyrc.2 @@ -18,6 +18,7 @@ own_window_colour hotpink own_window_hints undecorated,below,skip_taskbar,sticky,skip_pager minimum_size 200 +#maximum_width 1000 draw_shades no draw_outline no draw_borders no @@ -36,5 +37,5 @@ format_human_readable yes TEXT ${color yellow}$$ tail -f /var/log/everything.log -${color white}${tail /var/log/everything.log 30} +${color white}${tail /var/log/everything.log 15} ${time %b %d %T} From b9c7c50811f04af177e8e7930cc08488e357cab6 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 15 Mar 2012 19:07:06 +0900 Subject: [PATCH 095/269] misc tweaks --- bashrc | 117 +++++++++++++++++++++++++++++++------------------------ emacs.el | 6 +-- 2 files changed, 68 insertions(+), 55 deletions(-) diff --git a/bashrc b/bashrc index 5138167..e08381d 100755 --- a/bashrc +++ b/bashrc @@ -5,14 +5,15 @@ alias ismsys=false alias iscygwin=false -alias isdarwin=false alias iswindows="iscygwin || ismsys" -alias islinux="! iswindows && ! isdarwin" # i havent used unix yet +alias isdarwin=false +alias islinux=false case `uname` in (MINGW32*) alias ismsys=true ;; (CYGWIN*) alias iscygwin=true ;; (Darwin*) alias isdarwin=true ;; + (Linux*) alias islinux=true ;; esac ########################################## @@ -25,14 +26,14 @@ __try_exec(){ export PS1="\$(__my_prompt_function)\$ " # PROMPT_COMMAND=prompt_function -if false # iswindows +if false iswindows then export PAGER='tr -d \\r | less' else export PAGER="less" fi -if null type vim +if false null type vim then export EDITOR=vim else @@ -76,7 +77,7 @@ fi ################################### # some aliases and functions -alias ls="ls -hCFG $(test "$TERM" == dumb || echo --color=auto\ )--time-style=long-iso" +alias ls="ls -hCF $(test "$TERM" == dumb || echo --color=auto\ )--time-style=long-iso" # alias ll="ls -l" # alias la="ls -A" # alias lla="ls -Al" @@ -109,8 +110,15 @@ alias aptsearch="apt-cache search" alias aptshow="apt-cache show" alias yt=yaourt -null type pacman-color && alias pacman=pacman-color -export PACMAN=pacman-color +null type pacman-color && { + alias pacman=pacman-color + export pacman_program=pacman-color # used by pacmatic + export PACMAN=pacman-color # used by yaourt +} +null type pacmatic && { + alias pacman=pacmatic + export PACMAN=pacmatic +} alias ubuntu-upgrade="sudo apt-get autoremove --yes && sudo apt-get update --yes && sudo apt-get upgrade --yes" alias arch-upgrade="yaourt -Syu" @@ -182,7 +190,7 @@ bak(){ done } di(){ - if null type colordiff && test $TERM != dumb + if type colordiff >/dev/null 2>&1 && test $TERM != dumb then local diffcmd=colordiff else @@ -240,6 +248,9 @@ o(){ elif isdarwin then open "$f" + elif type pcmanfm >/dev/null 2>&1 + then + pcmanfm "$f" else xdg-open "$f" fi @@ -290,49 +301,6 @@ __my_svn_ps1(){ fi } -__my_prompt_function(){ # used by PS1 - local lastreturn=$? - if test "${TERM}" == dumb - then - local c1= - local c2= - local c3= - local cdef= - else - local c1="\e[33m" - local c2="\e[36m" - local c3="\e[37m" - local cdef="\e[0m" - fi - if iswindows - then - local pwd=$PWD - local oldpwd=$OLDPWD - local jobnum= - if git branch >/dev/null 2>&1 - then - local git="[GIT]" - else - local git= - fi - local date=$(/c/Windows/System32/cmd.exe //c 'echo %DATE%-%TIME%') - else - local pwd=$(echo "${PWD}/" | sed -e "s#${HOME}#~#") - local oldpwd=$(echo "${OLDPWD}/" | sed -e "s#${HOME}#~#") - local jobnum=$(jobs | wc -l) - local git=$(__try_exec __git_ps1 [GIT:%s]) - local date=$(LANG=C __try_exec date +"%a, %d %b %Y %T %z") - fi - # local svn=$(type svn >/dev/null 2>&1 && __try_exec __my_svn_ps1 [SVN:%s]) - test -f ~/.batterystatus && local battery="[Battery:$(cat ~/.batterystatus | sed -e 's`%`%%`g')]" - local ip=$(ip-address [Addr:%s]) - local tty=$(__try_exec tty | sed -e 's:/dev/::') - # local battery=$(battery-state [%s] | sed -e 's`%`%%`g') # very slow - printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}${battery}${ip}\n" - printf "${c2}${USER}@${HOSTNAME}${cdef} ${tty} ${date} ${BASH} ${BASH_VERSION}\n" - printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " -} - #Change ANSI Colors _chengecolors(){ echo -e \ @@ -417,3 +385,50 @@ ip-address(){ local ip=$(LANG=C ifconfig | grep "inet " | grep -v "127.0.0.1" | awk '{print $2}') test -n "$ip" && printf $1 $ip } + +__my_prompt_function(){ # used by PS1 + local lastreturn=$? + if test "${TERM}" == dumb + then + local c1= + local c2= + local c3= + local cdef= + else + local c1="\e[33m" + local c2="\e[36m" + local c3="\e[37m" + local cdef="\e[0m" + fi + if iswindows + then + local pwd=$PWD + local oldpwd=$OLDPWD + local jobnum= + if git branch >/dev/null 2>&1 + then + local git="[GIT]" + else + local git= + fi + local date=$(/c/Windows/System32/cmd.exe //c 'echo %DATE%-%TIME%') + else + local pwd=$(echo "${PWD}/" | sed -e "s#${HOME}#~#") + local oldpwd=$(echo "${OLDPWD}/" | sed -e "s#${HOME}#~#") + local jobnum=$(jobs | wc -l) + local git=$(__try_exec __git_ps1 [GIT:%s]) + local date=$(LANG=C __try_exec date +"%a, %d %b %Y %T %z") + fi + # local svn=$(type svn >/dev/null 2>&1 && __try_exec __my_svn_ps1 [SVN:%s]) + if test -z "$DISPLAY" + then + local ip=$(ip-address [Addr:%s]) + test -f ~/.batterystatus && local battery="[Battery:$(cat ~/.batterystatus | sed -e 's`%`%%`g')]" + fi + local tty=$(__try_exec tty | sed -e 's:/dev/::') + # local battery=$(battery-state [%s] | sed -e 's`%`%%`g') # very slow + printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}${battery}${ip}\n" + printf "${c2}${USER}@${HOSTNAME}${cdef} ${tty} ${date} ${BASH} ${BASH_VERSION}\n" + printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " +} + diff --git a/emacs.el b/emacs.el index 85ceb86..f4bde22 100644 --- a/emacs.el +++ b/emacs.el @@ -1650,12 +1650,10 @@ when SEC is nil, stop auto save if enabled." (call-process "cmd.exe" nil 0 nil "/c" "start" "" (convert-standard-filename file))) ((eq system-type 'darwin) (call-process "open" nil 0 nil file)) - ((not (getenv "DESKTOP_SESSION")) + ((not (getenv "DISPLAY")) (find-file file)) (t - (if (file-directory-p file) - (call-process my-filer nil 0 nil file) - (call-process "xdg-open" nil 0 nil file)))) + (call-process (or my-filer "xdg-open") nil 0 nil file))) (recentf-add-file file) (message "Opening %s...done" file)) From 0f2d121a27cd98c5b677e2e92f7ce2afd3de3dea Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 16 Mar 2012 16:48:31 +0900 Subject: [PATCH 096/269] add xset dpms settings --- xinitrc | 1 + 1 file changed, 1 insertion(+) diff --git a/xinitrc b/xinitrc index ffede58..6d91ea3 100644 --- a/xinitrc +++ b/xinitrc @@ -13,6 +13,7 @@ type synclient >/dev/null 2>&1 && { } xset s 1800 # go blank after 30 min +xset dpms 1810 1820 1830 # standby, suspend and off seem to be not different for my environment unset LC_MESSAGES export LANG=ja_JP.utf8 From dc1d85c32093c46c34003efded43e19438b5ab66 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 16 Mar 2012 17:59:29 +0900 Subject: [PATCH 097/269] update battery display --- bashrc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/bashrc b/bashrc index e08381d..4195a8d 100755 --- a/bashrc +++ b/bashrc @@ -369,7 +369,7 @@ battery-status(){ local full=$(cat $dir/charge_full) local now=$(cat $dir/charge_now) local rate=$(expr $now \* 100 / $full) - printf $1 "${st}:${rate}%" + printf "$1" "${st}:${rate}%" fi } alias bat='battery-status %s\\n' @@ -404,13 +404,7 @@ __my_prompt_function(){ # used by PS1 then local pwd=$PWD local oldpwd=$OLDPWD - local jobnum= - if git branch >/dev/null 2>&1 - then - local git="[GIT]" - else - local git= - fi + git branch >/dev/null 2>&1 && local git="[GIT]" local date=$(/c/Windows/System32/cmd.exe //c 'echo %DATE%-%TIME%') else local pwd=$(echo "${PWD}/" | sed -e "s#${HOME}#~#") @@ -423,12 +417,14 @@ __my_prompt_function(){ # used by PS1 if test -z "$DISPLAY" then local ip=$(ip-address [Addr:%s]) - test -f ~/.batterystatus && local battery="[Battery:$(cat ~/.batterystatus | sed -e 's`%`%%`g')]" + test -f /tmp/batterystatus && local battery="[Battery:$(sed -e 's`%`%%`g' /tmp/batterystatus)]" + battery-status %s >/tmp/batterystatus & fi local tty=$(__try_exec tty | sed -e 's:/dev/::') # local battery=$(battery-state [%s] | sed -e 's`%`%%`g') # very slow printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}${battery}${ip}\n" printf "${c2}${USER}@${HOSTNAME}${cdef} ${tty} ${date} ${BASH} ${BASH_VERSION}\n" printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " + } From f1d8fb869ee1d0e18162583399199298d9815b26 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 18 Mar 2012 00:22:47 +0900 Subject: [PATCH 098/269] misc changes --- emacs.el | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/emacs.el b/emacs.el index f4bde22..10a2824 100644 --- a/emacs.el +++ b/emacs.el @@ -500,7 +500,7 @@ (defun dllib-if-unfound (lib url &optional bite-compile-p force-download-p) ; new version "if LIB does not exist, download it from URL and locate it to \"~/emacs.d/lisp/LIB.el\". return nil if LIB unfound and downloading failed, otherwise the path of LIB." - (let* ((dir (expand-file-name "~/.emacs.d/lisp/")) + (let* ((dir (expand-file-name (concat user-emacs-directory "lisp/"))) (lpath (concat dir lib ".el")) (locate-p (locate-library lib))) (if (or force-download-p (not locate-p)) @@ -511,7 +511,9 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." t) (when bite-compile-p (byte-compile-file lpath))) - (error (message "downloading %s...something wrong happened!" url) + (error (and (file-readable-p lpath) + (delete-file lpath)) + (message "downloading %s...something wrong happened!" url) nil)) (locate-library lib)) locate-p))) @@ -525,6 +527,10 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (require 'simple nil t) +(and window-system + (dllib-if-unfound "save-window-size" "https://raw.github.com/10sr/emacs-lisp/master/save-window-size.el" t) + (require 'save-window-size nil t)) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; share clipboard with x (when (and window-system @@ -1845,6 +1851,11 @@ this is test, does not rename files" (when (>= emacs-major-version 23) (setq anthy-accept-timeout 1))) +;; quail +;; aproposs input-method for some information +(setq default-input-method "japanese") + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; windows用設定 From 506c19148723201fa30debbdc0fdec2602191e5d Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 18 Mar 2012 00:23:40 +0900 Subject: [PATCH 099/269] modify conkyrc --- conkyrc | 23 ++++++++++++++--------- conkyrc.2 | 5 ++--- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/conkyrc b/conkyrc index 6334786..3b641a7 100644 --- a/conkyrc +++ b/conkyrc @@ -48,21 +48,26 @@ ${color2}lgin ${color1}:${color0} ${uptime} #${color2}os ${color1}:${color0} ${sysname} ${kernel} ${color0}${stippled_hr} ${color2}freq ${color1}:${color0} ${freq 1}Mhz | ${freq 2}Mhz -${color2}cpu ${color1}:${color0} ${cpu cpu0}% ${cpubar cpu0} +${color2}cpu ${color1}:${color0} ${cpu}% ${cpubar} #${color2}btry ${color1}:${color0} ${battery} #${color2}btime${color1}:${color0} ${battery_time} ${color0}${hr} ${color2}ram ${color1}:${color0} ${memperc}% ${membar} -${color2}swap ${color1}:${color0} None +${color2}swap ${color1}:${color0} ${if_match ${swapmax} == 0}None${else}${swapperc} ${swapbar}${endif} ${color0}${stippled_hr} -${color2}root ${color1}:${color0} ${fs_free /} ${fs_bar /} -${color2}/tmp ${color1}:${color0} ${fs_free /tmp} ${fs_bar /tmp} +${color2}root ${color1}:${color0} ${fs_used /} #/${fs_size /} +${fs_bar /} +${color2}/tmp ${color1}:${color0} ${fs_used /tmp} #/${fs_size /tmp} +${fs_bar /tmp} +${color2}dio ${color1}:${color0} ${diskio} ${color0}${hr} -${color2}addr ${color1}:${color0} ${addr} +${color2}${gw_iface} ${color1}:${color0} ${addr} +${color2}ssid ${color1}:${color0} ${wireless_essid} ${color0}${stippled_hr} -${color2}down ${color1}:${color0} ${downspeed eth0}/s -${color #888888}${downspeedgraph eth0 ff0000 0000ff} -${color2}up ${color1}:${color0} ${upspeed eth0}/s -${color #888888}${upspeedgraph eth0 0000ff ff0000} +${color2}down ${color1}:${color0} ${downspeed}/s +${color #888888}${downspeedgraph ff0000 0000ff} +${color2}up ${color1}:${color0} ${upspeed}/s +${color #888888}${upspeedgraph 0000ff ff0000} ${color0}${hr} +${alignr}conky ${conky_version} on ${desktop_name} #${color0}${alignr}${execi 900 cal -1} diff --git a/conkyrc.2 b/conkyrc.2 index f88b945..ad04bef 100644 --- a/conkyrc.2 +++ b/conkyrc.2 @@ -35,7 +35,6 @@ uppercase no format_human_readable yes TEXT - -${color yellow}$$ tail -f /var/log/everything.log -${color white}${tail /var/log/everything.log 15} +${color yellow}$$ tail -f -n 12 /var/log/everything.log +${color white}${tail /var/log/everything.log 12} ${time %b %d %T} From e726d79109c422c07bf2a0c2619bafa27e6d2809 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 18 Mar 2012 17:40:44 +0900 Subject: [PATCH 100/269] add func _install_script --- bashrc | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/bashrc b/bashrc index 4195a8d..3634652 100755 --- a/bashrc +++ b/bashrc @@ -324,27 +324,38 @@ _chengecolors(){ # printf "\e]P7353535" \ -_echocolors(){ +_colors(){ echo -e \ - "\e[30mBlack\n" \ - "\e[31mRed\n" \ - "\e[32mGreen\n" \ - "\e[33mYellow\n" \ - "\e[34mBlue\n" \ - "\e[35mMagenta\n" \ - "\e[36mCyan\n" \ - "\e[37mWhite\n" \ - "\e[30;1mBright Black\n" \ - "\e[31;1mBright Red\n" \ - "\e[32;1mBright Green\n" \ - "\e[33;1mBright Yellow\n" \ - "\e[34;1mBright Blue\n" \ - "\e[35;1mBright Magenta\n" \ - "\e[36;1mBright Cyan\n" \ + "\e[30mBlack" \ + "\e[31mRed" \ + "\e[32mGreen" \ + "\e[33mYellow" \ + "\e[34mBlue" \ + "\e[35mMagenta" \ + "\e[36mCyan" \ + "\e[37mWhite" + echo -e \ + "\e[30;1mBright Black" \ + "\e[31;1mBright Red" \ + "\e[32;1mBright Green" \ + "\e[33;1mBright Yellow" \ + "\e[34;1mBright Blue" \ + "\e[35;1mBright Magenta" \ + "\e[36;1mBright Cyan" \ "\e[37;1mBright White\n" \ "\e[0m" } -# http://myminios.googlecode.com/svn-history/r10/trunk/colortable16.sh +# http://www.frexx.de/xterm-256-notes/data/colortable16.sh + +_install_script(){ + mkdir -p $HOMO/bin/ + for f in "$@" + do + bn=$(basename "$f") + type ${bn} >/dev/null 2>&1 || wget "$f" -P "$HOME/bin/" + chmod u+x "$HOME/bin/${bn}" + done +} winln(){ # for windose make link (actually junction) From 0c35817e51af4f51f3681a4f70568b9e3bec4104 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 18 Mar 2012 17:40:58 +0900 Subject: [PATCH 101/269] add cache dir pref --- _keysnail.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/_keysnail.js b/_keysnail.js index 7588e92..808642b 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -158,6 +158,14 @@ plugins.options["twitter_client.use_jmp"] = true; //////////////////////////////////////////// // エクステ +ext.add("my-setpref2", function(){ + util.setPrefs( + { + "browser.cache.disk.parent_directory":"/tmp" + } + ); +}, "my setpref2"); + ext.add('my-setpref', function(){ util.setPrefs( { From 6f37c8640dea2fbb9d3e9a1301df493028f41e1d Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 18 Mar 2012 17:41:08 +0900 Subject: [PATCH 102/269] modify conkyrc --- conkyrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conkyrc b/conkyrc index 3b641a7..82f12f5 100644 --- a/conkyrc +++ b/conkyrc @@ -25,7 +25,7 @@ stippled_borders 0 border_width 1 alignment top_right gap_x 20 -gap_y 50 +gap_y 40 default_color green # slategrey default_shade_color lightgrey @@ -47,8 +47,8 @@ ${color2}uptm ${color1}:${color0} ${uptime} ${color2}lgin ${color1}:${color0} ${uptime} #${color2}os ${color1}:${color0} ${sysname} ${kernel} ${color0}${stippled_hr} -${color2}freq ${color1}:${color0} ${freq 1}Mhz | ${freq 2}Mhz ${color2}cpu ${color1}:${color0} ${cpu}% ${cpubar} +${color2}freq ${color1}:${color0} ${freq 1}Mhz | ${freq 2}Mhz #${color2}btry ${color1}:${color0} ${battery} #${color2}btime${color1}:${color0} ${battery_time} ${color0}${hr} @@ -69,5 +69,5 @@ ${color #888888}${downspeedgraph ff0000 0000ff} ${color2}up ${color1}:${color0} ${upspeed}/s ${color #888888}${upspeedgraph 0000ff ff0000} ${color0}${hr} -${alignr}conky ${conky_version} on ${desktop_name} +${alignr}conky ${conky_version} on Page${desktop} #${color0}${alignr}${execi 900 cal -1} From 2332f2b50a386b01ecf68c2f3bd13d161f829705 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 18 Mar 2012 21:35:57 +0900 Subject: [PATCH 103/269] fix swap display --- conkyrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conkyrc b/conkyrc index 82f12f5..42f0695 100644 --- a/conkyrc +++ b/conkyrc @@ -53,7 +53,7 @@ ${color2}freq ${color1}:${color0} ${freq 1}Mhz | ${freq 2}Mhz #${color2}btime${color1}:${color0} ${battery_time} ${color0}${hr} ${color2}ram ${color1}:${color0} ${memperc}% ${membar} -${color2}swap ${color1}:${color0} ${if_match ${swapmax} == 0}None${else}${swapperc} ${swapbar}${endif} +${color2}swap ${color1}:${color0} ${if_match "${swapperc}" == "No swap"}None${else}${swapperc} ${swapbar}${endif} ${color0}${stippled_hr} ${color2}root ${color1}:${color0} ${fs_used /} #/${fs_size /} ${fs_bar /} From 3ee0e58067c749413b99efb1a46d8ba10225d1e3 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 18 Mar 2012 22:11:45 +0900 Subject: [PATCH 104/269] fix some settings --- bashrc | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/bashrc b/bashrc index 3634652..115e327 100755 --- a/bashrc +++ b/bashrc @@ -39,10 +39,9 @@ then else export EDITOR=vi fi -export VISUAL="$EDITOR" -export LESS="-iRMX" export LC_MESSAGES=C export CDPATH=".:~" +export VISUAL="$EDITOR" export GIT_PAGER="$PAGER" export GIT_EDITOR="$EDITOR" @@ -77,7 +76,11 @@ fi ################################### # some aliases and functions -alias ls="ls -hCF $(test "$TERM" == dumb || echo --color=auto\ )--time-style=long-iso" +test "$TERM" == dumb || _ENABLECOLOR="--color=always " + +export LESS="-iRMX" +export GREP_OPTIONS="${_ENABLECOLOR}" +alias ls="ls -hCF ${_ENABLECOLOR}--time-style=long-iso" # alias ll="ls -l" # alias la="ls -A" # alias lla="ls -Al" @@ -439,3 +442,43 @@ __my_prompt_function(){ # used by PS1 } +# from https://wiki.archlinux.org/index.php/X_resources +invader(){ + # ANSI color scheme script featuring Space Invaders + # + # Original: http://crunchbanglinux.org/forums/post/126921/#p126921 + # Modified by lolilolicon + # + + f=3 b=4 + for j in f b; do + for i in {0..7}; do + printf -v $j$i %b "\e[${!j}${i}m" + done + done + bld=$'\e[1m' + rst=$'\e[0m' + + cat << EOF + + $f1 ▀▄ ▄▀ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4 ▀▄ ▄▀ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst + $f1 ▄█▀███▀█▄ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4 ▄█▀███▀█▄ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst + $f1█▀███████▀█ $f2▀▀███▀▀███▀▀ $f3▀█▀██▀█▀ $f4█▀███████▀█ $f5▀▀███▀▀███▀▀ $f6▀█▀██▀█▀$rst + $f1▀ ▀▄▄ ▄▄▀ ▀ $f2 ▀█▄ ▀▀ ▄█▀ $f3▀▄ ▄▀ $f4▀ ▀▄▄ ▄▄▀ ▀ $f5 ▀█▄ ▀▀ ▄█▀ $f6▀▄ ▄▀$rst + + $bld$f1▄ ▀▄ ▄▀ ▄ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4▄ ▀▄ ▄▀ ▄ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst + $bld$f1█▄█▀███▀█▄█ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4█▄█▀███▀█▄█ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst + $bld$f1▀█████████▀ $f2▀▀▀██▀▀██▀▀▀ $f3▀▀█▀▀█▀▀ $f4▀█████████▀ $f5▀▀▀██▀▀██▀▀▀ $f6▀▀█▀▀█▀▀$rst + $bld$f1 ▄▀ ▀▄ $f2▄▄▀▀ ▀▀ ▀▀▄▄ $f3▄▀▄▀▀▄▀▄ $f4 ▄▀ ▀▄ $f5▄▄▀▀ ▀▀ ▀▀▄▄ $f6▄▀▄▀▀▄▀▄$rst + + + $f7▌$rst + + $f7▌$rst + + $f7 ▄█▄ $rst + $f7▄█████████▄$rst + $f7▀▀▀▀▀▀▀▀▀▀▀$rst + +EOF +} From 21c2337ae749086e49e829bda16987b606bb0568 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 18 Mar 2012 22:11:58 +0900 Subject: [PATCH 105/269] fix xclip prefs --- emacs.el | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs.el b/emacs.el index 10a2824..baabd13 100644 --- a/emacs.el +++ b/emacs.el @@ -546,6 +546,7 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ;; http://garin.jp/doc/Linux/xwindow_clipboard (and (not x-select-enable-clipboard) + (getenv "DISPLAY") (executable-find "xclip") (dllib-if-unfound "xclip" "http://www.emacswiki.org/emacs/download/xclip.el" t) (require 'xclip nil t) From dd62e21913a71c2221e562439781e5aec665779d Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 19 Mar 2012 17:39:24 +0900 Subject: [PATCH 106/269] update conkyrc --- conkyrc | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/conkyrc b/conkyrc index 42f0695..42cb041 100644 --- a/conkyrc +++ b/conkyrc @@ -31,7 +31,7 @@ default_color green # slategrey default_shade_color lightgrey default_outline_color black color0 white -color1 black +color1 white color2 green no_buffers yes @@ -42,31 +42,31 @@ TEXT ${color0}${alignr}${conky_build_arch} ${color0}${alignr}${execi 30000 whoami}@${nodename} ${color0}${hr} -#${color2}host ${color1}:${color0} ${nodename} -${color2}uptm ${color1}:${color0} ${uptime} -${color2}lgin ${color1}:${color0} ${uptime} -#${color2}os ${color1}:${color0} ${sysname} ${kernel} +#${color2}host ${color1}|${color0} ${nodename} +${color2}uptm ${color1}|${color0} ${uptime} +${color2}lgin ${color1}|${color0} ${uptime} +#${color2}os ${color1}|${color0} ${sysname} ${kernel} ${color0}${stippled_hr} -${color2}cpu ${color1}:${color0} ${cpu}% ${cpubar} -${color2}freq ${color1}:${color0} ${freq 1}Mhz | ${freq 2}Mhz -#${color2}btry ${color1}:${color0} ${battery} -#${color2}btime${color1}:${color0} ${battery_time} +${color2}cpu ${color1}|${color0} ${cpu}% ${cpubar} +${color2}freq ${color1}|${color0} ${freq 1}Mhz | ${freq 2}Mhz +#${color2}btry ${color1}|${color0} ${battery} +#${color2}btime${color1}|${color0} ${battery_time} ${color0}${hr} -${color2}ram ${color1}:${color0} ${memperc}% ${membar} -${color2}swap ${color1}:${color0} ${if_match "${swapperc}" == "No swap"}None${else}${swapperc} ${swapbar}${endif} +${color2}ram ${color1}|${color0} ${memperc}% ${membar} +${color2}swap ${color1}|${color0} ${if_match "${swapperc}" == "No swap"}None${else}${swapperc} ${swapbar}${endif} ${color0}${stippled_hr} -${color2}root ${color1}:${color0} ${fs_used /} #/${fs_size /} +${color2}root ${color1}|${color0} ${fs_used /} #/${fs_size /} ${fs_bar /} -${color2}/tmp ${color1}:${color0} ${fs_used /tmp} #/${fs_size /tmp} +${color2}/tmp ${color1}|${color0} ${fs_used /tmp} #/${fs_size /tmp} ${fs_bar /tmp} -${color2}dio ${color1}:${color0} ${diskio} +${color2}dio ${color1}|${color0} ${diskio} ${color0}${hr} -${color2}${gw_iface} ${color1}:${color0} ${addr} -${color2}ssid ${color1}:${color0} ${wireless_essid} +${color2}${gw_iface} ${color1}|${color0} ${addr} +${color2}ssid ${color1}|${color0} ${wireless_essid} ${color0}${stippled_hr} -${color2}down ${color1}:${color0} ${downspeed}/s +${color2}down ${color1}|${color0} ${downspeed}/s ${color #888888}${downspeedgraph ff0000 0000ff} -${color2}up ${color1}:${color0} ${upspeed}/s +${color2}up ${color1}|${color0} ${upspeed}/s ${color #888888}${upspeedgraph 0000ff ff0000} ${color0}${hr} ${alignr}conky ${conky_version} on Page${desktop} From d64acfb11e34dd1b9ec4512156f6fe095859f138 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 19 Mar 2012 17:39:39 +0900 Subject: [PATCH 107/269] update o function --- bashrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bashrc b/bashrc index 115e327..7d0803d 100755 --- a/bashrc +++ b/bashrc @@ -253,9 +253,9 @@ o(){ open "$f" elif type pcmanfm >/dev/null 2>&1 then - pcmanfm "$f" + LC_MESSAGES= pcmanfm "$f" else - xdg-open "$f" + LC_MESSAGES= xdg-open "$f" fi } convmv-sjis2utf8-test(){ From 8da6c5fd1d41ad919752ed62ea94e657066951d6 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 19 Mar 2012 17:39:47 +0900 Subject: [PATCH 108/269] misc changes --- _keysnail.js | 1 + emacs.el | 2 ++ 2 files changed, 3 insertions(+) diff --git a/_keysnail.js b/_keysnail.js index 808642b..542fb3d 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -159,6 +159,7 @@ plugins.options["twitter_client.use_jmp"] = true; // エクステ ext.add("my-setpref2", function(){ + // navigator.platform util.setPrefs( { "browser.cache.disk.parent_directory":"/tmp" diff --git a/emacs.el b/emacs.el index baabd13..af9515e 100644 --- a/emacs.el +++ b/emacs.el @@ -1604,6 +1604,8 @@ when SEC is nil, stop auto save if enabled." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; misc funcs +(defalias 'qcalc 'quick-calc) + ;; (when (require 'ansi-color nil t) ;; (ansi-color-for-comint-mode-on)) (defvar git-command-history nil From 3fe141f444c117a67adcab6591f374a5a9fee1b1 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 19 Mar 2012 19:56:54 +0900 Subject: [PATCH 109/269] fortune --- bashrc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bashrc b/bashrc index 7d0803d..ab5ba26 100755 --- a/bashrc +++ b/bashrc @@ -62,6 +62,15 @@ fi uname -a +null type fortune && { + echo + fortune + echo + fortune -o + echo +} + + if [ "${EMACS}" = "t" ]; then # for emacs shell true export PS1="\u@\H \d \t \w\nemacs shell\$ " elif echo "$EMACS" | grep term >/dev/null 2>&1; then # for emacs term @@ -401,6 +410,7 @@ ip-address(){ } __my_prompt_function(){ # used by PS1 + # remove __try_exec from function local lastreturn=$? if test "${TERM}" == dumb then From 1e724a6c23a5a782e97be9f29068324034a207a0 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 19 Mar 2012 20:46:29 +0900 Subject: [PATCH 110/269] exec startx --- bashrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bashrc b/bashrc index ab5ba26..4975b13 100755 --- a/bashrc +++ b/bashrc @@ -166,7 +166,7 @@ showinfo(){ x(){ if [[ -z $DISPLAY ]] && ! [[ -e /tmp/.X11-unix/X0 ]] && (( EUID )); then - nohup startx >~/.backup/log/xorg.log 2>&1 & + exec nohup startx # >~/.backup/log/xorg.log 2>&1 & else echo "X cant be started! Maybe another X is already running!" 1>&2 fi From 7d91b79bd8ea0884de51d7e0a607047a5ee2db18 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 19 Mar 2012 22:35:22 +0900 Subject: [PATCH 111/269] keysnail auto fix --- _keysnail.js | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/_keysnail.js b/_keysnail.js index 7ffd59f..bd1e196 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -498,7 +498,7 @@ ext.add("list-tab-history", function () { // ========================= Special key settings ========================== // key.quitKey = ""; -key.helpKey = "C-h"; +key.helpKey = ""; key.escapeKey = "C-q"; key.macroStartKey = ""; key.macroEndKey = ""; @@ -510,11 +510,11 @@ key.suspendKey = "Not defined"; // ================================= Hooks ================================= // -hook.addToHook('KeySnailInitialized', function () { +hook.setHook('KeySnailInitialized', function () { ext.exec("shiitake-enable-style"); }); -hook.addToHook('KeyBoardQuit', function (aEvent) { +hook.setHook('KeyBoardQuit', function (aEvent) { ext.exec("hide-sidebar"); let(elem = document.commandDispatcher.focusedElement) elem && elem.blur(); gBrowser.focus(); @@ -540,16 +540,6 @@ hook.setHook('Unload', function () { }); }); -// hook.addToHook('LocationChange', function (aNsURI) { -// if(window.content.document.body){ -// display.prettyPrint(window.content.document.title); -// }else{ -// window.addEventListener("load", function(){ -// disp = display; -// disp.prettyPrint(window.content.document.title); -// }, false); -// } -// }); // ============================= Key bindings ============================== // @@ -722,7 +712,8 @@ key.setViewKey([[''], ['']], function (ev, arg) { }, 'ignore'); key.setViewKey(':', function (ev, arg) { - return !document.getElementById("keysnail-prompt").hidden && document.getElementById("keysnail-prompt-textbox").focus(); + return !document.getElementById("keysnail-prompt").hidden && + document.getElementById("keysnail-prompt-textbox").focus(); }, 'KeySnail のプロンプトへフォーカス', true); key.setViewKey('H', function (ev, arg) { @@ -745,14 +736,10 @@ key.setViewKey('C-', function (ev, arg) { ext.exec("list-tab-history", arg, ev); }, 'List tab history', true); -key.setEditKey('C-', function (ev) { - command.walkInputElement(command.elementsRetrieverTextarea, true, true); -}, '次のテキストエリアへフォーカス'); - key.setViewKey('I', function (ev, arg) { - ext.exec('instapaper-post-page-with-comment', arg, ev); + ext.exec("instapaper-post-page-with-comment", arg, ev); }, 'post page and comment', true); -key.setViewKey('C-', function (ev, arg) { - ext.exec('list-tab-history', arg, ev); -}, 'List tab history', true); +key.setEditKey('C-', function (ev) { + command.walkInputElement(command.elementsRetrieverTextarea, true, true); +}, '次のテキストエリアへフォーカス'); From 8dbe89fd4ec053c31a4011bd56bd772a987d7364 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 20 Mar 2012 00:43:22 +0900 Subject: [PATCH 112/269] change way to run x --- bashrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bashrc b/bashrc index 4975b13..a8fa6c0 100755 --- a/bashrc +++ b/bashrc @@ -108,6 +108,7 @@ alias p="$PAGER" alias c=cat alias pcalc="python -i -c 'from math import *' " alias py3=python3 +alias py2=python2 alias _reloadrc="test -f ~/.bashrc && source ~/.bashrc" alias sudo="sudo " # use aliases through sudo alias e3=e3em @@ -166,7 +167,7 @@ showinfo(){ x(){ if [[ -z $DISPLAY ]] && ! [[ -e /tmp/.X11-unix/X0 ]] && (( EUID )); then - exec nohup startx # >~/.backup/log/xorg.log 2>&1 & + nohup startx # >~/.backup/log/xorg.log 2>&1 & else echo "X cant be started! Maybe another X is already running!" 1>&2 fi From d8b1e52cd1091f70b100a4dfeb8bba25c1233f2c Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 20 Mar 2012 14:08:43 +0900 Subject: [PATCH 113/269] update my-setpref --- _keysnail.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/_keysnail.js b/_keysnail.js index afa2d91..0ce72de 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -158,15 +158,6 @@ plugins.options["twitter_client.use_jmp"] = true; //////////////////////////////////////////// // エクステ -ext.add("my-setpref2", function(){ - // navigator.platform - util.setPrefs( - { - "browser.cache.disk.parent_directory":"/tmp" - } - ); -}, "my setpref2"); - ext.add('my-setpref', function(){ util.setPrefs( { @@ -202,8 +193,16 @@ ext.add('my-setpref', function(){ "network.dns.disableIPv6":true, "refcontrol.actions":"@DEFAULT=@FORGE", "scrapbook.tabs.open":true - } + } ); + if(/^Linux/.test(navigator.platform)){ + util.setPrefs( + { + "browser.cache.disk.parent_directory":"/tmp", + "browser.cache.disk.capacity":524288 + } + ); + } display.showPopup("Keysnail", "My prefs done."); }, 'my setpref'); From 23acada3931fb58ea6e07c9edfc5d3c232a399fd Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 21 Mar 2012 13:55:41 +0900 Subject: [PATCH 114/269] misc changes --- bashrc | 42 +++++++++++++++++++----------------------- conkyrc | 5 +++-- profile | 9 +++++++++ 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/bashrc b/bashrc index a8fa6c0..e94d3e8 100755 --- a/bashrc +++ b/bashrc @@ -62,14 +62,6 @@ fi uname -a -null type fortune && { - echo - fortune - echo - fortune -o - echo -} - if [ "${EMACS}" = "t" ]; then # for emacs shell true export PS1="\u@\H \d \t \w\nemacs shell\$ " @@ -97,25 +89,27 @@ alias ls="ls -hCF ${_ENABLECOLOR}--time-style=long-iso" alias vl=/usr/share/vim/vimcurrent/macros/less.sh alias em="emacs -nw" alias pstree="LANG=C pstree" -# alias apt-get="sudo apt-get" -alias ut="ssh 6365454829@un001.ecc.u-tokyo.ac.jp" -alias rand="echo \$RANDOM" -alias xunp="file-roller -h" -alias pacome="sudo \paco -D" +alias cp="cp -v" +alias mv="mv -v" alias psall="ps auxww" alias q=exit alias p="$PAGER" alias c=cat +alias sudo="sudo " # use aliases through sudo +alias e3=e3em +alias halt="sudo halt" +alias reboot="sudo reboot" +alias rand="echo \$RANDOM" +# alias apt-get="sudo apt-get" +alias ut="ssh 6365454829@un001.ecc.u-tokyo.ac.jp" +alias xunp="file-roller -h" +# alias pacome="sudo \paco -D" alias pcalc="python -i -c 'from math import *' " alias py3=python3 alias py2=python2 alias _reloadrc="test -f ~/.bashrc && source ~/.bashrc" -alias sudo="sudo " # use aliases through sudo -alias e3=e3em alias mytime="date +%Y%m%d-%H%M%S" alias sh="ENV=$HOME/.shrc PS1=\$\ sh" -alias halt="sudo halt" -alias reboot="sudo reboot" # type trash >/dev/null 2>&1 && alias rm=trash alias aptin="apt-get install" @@ -134,7 +128,7 @@ null type pacmatic && { } alias ubuntu-upgrade="sudo apt-get autoremove --yes && sudo apt-get update --yes && sudo apt-get upgrade --yes" -alias arch-upgrade="yaourt -Syu" +alias arch-upgrade="sudo pacman -Syu" alias port-upgrade="port selfupdate && port sync && port upgrade installed" if iscygwin; then @@ -167,7 +161,8 @@ showinfo(){ x(){ if [[ -z $DISPLAY ]] && ! [[ -e /tmp/.X11-unix/X0 ]] && (( EUID )); then - nohup startx # >~/.backup/log/xorg.log 2>&1 & + #nohup startx # >~/.backup/log/xorg.log 2>&1 & + startx else echo "X cant be started! Maybe another X is already running!" 1>&2 fi @@ -199,7 +194,7 @@ git-make-local-rep(){ bak(){ for file in "$@" do - mv -v ${file} ${file}.bak + cp -v ${file} ${file}.bak done } di(){ @@ -281,7 +276,7 @@ _mygitconfig(){ git config --global color.ui auto git config --global status.relativePaths false git config --global status.showUntrackedFiles normal - git config --global alias.graph "log --graph --date-order -C -M --pretty=format:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=short" + git config --global alias.graph "log --graph --date-order -C -M --pretty=tformat:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=short" git config --global alias.st "status -s" git config --global alias.b "branch" git config --global alias.ci "commit --verbose" @@ -442,8 +437,9 @@ __my_prompt_function(){ # used by PS1 if test -z "$DISPLAY" then local ip=$(ip-address [Addr:%s]) - test -f /tmp/batterystatus && local battery="[Battery:$(sed -e 's`%`%%`g' /tmp/batterystatus)]" - battery-status %s >/tmp/batterystatus & + local bst="/tmp/${USER}-tmp/batterystatus" + test -f $bst && local battery="[Battery:$(sed -e 's`%`%%`g' $bst)]" + battery-status %s >$bst & fi local tty=$(__try_exec tty | sed -e 's:/dev/::') # local battery=$(battery-state [%s] | sed -e 's`%`%%`g') # very slow diff --git a/conkyrc b/conkyrc index 42cb041..1d862de 100644 --- a/conkyrc +++ b/conkyrc @@ -49,17 +49,18 @@ ${color2}lgin ${color1}|${color0} ${uptime} ${color0}${stippled_hr} ${color2}cpu ${color1}|${color0} ${cpu}% ${cpubar} ${color2}freq ${color1}|${color0} ${freq 1}Mhz | ${freq 2}Mhz +${color2}temp ${color1}|${color0} ${acpitemp} °C #${color2}btry ${color1}|${color0} ${battery} #${color2}btime${color1}|${color0} ${battery_time} ${color0}${hr} ${color2}ram ${color1}|${color0} ${memperc}% ${membar} -${color2}swap ${color1}|${color0} ${if_match "${swapperc}" == "No swap"}None${else}${swapperc} ${swapbar}${endif} +${color2}swap ${color1}|${color0} ${if_match "${swapperc}" == "No swap"}None${else}${swapperc}% ${swapbar}${endif} ${color0}${stippled_hr} ${color2}root ${color1}|${color0} ${fs_used /} #/${fs_size /} ${fs_bar /} ${color2}/tmp ${color1}|${color0} ${fs_used /tmp} #/${fs_size /tmp} ${fs_bar /tmp} -${color2}dio ${color1}|${color0} ${diskio} +${color2}i/o ${color1}|${color0} ${diskio} ${color0}${hr} ${color2}${gw_iface} ${color1}|${color0} ${addr} ${color2}ssid ${color1}|${color0} ${wireless_essid} diff --git a/profile b/profile index 251e76d..e3537ce 100755 --- a/profile +++ b/profile @@ -1,5 +1,13 @@ #!/bin/sh +type fortune >/dev/null 2>&1 && { + echo + fortune + echo + fortune -o + echo +} + # export PS1="\$ " # export LANG=ja_JP.UTF-8 export LC_TIME=C @@ -24,3 +32,4 @@ type setterm >/dev/null 2>&1 && setterm -blank 30 -powersave on # -powerdown 10 # in my environment powerdown does not work mkdir -p ~/.backup/log +mkdir -p /tmp/$USER-tmp From a7c84058b31109b0c6912319bec76fc6dad497a7 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 21 Mar 2012 22:58:38 +0900 Subject: [PATCH 115/269] update some aliases --- bashrc | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/bashrc b/bashrc index e94d3e8..fc72140 100755 --- a/bashrc +++ b/bashrc @@ -32,6 +32,7 @@ then else export PAGER="less" fi +export LESS="-iRMX" if false null type vim then @@ -69,19 +70,14 @@ elif echo "$EMACS" | grep term >/dev/null 2>&1; then # for emacs term echo "Emacs Term" fi -# if test -f /etc/issue -# then -# cat /etc/issue -# fi - ################################### # some aliases and functions -test "$TERM" == dumb || _ENABLECOLOR="--color=always " +test "$TERM" == dumb || _coloroption=" --color=always" -export LESS="-iRMX" -export GREP_OPTIONS="${_ENABLECOLOR}" -alias ls="ls -hCF ${_ENABLECOLOR}--time-style=long-iso" +alias ls="ls -hCF --time-style=long-iso${_coloroption}" +# export GREP_OPTIONS="" +alias grep="grep${_coloroption}" # alias ll="ls -l" # alias la="ls -A" # alias lla="ls -Al" @@ -123,8 +119,8 @@ null type pacman-color && { export PACMAN=pacman-color # used by yaourt } null type pacmatic && { - alias pacman=pacmatic - export PACMAN=pacmatic + alias pacman="pacmatic" + export PACMAN="pacmatic" } alias ubuntu-upgrade="sudo apt-get autoremove --yes && sudo apt-get update --yes && sudo apt-get upgrade --yes" From 1250a8fff65114e326886152ce64dc6354252907 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 22 Mar 2012 15:53:32 +0900 Subject: [PATCH 116/269] update conkyrc --- conkyrc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conkyrc b/conkyrc index 1d862de..15dc8c2 100644 --- a/conkyrc +++ b/conkyrc @@ -39,7 +39,7 @@ uppercase no format_human_readable yes TEXT -${color0}${alignr}${conky_build_arch} +${color0}${alignr}${sysname} ${kernel} (${machine}) ${color0}${alignr}${execi 30000 whoami}@${nodename} ${color0}${hr} #${color2}host ${color1}|${color0} ${nodename} @@ -53,8 +53,8 @@ ${color2}temp ${color1}|${color0} ${acpitemp} °C #${color2}btry ${color1}|${color0} ${battery} #${color2}btime${color1}|${color0} ${battery_time} ${color0}${hr} -${color2}ram ${color1}|${color0} ${memperc}% ${membar} -${color2}swap ${color1}|${color0} ${if_match "${swapperc}" == "No swap"}None${else}${swapperc}% ${swapbar}${endif} +${color2}ram ${color1}|${color0} ${mem} ${membar} +${color2}swap ${color1}|${color0} ${if_match "${swapperc}" == "No swap"}None${else}${swap} ${swapbar}${endif} ${color0}${stippled_hr} ${color2}root ${color1}|${color0} ${fs_used /} #/${fs_size /} ${fs_bar /} @@ -62,7 +62,7 @@ ${color2}/tmp ${color1}|${color0} ${fs_used /tmp} #/${fs_size /tmp} ${fs_bar /tmp} ${color2}i/o ${color1}|${color0} ${diskio} ${color0}${hr} -${color2}${gw_iface} ${color1}|${color0} ${addr} +${color2}if ${color1}|${color0} ${gw_iface}:${addr} ${color2}ssid ${color1}|${color0} ${wireless_essid} ${color0}${stippled_hr} ${color2}down ${color1}|${color0} ${downspeed}/s From 0818b6d14512ad893339a4022bef7db92fc03a0d Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 22 Mar 2012 15:54:02 +0900 Subject: [PATCH 117/269] update tabutils style --- _keysnail.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/_keysnail.js b/_keysnail.js index 0ce72de..9aac36d 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -184,7 +184,8 @@ ext.add('my-setpref', function(){ "extensions.saveimageinfolder.general-fileprefixvalue":"%yyyy%%MM%%dd%-%hh%%mm%%ss%_", "extensions.saveimageinfolder.usecache":true, "extensions.tabutils.openTabNext":1, - "extensions.tabutils.styles.current":"{\"bold\":false,\"italic\":false,\"underline\":true,\"strikethrough\":false,\"color\":true,\"colorCode\":\"#EEEEEE\",\"bgColor\":true,\"bgColorCode\":\"#000000\",\"outline\":false,\"outlineColorCode\":\"#000000\"}", + "extensions.tabutils.styles.current":"{\"bold\":true,\"italic\":false,\"underline\":true,\"strikethrough\":false,\"color\":true,\"colorCode\":\"#000000\",\"bgColor\":false,\"bgColorCode\":\"#000000\",\"outline\":false,\"outlineColorCode\":\"#000000\"}", + "extensions.tabutils.styles.unread":"{\"bold\":false,\"italic\":false,\"underline\":false,\"strikethrough\":false,\"color\":true,\"colorCode\":\"#CC0000\",\"bgColor\":false,\"bgColorCode\":\"undefined\",\"outline\":false,\"outlineColorCode\":\"undefined\"}", "extensions.yass.edgetype":0, "extensions.yass.selectedpreset":"red", "font.default.x-western":"sans-serif", From 3ec97fc85c8500d5030cf85d05f059b7e6a62d5d Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 23 Mar 2012 18:19:16 +0900 Subject: [PATCH 118/269] update o function --- bashrc | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/bashrc b/bashrc index fc72140..a813449 100755 --- a/bashrc +++ b/bashrc @@ -91,8 +91,8 @@ alias psall="ps auxww" alias q=exit alias p="$PAGER" alias c=cat -alias sudo="sudo " # use aliases through sudo alias e3=e3em +alias sudo="sudo " # use aliases through sudo alias halt="sudo halt" alias reboot="sudo reboot" alias rand="echo \$RANDOM" @@ -239,24 +239,33 @@ setclip(){ fi fi } -o(){ - if [ $# -eq 0 ] - then - local f=. +if iswindows; then + alias _open_file='cmd.exe //c start ""' +elif isdarwin; then + alias _open_file=open +elif islinux; then + if null type pcmanfm; then + alias _open_file="LC_MESSAGES= pcmanfm" else - local f="$1" + alias _open_file="LC_MESSAGES= xdg-open" fi - if iswindows - then - cmd.exe //c start "" "$f" - elif isdarwin - then - open "$f" - elif type pcmanfm >/dev/null 2>&1 +else + alias _open_file=cat +fi +o(){ + if test $# -eq 0 then - LC_MESSAGES= pcmanfm "$f" + _open_file . & else - LC_MESSAGES= xdg-open "$f" + for f in "$@" + do + if test -d $f + then + _open_file $f & + else + _open_file $f + fi + done fi } convmv-sjis2utf8-test(){ From da1f5081156bc43369860958c59178169163daf8 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 23 Mar 2012 18:19:31 +0900 Subject: [PATCH 119/269] misc changes --- conkyrc | 3 ++- emacs.el | 7 +++---- xprograms | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/conkyrc b/conkyrc index 15dc8c2..8765694 100644 --- a/conkyrc +++ b/conkyrc @@ -70,5 +70,6 @@ ${color #888888}${downspeedgraph ff0000 0000ff} ${color2}up ${color1}|${color0} ${upspeed}/s ${color #888888}${upspeedgraph 0000ff ff0000} ${color0}${hr} -${alignr}conky ${conky_version} on Page${desktop} +${alignr}conky ${conky_version} +# on Page${desktop} #${color0}${alignr}${execi 900 cal -1} diff --git a/emacs.el b/emacs.el index af9515e..7e6645e 100644 --- a/emacs.el +++ b/emacs.el @@ -116,10 +116,10 @@ ;; display date (add-hook 'after-init-hook (lambda () - ;; (setq display-time-string-forms - ;; '(dayname ", " day " " monthname " " year " " 24-hours ":"minutes ":" seconds)) (setq display-time-string-forms - '((my-format-time-string))) + '(dayname ", " day " " monthname " " year " " 24-hours ":"minutes ":" seconds)) + ;; (setq display-time-string-forms + ;; '((my-format-time-string))) (when display-time-mode (display-time-update)) )) @@ -534,7 +534,6 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; share clipboard with x (when (and window-system - ;; (getenv "DESKTOP_SESSION") (not (eq window-system 'mac)) ) (setq x-select-enable-clipboard t ; these settings seems to be useless when using emacs in terminal diff --git a/xprograms b/xprograms index 8dc6556..056d3bf 100755 --- a/xprograms +++ b/xprograms @@ -24,3 +24,4 @@ if ! pgrep -lf "udisks-daemon: polling /dev/sr0"; then fi udisksvm >/dev/null & +xcompmgr -c & From c384f8d7450fbe031535a6b63e583ac46c091d68 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 24 Mar 2012 03:00:31 +0900 Subject: [PATCH 120/269] add gtkbm.el prefs, set title for terminal --- emacs.el | 45 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/emacs.el b/emacs.el index 7e6645e..ed7d587 100644 --- a/emacs.el +++ b/emacs.el @@ -27,6 +27,28 @@ (symbol-name system-type) "] " '(:eval (symbol-name last-command)))) + +(defun set-terminal-title (&rest args) + "" + (interactive "sString to set as title: ") + (send-string-to-terminal (apply 'concat + "\033]0;" + `(,@args "\007")))) +(and (getenv "DISPLAY") + (not window-system) + (defvar old-directory default-directory) + (add-hook 'post-command-hook + (lambda () + (unless (eq old-directory default-directory) + (setq old-directory default-directory) + (set-terminal-title "[" + invocation-name + " " + emacs-version + " " + (symbol-name system-type) + "] " + (abbreviate-file-name default-directory)))))) (defun buffer-list-not-start-with-space () (let ((bl (buffer-list)) b nbl) @@ -53,7 +75,8 @@ (add-hook 'kill-emacs-hook ; 終了時に読み込んで壊れてないか調べる (lambda () (when (file-readable-p "~/.emacs") - (load-file "~/.emacs")))) + (load-file "~/.emacs")) + )) (add-hook 'after-init-hook (lambda () @@ -721,8 +744,11 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (require 'session nil t) -(when (require 'gtkbm nil t) - (global-set-key (kbd "C-x C-d") 'gtkbm)) +(and (dllib-if-unfound "gtkbm" + "https://raw.github.com/10sr/emacs-lisp/master/gtkbm.el" + t) + (require 'gtkbm nil t) + (global-set-key (kbd "C-x C-d") 'gtkbm)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; frame buffer @@ -1076,7 +1102,7 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ;; (recentf-add-file default-directory))) (recentf-mode 1) (add-to-list 'recentf-filename-handlers 'abbreviate-file-name) - (add-to-list 'recentf-exclude "\\.emacs\\.d/recentf")) + (add-to-list 'recentf-exclude (rx-to-string recentf-save-file))) (add-hook 'recentf-dialog-mode-hook (lambda () @@ -1285,7 +1311,7 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (delete-file file))))) (and (dllib-if-unfound "pack" - "https://github.com/10sr/emacs-lisp/raw/master/pack.el" + "https://raw.github.com/10sr/emacs-lisp/master/pack.el" t) (require 'pack nil t) (add-hook 'dired-mode-hook @@ -1658,11 +1684,12 @@ when SEC is nil, stop auto save if enabled." (call-process "cmd.exe" nil 0 nil "/c" "start" "" (convert-standard-filename file))) ((eq system-type 'darwin) (call-process "open" nil 0 nil file)) - ((not (getenv "DISPLAY")) - (find-file file)) + ((getenv "DISPLAY") + (call-process (or my-filer "xdg-open") nil 0 nil file)) (t - (call-process (or my-filer "xdg-open") nil 0 nil file))) - (recentf-add-file file) + (find-file file)) + ) + ;; (recentf-add-file file) (message "Opening %s...done" file)) (defvar my-auto-indent-buffer-mode-list From b396b5f8c1ea1bb2ed82519109c2a7a214d85d2a Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 24 Mar 2012 03:00:47 +0900 Subject: [PATCH 121/269] set title for terminal --- bashrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bashrc b/bashrc index a813449..9507aa9 100755 --- a/bashrc +++ b/bashrc @@ -452,6 +452,8 @@ __my_prompt_function(){ # used by PS1 printf "${c2}${USER}@${HOSTNAME}${cdef} ${tty} ${date} ${BASH} ${BASH_VERSION}\n" printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " + TERMTITLE="${USER}@${HOSTNAME} ${PWD}" + test -n "$DISPLAY" && echo -n -e "\033]0;${TERMTITLE}\007" } # from https://wiki.archlinux.org/index.php/X_resources From c68439c70c69493091f34335cd58526d853514ea Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 24 Mar 2012 17:41:56 +0900 Subject: [PATCH 122/269] remove auto-indent-buffer --- emacs.el | 57 +++++++++++++++++--------------------------------------- 1 file changed, 17 insertions(+), 40 deletions(-) diff --git a/emacs.el b/emacs.el index ed7d587..6c015be 100644 --- a/emacs.el +++ b/emacs.el @@ -380,6 +380,10 @@ ;; (setq delete-by-moving-to-trash t ;; trash-directory "~/.emacs.d/trash") +;; その他のhook +(add-hook 'after-save-hook + 'executable-make-buffer-file-executable-if-script-p) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; editting (setq require-final-newline t) @@ -513,8 +517,6 @@ (mouse-avoidance-mode 'banish) - - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; download library from web @@ -574,10 +576,6 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (require 'xclip nil t) (turn-on-xclip)) -;; その他のhook -(add-hook 'after-save-hook - 'executable-make-buffer-file-executable-if-script-p) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; mode @@ -611,6 +609,9 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (shell-command (buffer-substring-no-properties (point-at-bol) (point)))) +(add-to-list 'auto-mode-alist + '("\\(xinitrc\\|xprograms\\|\\)\\'" . sh-mode)) + (setq python-python-command (or (executable-find "python3") (executable-find "python"))) (defun my-python-run-as-command () @@ -660,17 +661,17 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (add-hook 'outline-mode-hook (lambda () - (if (string-match "\\.md$" buffer-file-name) + (if (string-match "\\.md\\'" buffer-file-name) (set (make-local-variable 'outline-regexp) "#+ ")))) -(add-to-list 'auto-mode-alist (cons "\\.ol$" 'outline-mode)) +(add-to-list 'auto-mode-alist (cons "\\.ol\\'" 'outline-mode)) -(add-to-list 'auto-mode-alist (cons "\\.md$" 'outline-mode)) +(add-to-list 'auto-mode-alist (cons "\\.md\\'" 'outline-mode)) (setq markdown-command (or (executable-find "markdown") (executable-find "markdown.pl"))) (when (dllib-if-unfound "markdown-mode" "http://jblevins.org/projects/markdown-mode/markdown-mode.el" t) - (add-to-list 'auto-mode-alist (cons "\\.md$" 'markdown-mode)) + (add-to-list 'auto-mode-alist (cons "\\.md\\'" 'markdown-mode)) (autoload 'markdown-mode "markdown-mode" "Major mode for editing Markdown files." nil) (add-hook 'markdown-mode-hook (lambda () @@ -693,8 +694,8 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." "https://raw.github.com/mooz/js2-mode/master/js2-mode.el" t) (autoload 'js2-mode "js2-mode" nil t) - (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode)) - (add-to-list 'auto-mode-alist '("\\.jsm$" . js2-mode))) + (add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode)) + (add-to-list 'auto-mode-alist '("\\.jsm\\'" . js2-mode))) ;; (add-hook 'js2-mode-hook ;; (lambda () ;; (add-hook 'before-save-hook @@ -1018,9 +1019,9 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." "http://www.katch.ne.jp/~leque/software/repos/gauche-mode/gauche-mode.el" t) (setq auto-mode-alist - (cons '("\.gosh$" . gauche-mode) auto-mode-alist)) + (cons '("\.gosh\\'" . gauche-mode) auto-mode-alist)) (setq auto-mode-alist - (cons '("\.gaucherc$" . gauche-mode) auto-mode-alist)) + (cons '("\.gaucherc\\'" . gauche-mode) auto-mode-alist)) (autoload 'gauche-mode "gauche-mode" "Major mode for Scheme." t) (autoload 'run-scheme "gauche-mode" "Run an inferior Scheme process." t) (add-hook 'gauche-mode-hook @@ -1311,8 +1312,8 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (delete-file file))))) (and (dllib-if-unfound "pack" - "https://raw.github.com/10sr/emacs-lisp/master/pack.el" - t) + "https://raw.github.com/10sr/emacs-lisp/master/pack.el" + t) (require 'pack nil t) (add-hook 'dired-mode-hook (lambda () @@ -1643,10 +1644,6 @@ when SEC is nil, stop auto save if enabled." 'git-command-history))) (let ((dir default-directory) (bf (get-buffer-create "*Git Output*")) - ;; (process-environment `(,@process-environment)) - ;; (comint-preoutput-filter-functions '(ansi-color-apply . nil)) - ;; (comint-output-filter-functions (cons 'ansi-color-process-output - ;; comint-output-filter-functions)) ) (delete-windows-on bf t) (shell-command (concat "git " @@ -1692,26 +1689,6 @@ when SEC is nil, stop auto save if enabled." ;; (recentf-add-file file) (message "Opening %s...done" file)) -(defvar my-auto-indent-buffer-mode-list - '(emacs-lisp-mode - sh-mode - js-mode - sgml-mode - c-mode - c++-mode)) -(setq my-auto-indent-buffer-mode-list nil) ;disable -(defun my-indent-buffer () - "indent whole buffer." - (interactive) - (indent-region (point-min) - (point-max))) -(defun my-auto-indent-buffer () - "" - (when (memq major-mode my-auto-indent-buffer-mode-list) - (my-indent-buffer))) -(add-hook 'before-save-hook - 'my-auto-indent-buffer) - (defun my-keyboard-quit () "" (interactive) From 138076aa4c61ac96a40218ba220395fe785541c3 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 24 Mar 2012 17:43:21 +0900 Subject: [PATCH 123/269] remove emacs launcher --- emacs.el | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/emacs.el b/emacs.el index 6c015be..0cac54c 100644 --- a/emacs.el +++ b/emacs.el @@ -1731,30 +1731,6 @@ this is test, does not rename files" (message file)) (message "not visiting file.")))) -;; ;; コマンド的な -;; (defvar my-execute-func-list nil "func list") -;; (defvar my-execute-func-hist-list nil "func hist list") -;; (setq my-execute-func-list '("(call-interactively 'my-francaiscd-b)" -;; "(call-interactively 'my-francaiscd-a)" -;; "parsec47" -;; "chromium-browser" -;; "inkscape" -;; "audacious" -;; "gnome-terminal" -;; "zkaicd.py" -;; "glchess")) - -;; (defun my-execute-start-process-or-eval-sexp () -;; "execute something" -;; (interactive) -;; (let ((func (completing-read "command?: " my-execute-func-list nil nil "" my-execute-func-hist-list))) -;; (if (string= "(" (substring func 0 1)) -;; (with-temp-buffer (insert func) -;; (eval-buffer)) -;; (start-process "ps" -;; nil -;; func)))) - (defvar my-revert-buffer-if-needed-last-buffer nil) (defun my-revert-buffer-if-needed () From 21e5affead282da4a9e43cd00d0ccf63a9e02c2e Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 24 Mar 2012 18:53:24 +0900 Subject: [PATCH 124/269] fix bug, restore terminal title after resume suspend --- emacs.el | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/emacs.el b/emacs.el index 0cac54c..ba80136 100644 --- a/emacs.el +++ b/emacs.el @@ -34,6 +34,16 @@ (send-string-to-terminal (apply 'concat "\033]0;" `(,@args "\007")))) +(defun my-set-terminal-title () + "" + (set-terminal-title "[" + invocation-name + " " + emacs-version + " " + (symbol-name system-type) + "] " + (abbreviate-file-name default-directory))) (and (getenv "DISPLAY") (not window-system) (defvar old-directory default-directory) @@ -41,14 +51,10 @@ (lambda () (unless (eq old-directory default-directory) (setq old-directory default-directory) - (set-terminal-title "[" - invocation-name - " " - emacs-version - " " - (symbol-name system-type) - "] " - (abbreviate-file-name default-directory)))))) + (my-set-terminal-title)))) + (add-hook 'suspend-resume-hook + 'my-set-terminal-title)) + (defun buffer-list-not-start-with-space () (let ((bl (buffer-list)) b nbl) @@ -610,7 +616,7 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (point)))) (add-to-list 'auto-mode-alist - '("\\(xinitrc\\|xprograms\\|\\)\\'" . sh-mode)) + '("\\(xinitrc\\|xprograms\\)\\'" . sh-mode)) (setq python-python-command (or (executable-find "python3") (executable-find "python"))) From 0ac3ae8b4592a07743d323a4928803088e25a24b Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 24 Mar 2012 23:40:11 +0900 Subject: [PATCH 125/269] simplify prompt --- bashrc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bashrc b/bashrc index 9507aa9..5426547 100755 --- a/bashrc +++ b/bashrc @@ -63,6 +63,9 @@ fi uname -a +echo +echo TERM $TERM on $(tty), running $BASH $BASH_VERSION +echo if [ "${EMACS}" = "t" ]; then # for emacs shell true export PS1="\u@\H \d \t \w\nemacs shell\$ " @@ -446,10 +449,9 @@ __my_prompt_function(){ # used by PS1 test -f $bst && local battery="[Battery:$(sed -e 's`%`%%`g' $bst)]" battery-status %s >$bst & fi - local tty=$(__try_exec tty | sed -e 's:/dev/::') # local battery=$(battery-state [%s] | sed -e 's`%`%%`g') # very slow printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}${battery}${ip}\n" - printf "${c2}${USER}@${HOSTNAME}${cdef} ${tty} ${date} ${BASH} ${BASH_VERSION}\n" + printf "${c2}${USER}@${HOSTNAME}${cdef} ${date}\n" printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " TERMTITLE="${USER}@${HOSTNAME} ${PWD}" From 7a7bd28ee06af55c40ae64ae2c54bbcf29bf8abd Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 25 Mar 2012 03:06:16 +0900 Subject: [PATCH 126/269] fix and cleanse code --- bashrc | 54 ++++++++++++------------------------------------------ 1 file changed, 12 insertions(+), 42 deletions(-) diff --git a/bashrc b/bashrc index 5426547..14faedd 100755 --- a/bashrc +++ b/bashrc @@ -62,8 +62,6 @@ fi ####################### uname -a - -echo echo TERM $TERM on $(tty), running $BASH $BASH_VERSION echo @@ -160,36 +158,13 @@ showinfo(){ x(){ if [[ -z $DISPLAY ]] && ! [[ -e /tmp/.X11-unix/X0 ]] && (( EUID )); then - #nohup startx # >~/.backup/log/xorg.log 2>&1 & + #nohup startx >~/.backup/log/xorg.log 2>&1 & startx else echo "X cant be started! Maybe another X is already running!" 1>&2 fi } -export __MYGITBAREREP="${HOME}/dbx/.git-bare" -git-make-local-rep(){ - test $# -eq 0 && { - echo "specify repository name." 1>&2 - return 1 - } - - dir="${__MYGITBAREREP}/$1.git" - cdir=$PWD - - if test -d "$dir" - then - echo "dir $dir already exist!" 1>&2 - else - mkdir -p "$dir" && { - cd "$dir" && - git init --bare --shared=all - } - fi - - cd ${cdir} -} - bak(){ for file in "$@" do @@ -277,7 +252,7 @@ convmv-sjis2utf8-test(){ convmv-sjis2utf8-notest(){ convmv -r -f sjis -t utf8 * --notest } -_mygitconfig(){ +_my_git_config(){ git config --global user.name '10sr' git config --global user.email '8slashes+git@gmail.com' git config --global core.autocrlf false @@ -361,17 +336,19 @@ _colors(){ "\e[37;1mBright White\n" \ "\e[0m" } -# http://www.frexx.de/xterm-256-notes/data/colortable16.sh -_install_script(){ +_my_install_script(){ mkdir -p $HOMO/bin/ for f in "$@" do bn=$(basename "$f") - type ${bn} >/dev/null 2>&1 || wget "$f" -P "$HOME/bin/" - chmod u+x "$HOME/bin/${bn}" + type ${bn} >/dev/null 2>&1 || { + wget "$f" -P "$HOME/bin/" + chmod u+x "$HOME/bin/${bn}" + } done } +_my_install_script http://www.frexx.de/xterm-256-notes/data/colortable16.sh winln(){ # for windose make link (actually junction) @@ -388,7 +365,7 @@ winln(){ fi } -battery-status(){ +__my_battery_status(){ local dir=/sys/class/power_supply/BAT0 if test -d $dir then @@ -399,14 +376,7 @@ battery-status(){ printf "$1" "${st}:${rate}%" fi } -alias bat='battery-status %s\\n' - -battery-status2(){ - local dir=/sys/class/power_supply/BAT0 - . $dir/uevent - local rate=$(expr $POWER_SUPPLY_CHARGE_NOW \* 100 / $POWER_SUPPLY_CHARGE_FULL) - echo ${POWER_SUPPLY_STATUS}:${rate}% -} +alias bat='__my_battery_status %s\\n' ip-address(){ local ip=$(LANG=C ifconfig | grep "inet " | grep -v "127.0.0.1" | awk '{print $2}') @@ -447,7 +417,7 @@ __my_prompt_function(){ # used by PS1 local ip=$(ip-address [Addr:%s]) local bst="/tmp/${USER}-tmp/batterystatus" test -f $bst && local battery="[Battery:$(sed -e 's`%`%%`g' $bst)]" - battery-status %s >$bst & + __my_battery_status %s >$bst & fi # local battery=$(battery-state [%s] | sed -e 's`%`%%`g') # very slow printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}${battery}${ip}\n" @@ -455,7 +425,7 @@ __my_prompt_function(){ # used by PS1 printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " TERMTITLE="${USER}@${HOSTNAME} ${PWD}" - test -n "$DISPLAY" && echo -n -e "\033]0;${TERMTITLE}\007" + test -n "$DISPLAY" && test -z "$EMACS" && echo -n -e "\033]0;${TERMTITLE}\007" } # from https://wiki.archlinux.org/index.php/X_resources From 2556b2fb179fedf47ab95fda5a9e0a228fc39f99 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 26 Mar 2012 16:09:47 +0900 Subject: [PATCH 127/269] cleanse code --- _keysnail.js | 78 ++++++++-------------------------------------------- 1 file changed, 11 insertions(+), 67 deletions(-) diff --git a/_keysnail.js b/_keysnail.js index 9aac36d..05f3df8 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -28,7 +28,7 @@ function ignore(k, i) [k, null]; // style.register("#bookmarksPanel > hbox,#history-panel > hbox {display: none !important;} //#urlbar-container{max-width: 500px !important;}"); /////////////////////////////////// -//検索エンジン +//search engine plugins.options["search-url-list"] = [ ["bing","http://bing.com/search?q=%q"], ["yatwitter search","http://yats-data.com/yats/search?query=%q"], @@ -52,7 +52,7 @@ plugins.options["my-keysnail-bookmarks"] = [ "twitter.com", ]; -// sitelocal +// sitelocal keymap ////////////////////////////////////////// // 2ch chaika @@ -77,7 +77,7 @@ local["^http://w2.p2.2ch.net/p2/read.php"] = [ ]; ///////////////////////////////////////// -// feedly用マップ +// feedly local["^http://www.feedly.com/"] = [ ['d', null], ['j', null], @@ -98,7 +98,7 @@ local["^http://www.feedly.com/"] = [ ]; ///////////////////////////////////////// -//nicovideo用 +//nicovideo local["http://(www|tw|es|de|)\.nicovideo\.jp\/(watch|playlist)/*"] = [ ["i", function (ev, arg) { ext.exec("nicoinfo", arg); }], ["p", function (ev, arg) { ext.exec("nicopause", arg); }], @@ -156,7 +156,7 @@ plugins.options["twitter_client.jmp_key"] = "R_c51f889a77cb4b4e993ed868f65083f5" plugins.options["twitter_client.use_jmp"] = true; //////////////////////////////////////////// -// エクステ +// my ext ext.add('my-setpref', function(){ util.setPrefs( @@ -279,62 +279,6 @@ ext.add("close-and-next-tab", function (ev, arg) { gBrowser.selectedTab = gBrowser.mTabs[n]; }, "close and focus to next tab"); -///////////////////////////////////// -// google itranslate -// use mstranslator instead -(function(){ - let targetLang = "ja"; // target lang to translate into - let alternativeLang = "en"; // if given word is in targetLang, use this instead as a target lang - function translate(word, target, next) { - next("", "", " getting..."); - const base = "https://www.googleapis.com/language/translate/v2?key=%s&q=%s&target=%s"; - const apikey = "AIzaSyBq48p8NhFgaJ1DfUJ5ltbwLxeXpjEL86A"; - let ep = util.format(base, apikey, encodeURIComponent(word), target); - util.httpGet(ep, false, function (res) { - if (res.status === 200) { - let json = decodeJSON(res.responseText); - let srclang = json.data.translations[0].detectedSourceLanguage; - if (target == srclang) { - lookupword(word, alternativeLang); - } else { - let result = json.data.translations[0].translatedText; - next(srclang, target, result); - } - } else { - next("", "", "ERROR!"); - } - }); - }; - function echo(srclang, from, tglang, to){ - display.echoStatusBar(srclang + " : " + from + " -> " + tglang + " : " + to); - }; - function decodeJSON(json) { - return util.safeEval("(" + json + ")"); - }; - function lookupword(word, target){ - translate(word, target, function (src, tg, translated) { - echo(src, word, tg, translated); - }); - }; - function read (aInitialInput) { - let prevText = ""; - - prompt.reader({ - message : "word or sentence to translate:", - initialinput : aInitialInput, - onChange: function (arg) { - let word = arg.textbox.value; - if (word !== prevText) { - prevText = word; - lookupword(word, targetLang); - } - }, - callback: function (s){}, - }); - }; - ext.add("google-itranslate",function(){read(content.document.getSelection() || "");},"google itranslate"); -})(); - ////////////////////////////////////// // ext.add("restart-firefox-add-menu", function(){ @@ -410,25 +354,25 @@ ext.add("copy-url", function () { }, "Copy url or feed url of current page"); /////////////////////////////////////// -// 評価しちゃうっぽい とりあえずこんな感じで +// keysnail z menu ext.add("keysnail-setting-menu",function(){ var settingmenulist = [["keysnail setting dialogue", function(){return function(){KeySnail.openPreference();};}], - ["keysnail plugin manager", function(){return function(){userscript.openPluginManager();}}], + ["keysnail plugin manager", function(){return function(){userscript.openPluginManager();};}], ["firefox addon manager", function(){return function(){BrowserOpenAddonsMgr();};}], ["reload .keysnail.js", function(){return function() {userscript.reload();};}], // ["check for plugins update", function(){return function(){ext.exec("check-for-plugins-update");};}], - ["restart firefox", function(){return function(){ext.exec("restart-firefox");};}], + ["restart firefox", function(){return function(){ext.exec("restart-firefox");};}] ]; prompt.selector( { message : "open setting dialog", collection : settingmenulist, - callback : function (i) { settingmenulist[i][1]()(); }, + callback : function (i) { settingmenulist[i][1]()(); } }); },"open keysnail setting menu"); //////////////////////// -//マルチプルタブハンドラ +// multiple tab handler ext.add("multiple-tab-handler-close-selected-and-current-tabs", function () { BrowserCloseTabOrWindow(); // if (MultipleTabService) { @@ -460,7 +404,7 @@ ext.add("query-then-engine", function () { }, "enter search word and then select engine"); ///////////////////////////////////// -// 閉じたタブリスト +// closed tab list ext.add("list-closed-tabs", function () { const fav = "chrome://mozapps/skin/places/defaultFavicon.png"; var ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore); From 9b89244a826e65c4643830e4c5b0fda10756810f Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 26 Mar 2012 16:10:10 +0900 Subject: [PATCH 128/269] fix some bug --- bashrc | 25 ++++++++++++++++--------- emacs.el | 29 ++++++++++++++++------------- 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/bashrc b/bashrc index 14faedd..d6a9272 100755 --- a/bashrc +++ b/bashrc @@ -65,12 +65,6 @@ uname -a echo TERM $TERM on $(tty), running $BASH $BASH_VERSION echo -if [ "${EMACS}" = "t" ]; then # for emacs shell - true export PS1="\u@\H \d \t \w\nemacs shell\$ " -elif echo "$EMACS" | grep term >/dev/null 2>&1; then # for emacs term - echo "Emacs Term" -fi - ################################### # some aliases and functions @@ -78,7 +72,7 @@ test "$TERM" == dumb || _coloroption=" --color=always" alias ls="ls -hCF --time-style=long-iso${_coloroption}" # export GREP_OPTIONS="" -alias grep="grep${_coloroption}" +alias grep="grep -n${_coloroption}" # alias ll="ls -l" # alias la="ls -A" # alias lla="ls -Al" @@ -379,7 +373,7 @@ __my_battery_status(){ alias bat='__my_battery_status %s\\n' ip-address(){ - local ip=$(LANG=C ifconfig | grep "inet " | grep -v "127.0.0.1" | awk '{print $2}') + local ip=$(LANG=C ifconfig | grep --color=never "inet " | grep --color=never -v "127.0.0.1" | awk '{print $2}') test -n "$ip" && printf $1 $ip } @@ -420,12 +414,25 @@ __my_prompt_function(){ # used by PS1 __my_battery_status %s >$bst & fi # local battery=$(battery-state [%s] | sed -e 's`%`%%`g') # very slow + + __my_set_title + printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}${battery}${ip}\n" printf "${c2}${USER}@${HOSTNAME}${cdef} ${date}\n" printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " +} + +__my_set_title(){ TERMTITLE="${USER}@${HOSTNAME} ${PWD}" - test -n "$DISPLAY" && test -z "$EMACS" && echo -n -e "\033]0;${TERMTITLE}\007" + case $TERM in + rxvt*|xterm*|aterm) + test -t 1 && + test -n "$DISPLAY" && + test -z "$EMACS" && + echo -n -e "\033]0;${TERMTITLE}\007" + ;; + esac } # from https://wiki.archlinux.org/index.php/X_resources diff --git a/emacs.el b/emacs.el index ba80136..6614580 100644 --- a/emacs.el +++ b/emacs.el @@ -31,9 +31,14 @@ (defun set-terminal-title (&rest args) "" (interactive "sString to set as title: ") - (send-string-to-terminal (apply 'concat - "\033]0;" - `(,@args "\007")))) + (let ((tty (or (frame-parameter nil + 'tty-type) + ""))) + (when (eq t (compare-strings "xterm" 0 5 tty 0 5)) + (send-string-to-terminal (apply 'concat + "\033]0;" + `(,@args "\007")))))) + (defun my-set-terminal-title () "" (set-terminal-title "[" @@ -44,16 +49,14 @@ (symbol-name system-type) "] " (abbreviate-file-name default-directory))) -(and (getenv "DISPLAY") - (not window-system) - (defvar old-directory default-directory) - (add-hook 'post-command-hook - (lambda () - (unless (eq old-directory default-directory) - (setq old-directory default-directory) - (my-set-terminal-title)))) - (add-hook 'suspend-resume-hook - 'my-set-terminal-title)) +(defvar previous-directory default-directory) +(add-hook 'post-command-hook + (lambda () + (unless (eq previous-directory default-directory) + (setq previous-directory default-directory) + (my-set-terminal-title)))) +(add-hook 'suspend-resume-hook + 'my-set-terminal-title) (defun buffer-list-not-start-with-space () (let ((bl (buffer-list)) From 05011ea8f04b57a025caec5d49fee11a60c6b709 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 26 Mar 2012 17:05:43 +0900 Subject: [PATCH 129/269] update face prefs, add make-frame-command-with-name --- emacs.el | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/emacs.el b/emacs.el index 6614580..a6bdf64 100644 --- a/emacs.el +++ b/emacs.el @@ -10,7 +10,7 @@ (make-directory (expand-file-name "~/.emacs.d/lisp"))) (add-to-list 'load-path "~/.emacs.d/lisp") -(require 'cl) +(require 'cl nil t) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; start and quit @@ -48,7 +48,7 @@ " " (symbol-name system-type) "] " - (abbreviate-file-name default-directory))) + (abbreviate-file-name (or buffer-file-name default-directory)))) (defvar previous-directory default-directory) (add-hook 'post-command-hook (lambda () @@ -235,12 +235,6 @@ Man-mode)) (standard-display-ascii ?\n "$\n") -(set-face-foreground (copy-face 'default - 'my-eol-face) - "green") -;; (defface my-eol-face -;; '((t (:foreground "green"))) -;; "eol.") (standard-display-ascii ?\f "---------------------------------------------------------------------------------------^L") (defface my-pagebreak-face @@ -248,7 +242,7 @@ "pagebreak.") (defvar my-eol-face - '(("\n" . (0 my-eol-face t nil))) + '(("\n" . (0 font-lock-comment-face t nil))) ) (defvar my-pagebreak-face '(("\f" . 'my-pagebreak-face))) @@ -256,13 +250,7 @@ '(("\t" . '(0 highlight t nil)) (" " . '(0 highlight t nil)))) -;; (defvar my-face -;; '(("\t" . 'highlight) -;; (" " . 'highlight) -;; ("\n" . '(0 my-eol-face t nil)) -;; ("\f" . 'my-pagebreak-face))) - -;; 現在行をハイライト +;; highlight current line ;; http://wiki.riywo.com/index.php?Meadow (defface hlline-face '((((type x w32) @@ -287,7 +275,7 @@ (add-hook 'font-lock-mode-hook (lambda () - ;; (font-lock-add-keywords nil my-eol-face) + (font-lock-add-keywords nil my-eol-face) ;; (font-lock-add-keywords nil my-highlight-face) )) @@ -453,7 +441,6 @@ (global-set-key (kbd "C-k") 'kill-whole-line) (global-set-key (kbd "M-k") 'my-copy-whole-line) ;; (global-set-key "\C-z" 'undo) ; undo is C-/ -;; (global-set-key (kbd "C-") (lambda () (interactive) (insert "\f\n"))) (global-set-key (kbd "M-u") 'undo) (global-set-key (kbd "C-r") 'query-replace-regexp) (global-set-key (kbd "C-s") 'isearch-forward-regexp) @@ -762,12 +749,20 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; frame buffer +;; todo: work well when opening the file that was already opened on another window (add-hook 'after-make-frame-functions - (lambda (frame) - (set-window-buffer (frame-selected-window frame) + (lambda (f) + (set-window-buffer (frame-selected-window f) "*Messages*"))) +(defun make-frame-command-with-name (name) + "Make frame with name specified." + (interactive "sName for new frame: ") + (set-frame-parameter (make-frame-command) + 'name + name)) + (defvar my-frame-buffer-plist nil) (defun my-frame-buffer-add (&optional buf frame) @@ -852,7 +847,7 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (delete-frame))) (define-key my-prefix-map (kbd "C-s") 'my-execute-terminal) -(define-key my-prefix-map (kbd "C-f") 'make-frame-command) +(define-key my-prefix-map (kbd "C-f") 'make-frame-command-with-name) (global-set-key (kbd "C-x C-c") 'my-delete-frame-or-kill-emacs) (define-key my-prefix-map (kbd "C-x C-c") 'save-buffers-kill-emacs) From 284feb5b90c32b5b89359b3dd6e0186702a0ef13 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 26 Mar 2012 21:00:55 +0900 Subject: [PATCH 130/269] add buffer-file-changed-function, remove unused code --- emacs.el | 79 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 34 deletions(-) diff --git a/emacs.el b/emacs.el index a6bdf64..c81df45 100644 --- a/emacs.el +++ b/emacs.el @@ -12,6 +12,29 @@ (require 'cl nil t) +(progn ; hook run when directory changed + (defvar buffer-file-changed-function nil "Hook run when buffer file changed. +Each function is called with two args, the file before changing and after changing.") + (declare-function run-buffer-file-change-function "emacs.el") + (add-hook 'post-command-hook + 'run-buffer-file-changed-function) + (lexical-let (previous-file) + (defun run-buffer-file-changed-function () + "" + (unless (and previous-file + (equal previous-file + (expand-file-name (or buffer-file-name + default-directory)))) + (let ((pfile previous-file) + (cfile (expand-file-name (or buffer-file-name + default-directory)))) + (setq previous-file cfile) + (run-hook-with-args 'directory-changed-function pfile cfile))))) + ;; (add-hook 'directory-changed-function + ;; (lambda (pdir cdir) + ;; (message "dir changed %s to %s !" pdir cdir))) + ) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; start and quit @@ -31,10 +54,11 @@ (defun set-terminal-title (&rest args) "" (interactive "sString to set as title: ") - (let ((tty (or (frame-parameter nil - 'tty-type) - ""))) - (when (eq t (compare-strings "xterm" 0 5 tty 0 5)) + (let ((tty (frame-parameter nil + 'tty-type))) + (when (and tty + (eq t (compare-strings "xterm" 0 5 + tty 0 5))) (send-string-to-terminal (apply 'concat "\033]0;" `(,@args "\007")))))) @@ -49,12 +73,9 @@ (symbol-name system-type) "] " (abbreviate-file-name (or buffer-file-name default-directory)))) -(defvar previous-directory default-directory) -(add-hook 'post-command-hook - (lambda () - (unless (eq previous-directory default-directory) - (setq previous-directory default-directory) - (my-set-terminal-title)))) +(add-hook 'directory-changed-function + (lambda (p c) + (my-set-terminal-title))) (add-hook 'suspend-resume-hook 'my-set-terminal-title) @@ -196,19 +217,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; letters, font-lock mode and fonts -;; change color for border -;; (set-face-foreground (make-face 'vertical-border-face) "white") -;; (set-face-background 'vertical-border-face "black") -;; (defface vertical-border-face -;; `((((background dark)) -;; (:background "white")) -;; (((background light)) -;; (:background "black"))) -;; "vertical border") -;; (set-display-table-slot standard-display-table 'vertical-border -;; (make-glyph-code #x3a 'vertical-border-face)) -;; (set-face-foreground 'vertical-border "default") -;; (set-face-background 'vertical-border "white") +(set-face-background 'vertical-border (face-foreground 'mode-line)) (when (eq system-type 'Darwin) (mac-set-input-method-parameter 'japanese 'cursor-color "red") @@ -317,25 +326,27 @@ ;; (my-set-ascii-and-jp-font-with-size '("ProggyCleanTTSZ" 120 "takaogothic" 11)) ;; あ a -(defun my-set-mode-line-color-according-to-readonly-state () +;; inspired by http://www.emacswiki.org/emacs-en/ChangingCursorDynamically + +(defun my-set-modeline-color-according-to-write-mode () "" (let ((state (if buffer-read-only 'readonly (if overwrite-mode 'overwrite 'insert)))) - (unless (eq state my-set-mode-line-color-state) + (unless (eq state my-set-modeline-color-state) (set-face-foreground 'modeline (nth 1 (assq state - my-set-mode-line-color-color))) + my-set-modeline-color-color))) (set-face-background 'modeline (nth 2 (assq state - my-set-mode-line-color-color))) - (setq my-set-mode-line-color-state state)))) -(defvar my-set-mode-line-color-color nil "") -(setq my-set-mode-line-color-color + my-set-modeline-color-color))) + (setq my-set-modeline-color-state state)))) +(defvar my-set-modeline-color-color nil "") +(setq my-set-modeline-color-color (if window-system `((readonly "white" "blue") (overwrite "white" "red") @@ -343,12 +354,12 @@ `((readonly "blue" "white") (overwrite "red" "white") (insert ,(face-foreground 'modeline) ,(face-background 'modeline))))) -(defvar my-set-mode-line-color-state nil "") -(add-hook 'post-command-hook 'my-set-mode-line-color-according-to-readonly-state) -(add-hook 'after-init-hook 'my-set-mode-line-color-according-to-readonly-state) +(defvar my-set-modeline-color-state nil "") +(add-hook 'post-command-hook 'my-set-modeline-color-according-to-write-mode) +(add-hook 'after-init-hook 'my-set-modeline-color-according-to-write-mode) ;; (set-face-foreground 'mode-line-inactive (if window-system "gray" "white")) -;; (set-face-background 'mode-line-inactive (if window-system "white" "gray")) +(set-face-background 'mode-line-inactive (if window-system "white" "green")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; file handling From 577f9c0bfa3c5065d9890747745a71306a45bd24 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 31 Mar 2012 16:15:03 +0900 Subject: [PATCH 131/269] make some libraries and remove functions used by them --- emacs.el | 469 +++++++++++++++++++++++++------------------------------ 1 file changed, 209 insertions(+), 260 deletions(-) diff --git a/emacs.el b/emacs.el index c81df45..8478091 100644 --- a/emacs.el +++ b/emacs.el @@ -14,7 +14,7 @@ (progn ; hook run when directory changed (defvar buffer-file-changed-function nil "Hook run when buffer file changed. -Each function is called with two args, the file before changing and after changing.") +Each function is called with two args, the filename before changing and after changing.") (declare-function run-buffer-file-change-function "emacs.el") (add-hook 'post-command-hook 'run-buffer-file-changed-function) @@ -35,6 +35,32 @@ Each function is called with two args, the file before changing and after changi ;; (message "dir changed %s to %s !" pdir cdir))) ) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; download library from web + +(require 'url) + +(defun dllib-if-unfound (lib url &optional bite-compile-p force-download-p) + "if LIB does not exist, download it from URL and locate it to \"~/emacs.d/lisp/LIB.el\". +return nil if LIB unfound and downloading failed, otherwise the path of LIB." + (let* ((dir (expand-file-name (concat user-emacs-directory "lisp/"))) + (lpath (concat dir lib ".el")) + (locate-p (locate-library lib))) + (if (or force-download-p (not locate-p)) + (progn (condition-case nil + (progn (message "downloading %s..." url) + (url-copy-file url + lpath + t) + (when bite-compile-p + (byte-compile-file lpath))) + (error (and (file-readable-p lpath) + (delete-file lpath)) + (message "downloading %s...something wrong happened!" url) + nil)) + (locate-library lib)) + locate-p))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; start and quit @@ -131,12 +157,6 @@ Each function is called with two args, the file before changing and after changi (define-key my-prefix-map (kbd "C-q") 'quoted-insert) (define-key my-prefix-map (kbd "C-z") 'suspend-frame) - -;; display -(setq redisplay-dont-pause t) -(setq visible-bell t) -(setq ring-bell-function 'ignore) - ;; (comint-show-maximum-output) ;; kill scratch @@ -148,6 +168,43 @@ Each function is called with two args, the file before changing and after changi (setq mac-option-modifier 'control) (setq w32-apps-modifier 'meta) +;; display +(setq redisplay-dont-pause t) +(setq visible-bell t) +(setq ring-bell-function 'ignore) +(mouse-avoidance-mode 'banish) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; global keys + +(define-key my-prefix-map (kbd "C-o") 'occur) + +;; (define-key my-prefix-map (kbd "C-h") help-map) +(global-set-key (kbd "C-\\") help-map) +(define-key ctl-x-map (kbd "DEL") help-map) +(define-key ctl-x-map (kbd "C-h") help-map) +(define-key help-map "a" 'apropos) + +;; compose window +(global-set-key [?\C--] 'other-window) +(global-set-key [?\C-0] 'delete-window) +(global-set-key [?\C-1] 'delete-other-windows) +(global-set-key [?\C-2] 'split-window-vertically) +(global-set-key [?\C-3] 'split-window-horizontally) + +;; disable annoying keys +(global-set-key [prior] 'ignore) +(global-set-key (kbd "") 'ignore) +(global-set-key [menu] 'ignore) +(global-set-key [down-mouse-1] 'ignore) +(global-set-key [down-mouse-2] 'ignore) +(global-set-key [down-mouse-3] 'ignore) +(global-set-key [mouse-1] 'ignore) +(global-set-key [mouse-2] 'ignore) +(global-set-key [mouse-3] 'ignore) +(global-set-key (kbd "") 'ignore) +(global-set-key (kbd "C-") 'ignore) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; mode-line @@ -217,7 +274,7 @@ Each function is called with two args, the file before changing and after changi ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; letters, font-lock mode and fonts -(set-face-background 'vertical-border (face-foreground 'mode-line)) +;; (set-face-background 'vertical-border (face-foreground 'mode-line)) (when (eq system-type 'Darwin) (mac-set-input-method-parameter 'japanese 'cursor-color "red") @@ -326,37 +383,10 @@ Each function is called with two args, the file before changing and after changi ;; (my-set-ascii-and-jp-font-with-size '("ProggyCleanTTSZ" 120 "takaogothic" 11)) ;; あ a -;; inspired by http://www.emacswiki.org/emacs-en/ChangingCursorDynamically - -(defun my-set-modeline-color-according-to-write-mode () - "" - (let ((state (if buffer-read-only - 'readonly - (if overwrite-mode - 'overwrite - 'insert)))) - (unless (eq state my-set-modeline-color-state) - (set-face-foreground 'modeline - (nth 1 - (assq state - my-set-modeline-color-color))) - (set-face-background 'modeline - (nth 2 - (assq state - my-set-modeline-color-color))) - (setq my-set-modeline-color-state state)))) -(defvar my-set-modeline-color-color nil "") -(setq my-set-modeline-color-color - (if window-system - `((readonly "white" "blue") - (overwrite "white" "red") - (insert ,(face-foreground 'modeline) ,(face-background 'modeline))) - `((readonly "blue" "white") - (overwrite "red" "white") - (insert ,(face-foreground 'modeline) ,(face-background 'modeline))))) -(defvar my-set-modeline-color-state nil "") -(add-hook 'post-command-hook 'my-set-modeline-color-according-to-write-mode) -(add-hook 'after-init-hook 'my-set-modeline-color-according-to-write-mode) +(and (dllib-if-unfound "set-modeline-color" + "https://raw.github.com/10sr/emacs-lisp/master/set-modeline-color.el" + t) + (require 'set-modeline-color nil t)) ;; (set-face-foreground 'mode-line-inactive (if window-system "gray" "white")) (set-face-background 'mode-line-inactive (if window-system "white" "green")) @@ -388,7 +418,6 @@ Each function is called with two args, the file before changing and after changi ;; (setq delete-by-moving-to-trash t ;; trash-directory "~/.emacs.d/trash") -;; その他のhook (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p) @@ -404,7 +433,7 @@ Each function is called with two args, the file before changing and after changi (setq kill-read-only-ok t) (setq truncate-partial-width-windows nil) ; when splitted horizontally ;; (setq-default line-spacing 0.2) -(setq-default indicate-empty-lines t) ; なんだろうこれ +(setq-default indicate-empty-lines t) ; when using x indicate empty line (setq-default tab-width 4) (setq-default indent-tabs-mode nil) (setq-default indent-line-function nil) @@ -455,12 +484,7 @@ Each function is called with two args, the file before changing and after changi (global-set-key (kbd "M-u") 'undo) (global-set-key (kbd "C-r") 'query-replace-regexp) (global-set-key (kbd "C-s") 'isearch-forward-regexp) -(global-set-key (kbd "M-i") - (lambda () - (interactive) - (call-interactively (key-binding (kbd "M-TAB")))) - ;; (kbd "M-TAB") - ) +(global-set-key (kbd "M-i") (kbd "ESC TAB")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; gmail @@ -485,70 +509,6 @@ Each function is called with two args, the file before changing and after changi (substitute-key-definition 'kill-buffer 'my-query-kill-this-buffer global-map) ;;(global-set-key "\C-xk" 'my-query-kill-this-buffer) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; for emacsclient -;; (if window-system (server-start)) - - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; global keys - -(define-key my-prefix-map (kbd "C-o") 'occur) - -;; (define-key my-prefix-map (kbd "C-h") help-map) -(global-set-key (kbd "C-\\") help-map) -(define-key ctl-x-map (kbd "DEL") help-map) -(define-key ctl-x-map (kbd "C-h") help-map) -(define-key help-map "a" 'apropos) - -;; compose window -(global-set-key [?\C--] 'other-window) -(global-set-key [?\C-0] 'delete-window) -(global-set-key [?\C-1] 'delete-other-windows) -(global-set-key [?\C-2] 'split-window-vertically) -(global-set-key [?\C-3] 'split-window-horizontally) - -;; disable annoying keys -(global-set-key [prior] 'ignore) -(global-set-key (kbd "") 'ignore) -(global-set-key [menu] 'ignore) -(global-set-key [down-mouse-1] 'ignore) -(global-set-key [down-mouse-2] 'ignore) -(global-set-key [down-mouse-3] 'ignore) -(global-set-key [mouse-1] 'ignore) -(global-set-key [mouse-2] 'ignore) -(global-set-key [mouse-3] 'ignore) -(global-set-key (kbd "") 'ignore) -(global-set-key (kbd "C-") 'ignore) - -(mouse-avoidance-mode 'banish) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; download library from web - -(require 'url) - -(defun dllib-if-unfound (lib url &optional bite-compile-p force-download-p) ; new version - "if LIB does not exist, download it from URL and locate it to \"~/emacs.d/lisp/LIB.el\". -return nil if LIB unfound and downloading failed, otherwise the path of LIB." - (let* ((dir (expand-file-name (concat user-emacs-directory "lisp/"))) - (lpath (concat dir lib ".el")) - (locate-p (locate-library lib))) - (if (or force-download-p (not locate-p)) - (progn (condition-case nil - (progn (message "downloading %s..." url) - (url-copy-file url - lpath - t) - (when bite-compile-p - (byte-compile-file lpath))) - (error (and (file-readable-p lpath) - (delete-file lpath)) - (message "downloading %s...something wrong happened!" url) - nil)) - (locate-library lib)) - locate-p))) '(setq package-archives '(("ELPA" . "http://tromey.com/elpa/") ("gnu" . "http://elpa.gnu.org/packages/") @@ -758,110 +718,6 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (require 'gtkbm nil t) (global-set-key (kbd "C-x C-d") 'gtkbm)) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; frame buffer -;; todo: work well when opening the file that was already opened on another window - -(add-hook 'after-make-frame-functions - (lambda (f) - (set-window-buffer (frame-selected-window f) - "*Messages*"))) - -(defun make-frame-command-with-name (name) - "Make frame with name specified." - (interactive "sName for new frame: ") - (set-frame-parameter (make-frame-command) - 'name - name)) - -(defvar my-frame-buffer-plist nil) - -(defun my-frame-buffer-add (&optional buf frame) - "" - (setq my-frame-buffer-plist - (plist-put my-frame-buffer-plist - (or frame - (selected-frame)) - (let ((lst (my-frame-buffer-get frame))) - (if lst - (add-to-list 'lst - (or buf - (current-buffer))) - (list (or buf - (current-buffer)))))))) - -(defun my-frame-buffer-remove (&optional buf frame) - "" - (setq my-frame-buffer-plist - (plist-put my-frame-buffer-plist - (or frame - (selected-frame)) - (delq (or buf - (current-buffer)) - (my-frame-buffer-get frame))))) - -(defun my-frame-buffer-get (&optional frame) - "" - (plist-get my-frame-buffer-plist - (or frame - (selected-frame)))) - -(defun my-frame-buffer-kill-all-buffer (&optional frame) - "" - (mapcar 'kill-buffer - (my-frame-buffer-get frame))) - -(add-hook 'find-file-hook - 'my-frame-buffer-add) -(add-hook 'term-mode-hook - 'my-frame-buffer-add) -(add-hook 'eshell-mode-hook - 'my-frame-buffer-add) -(add-hook 'Man-mode-hook - 'my-frame-buffer-add) - -(add-hook 'kill-buffer-hook - 'my-frame-buffer-remove) -(add-hook 'delete-frame-functions - 'my-frame-buffer-kill-all-buffer) - - -(defvar my-desktop-terminal "roxterm") -(defun my-execute-terminal () - "" - (interactive) - (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 - my-desktop-terminal)) - (my-term))) - -(defun my-term () - "open terminal buffer and return that buffer." - (interactive) - (if (eq system-type 'windows-nt) - (eshell t) - (if (featurep 'multi-term) - (multi-term) - (ansi-term "/bin/bash")))) - -(defun my-delete-frame-or-kill-emacs () - "delete frame when opening multiple frame, kill emacs when only one." - (interactive) - (if (eq 1 - (length (frame-list))) - (save-buffers-kill-emacs) - (delete-frame))) - -(define-key my-prefix-map (kbd "C-s") 'my-execute-terminal) -(define-key my-prefix-map (kbd "C-f") 'make-frame-command-with-name) -(global-set-key (kbd "C-x C-c") 'my-delete-frame-or-kill-emacs) -(define-key my-prefix-map (kbd "C-x C-c") 'save-buffers-kill-emacs) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; term mode @@ -1049,8 +905,8 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; recentf-mode -(add-hook 'recentf-dialog-mode-hook - 'my-recentf-abbrev-list) +;; (add-hook 'recentf-dialog-mode-hook +;; 'my-recentf-abbrev-list) (defun my-recentf-delete-entry () "" @@ -1117,7 +973,7 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ;; (lambda () ;; (recentf-add-file default-directory))) (recentf-mode 1) - (add-to-list 'recentf-filename-handlers 'abbreviate-file-name) + ;; (add-to-list 'recentf-filename-handlers 'abbreviate-file-name) (add-to-list 'recentf-exclude (rx-to-string recentf-save-file))) (add-hook 'recentf-dialog-mode-hook @@ -1254,32 +1110,6 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ) (setq dired-listing-switches "-lhFG") -(define-minor-mode my-dired-display-all-mode - "" - :init-value nil - :global nil - :lighter " ALL" - (when (eq major-mode 'dired-mode) - (my-dired-display-all-set) - (revert-buffer))) -(defun my-dired-display-all-set () - "" - (if my-dired-display-all-mode - (or (string-match-p my-dired-display-all-switch - dired-actual-switches) - (setq dired-actual-switches - (concat my-dired-display-all-switch - " " - dired-actual-switches))) - (setq dired-actual-switches - (replace-regexp-in-string (concat my-dired-display-all-switch - " ") - "" - dired-actual-switches)))) -(defvar my-dired-display-all-switch "-A") -(add-hook 'dired-mode-hook - 'my-dired-display-all-set) - (put 'dired-find-alternate-file 'disabled nil) ; when using dired-find-alternate-file reuse current dired buffer for the file to open (setq dired-ls-F-marks-symlinks t) @@ -1315,7 +1145,6 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (define-key dired-mode-map "@" (lambda () (interactive) (my-x-open "."))) (define-key dired-mode-map (kbd "TAB") 'other-window) ;; (define-key dired-mode-map "P" 'my-dired-do-pack-or-unpack) - (define-key dired-mode-map "a" 'my-dired-display-all-mode) (define-key dired-mode-map "/" 'dired-isearch-filenames) (define-key dired-mode-map (kbd "DEL") 'dired-up-directory) (substitute-key-definition 'dired-next-line 'my-dired-next-line dired-mode-map) @@ -1334,6 +1163,17 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (lambda () (define-key dired-mode-map "P" 'dired-do-pack-or-unpack)))) +(and (dllib-if-unfound "dired-list-all-mode" + "https://raw.github.com/10sr/emacs-lisp/master/dired-list-all-mode.el" + t) + (require 'dired-list-all-mode nil t) + (setq dired-listing-switches "-lhFG") + (add-hook 'dired-mode-hook + (lambda () + (define-key dired-mode-map "a" 'dired-list-all-mode) + ))) + + ;; http://blog.livedoor.jp/tek_nishi/archives/4693204.html (defun my-dired-toggle-mark() @@ -1600,6 +1440,110 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." (add-hook 'after-revert-hook 'my-set-buffer-file-last-modified-time) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; frame buffer +;; todo: work well when opening the file that was already opened on another window + +(add-hook 'after-make-frame-functions + (lambda (f) + (set-window-buffer (frame-selected-window f) + "*Messages*"))) + +(defun make-frame-command-with-name (name) + "Make frame with name specified." + (interactive "sName for new frame: ") + (set-frame-parameter (make-frame-command) + 'name + name)) + +(defvar my-frame-buffer-plist nil) + +(defun my-frame-buffer-add (&optional buf frame) + "" + (setq my-frame-buffer-plist + (plist-put my-frame-buffer-plist + (or frame + (selected-frame)) + (let ((lst (my-frame-buffer-get frame))) + (if lst + (add-to-list 'lst + (or buf + (current-buffer))) + (list (or buf + (current-buffer)))))))) + +(defun my-frame-buffer-remove (&optional buf frame) + "" + (setq my-frame-buffer-plist + (plist-put my-frame-buffer-plist + (or frame + (selected-frame)) + (delq (or buf + (current-buffer)) + (my-frame-buffer-get frame))))) + +(defun my-frame-buffer-get (&optional frame) + "" + (plist-get my-frame-buffer-plist + (or frame + (selected-frame)))) + +(defun my-frame-buffer-kill-all-buffer (&optional frame) + "" + (mapcar 'kill-buffer + (my-frame-buffer-get frame))) + +(add-hook 'find-file-hook + 'my-frame-buffer-add) +(add-hook 'term-mode-hook + 'my-frame-buffer-add) +(add-hook 'eshell-mode-hook + 'my-frame-buffer-add) +(add-hook 'Man-mode-hook + 'my-frame-buffer-add) + +(add-hook 'kill-buffer-hook + 'my-frame-buffer-remove) +(add-hook 'delete-frame-functions + 'my-frame-buffer-kill-all-buffer) + + +(defvar my-desktop-terminal "roxterm") +(defun my-execute-terminal () + "" + (interactive) + (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 + my-desktop-terminal)) + (my-term))) + +(defun my-term () + "open terminal buffer and return that buffer." + (interactive) + (if (eq system-type 'windows-nt) + (eshell t) + (if (featurep 'multi-term) + (multi-term) + (ansi-term "/bin/bash")))) + +(defun my-delete-frame-or-kill-emacs () + "delete frame when opening multiple frame, kill emacs when only one." + (interactive) + (if (eq 1 + (length (frame-list))) + (save-buffers-kill-emacs) + (delete-frame))) + +(define-key my-prefix-map (kbd "C-s") 'my-execute-terminal) +(define-key my-prefix-map (kbd "C-f") 'make-frame-command-with-name) +(global-set-key (kbd "C-x C-c") 'my-delete-frame-or-kill-emacs) +(define-key my-prefix-map (kbd "C-x C-c") 'save-buffers-kill-emacs) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; auto saving @@ -1831,30 +1775,35 @@ this is test, does not rename files" (defun my-load-scim () "use scim-bridge.el as japanese im." ;; Load scim-bridge. - (require 'scim-bridge) - ;; Turn on scim-mode automatically after loading .emacs - (add-hook 'after-init-hook 'scim-mode-on) - (setq scim-cursor-color "red") - (scim-define-preedit-key ?\^h t) - (scim-define-common-key ?\* nil) - (scim-define-common-key ?\^/ nil)) + (when (require 'scim-bridge nil t) + ;; Turn on scim-mode automatically after loading .emacs + (add-hook 'after-init-hook 'scim-mode-on) + (setq scim-cursor-color "red") + (scim-define-preedit-key ?\^h t) + (scim-define-common-key ?\* nil) + (scim-define-common-key ?\^/ nil))) (defun my-load-anthy () "use anthy.el as japanese im." ;; anthy - (require 'anthy) - (global-set-key [muhenkan] (lambda () (interactive) (anthy-mode-off))) - (global-set-key [henkan] (lambda () (interactive) (anthy-mode-on))) - (when (>= emacs-major-version 23) - (setq anthy-accept-timeout 1))) + (when (require 'anthy nil t) + (global-set-key (kbd "") (lambda () (interactive) (anthy-mode-off))) + (global-set-key (kbd "") (lambda () (interactive) (anthy-mode-on))) + (when (>= emacs-major-version 23) + (setq anthy-accept-timeout 1)))) ;; quail ;; aproposs input-method for some information -(setq default-input-method "japanese") - +;; (setq default-input-method "japanese") +(defun my-load-mozc-el () + "" + (setq mozc-leim-title "[MZ]") + (when (require 'mozc nil t) + (setq defauit-input-method "japanese-mozc") + )) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; windows用設定 +;; for windows ;; (add-to-list 'exec-path "c:/Program Files/Gauche/bin/") From 07b12a4a6f32f18447af175a629f27a1fb9aff02 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 31 Mar 2012 16:15:16 +0900 Subject: [PATCH 132/269] misc changes --- bashrc | 6 ++++-- conkyrc | 21 +++++++++------------ conkyrc.2 | 4 ++-- xprograms | 2 +- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/bashrc b/bashrc index d6a9272..986a5b0 100755 --- a/bashrc +++ b/bashrc @@ -102,6 +102,7 @@ alias _reloadrc="test -f ~/.bashrc && source ~/.bashrc" alias mytime="date +%Y%m%d-%H%M%S" alias sh="ENV=$HOME/.shrc PS1=\$\ sh" # type trash >/dev/null 2>&1 && alias rm=trash +alias wicdc=wicd-curses alias aptin="apt-get install" alias aptsearch="apt-cache search" @@ -142,7 +143,7 @@ showinfo(){ __try_exec diskinfo ! isdarwin && test -n "${DISPLAY}" && { - __try_exec xrandr | grep --color=never ^Screen + __try_exec xrandr | \grep --color=never ^Screen } iswindows || __try_exec finger $USER @@ -250,6 +251,7 @@ _my_git_config(){ git config --global user.name '10sr' git config --global user.email '8slashes+git@gmail.com' git config --global core.autocrlf false + git config --global core.excludesfile '~/.gitignore' git config --global color.ui auto git config --global status.relativePaths false git config --global status.showUntrackedFiles normal @@ -373,7 +375,7 @@ __my_battery_status(){ alias bat='__my_battery_status %s\\n' ip-address(){ - local ip=$(LANG=C ifconfig | grep --color=never "inet " | grep --color=never -v "127.0.0.1" | awk '{print $2}') + local ip=$(LANG=C ifconfig | \grep --color=never "inet " | \grep --color=never -v "127.0.0.1" | awk '{print $2}') test -n "$ip" && printf $1 $ip } diff --git a/conkyrc b/conkyrc index 8765694..3a5b0ff 100644 --- a/conkyrc +++ b/conkyrc @@ -30,9 +30,11 @@ gap_y 40 default_color green # slategrey default_shade_color lightgrey default_outline_color black -color0 white -color1 white -color2 green +color0 white # value +color1 white # vertical border +color2 green # name +color3 yellow # displays +color4 888888 # border of netspeed graph no_buffers yes uppercase no @@ -42,16 +44,12 @@ TEXT ${color0}${alignr}${sysname} ${kernel} (${machine}) ${color0}${alignr}${execi 30000 whoami}@${nodename} ${color0}${hr} -#${color2}host ${color1}|${color0} ${nodename} ${color2}uptm ${color1}|${color0} ${uptime} ${color2}lgin ${color1}|${color0} ${uptime} -#${color2}os ${color1}|${color0} ${sysname} ${kernel} ${color0}${stippled_hr} ${color2}cpu ${color1}|${color0} ${cpu}% ${cpubar} ${color2}freq ${color1}|${color0} ${freq 1}Mhz | ${freq 2}Mhz ${color2}temp ${color1}|${color0} ${acpitemp} °C -#${color2}btry ${color1}|${color0} ${battery} -#${color2}btime${color1}|${color0} ${battery_time} ${color0}${hr} ${color2}ram ${color1}|${color0} ${mem} ${membar} ${color2}swap ${color1}|${color0} ${if_match "${swapperc}" == "No swap"}None${else}${swap} ${swapbar}${endif} @@ -66,10 +64,9 @@ ${color2}if ${color1}|${color0} ${gw_iface}:${addr} ${color2}ssid ${color1}|${color0} ${wireless_essid} ${color0}${stippled_hr} ${color2}down ${color1}|${color0} ${downspeed}/s -${color #888888}${downspeedgraph ff0000 0000ff} +${color4}${downspeedgraph ff0000 0000ff} ${color2}up ${color1}|${color0} ${upspeed}/s -${color #888888}${upspeedgraph 0000ff ff0000} +${color4}${upspeedgraph 0000ff ff0000} +${color0}${alignr}conky ${conky_version} ${color0}${hr} -${alignr}conky ${conky_version} -# on Page${desktop} -#${color0}${alignr}${execi 900 cal -1} +${color3}${alignr}${texeci 10 bash -c 'xrandr|\grep " connected "|cut -f 1,3 -d " "'} diff --git a/conkyrc.2 b/conkyrc.2 index ad04bef..75e69c8 100644 --- a/conkyrc.2 +++ b/conkyrc.2 @@ -35,6 +35,6 @@ uppercase no format_human_readable yes TEXT -${color yellow}$$ tail -f -n 12 /var/log/everything.log -${color white}${tail /var/log/everything.log 12} +${color yellow}$$ tail -f -n 10 /var/log/everything.log +${color white}${tail /var/log/everything.log 10} ${time %b %d %T} diff --git a/xprograms b/xprograms index 056d3bf..5228d2b 100755 --- a/xprograms +++ b/xprograms @@ -9,7 +9,7 @@ sh "$HOME/.fehbg" tint2 & -#dropboxd & # done by ~/.config/autostart/dropbox.desktop +dropboxd & # done by ~/.config/autostart/dropbox.desktop volumeicon & From e2a722be0c129554ab26957743feff2aad592ede Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 3 Apr 2012 17:47:15 +0900 Subject: [PATCH 133/269] update xinitrc --- xinitrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xinitrc b/xinitrc index 6d91ea3..27d5a11 100644 --- a/xinitrc +++ b/xinitrc @@ -1,4 +1,6 @@ +test "`hostname`" == "arch-aspireone" && setxkbmap -model "acer_laptop" -layout "jp" -option "ctrl:nocaps" # this line must comes first + xmodmap -e 'keycode 135 = Alt_R Meta_R' # menu key as alt xmodmap -e 'keycode 101 = Alt_R Meta_R' # hiragana key as alt #xmodmap -e 'remove Lock = Caps_Lock' From 8ca20f4aa59229d870e510226648ce16312c6c78 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 4 Apr 2012 00:05:24 +0900 Subject: [PATCH 134/269] disable two finger scroll of touchpad --- xinitrc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xinitrc b/xinitrc index 27d5a11..b4bc9ab 100644 --- a/xinitrc +++ b/xinitrc @@ -1,6 +1,7 @@ test "`hostname`" == "arch-aspireone" && -setxkbmap -model "acer_laptop" -layout "jp" -option "ctrl:nocaps" # this line must comes first +setxkbmap -model "acer_laptop" -layout "jp" # this line must comes first +setxkbmap -option "ctrl:nocaps" xmodmap -e 'keycode 135 = Alt_R Meta_R' # menu key as alt xmodmap -e 'keycode 101 = Alt_R Meta_R' # hiragana key as alt #xmodmap -e 'remove Lock = Caps_Lock' @@ -9,9 +10,12 @@ xmodmap -e 'keycode 101 = Alt_R Meta_R' # hiragana key as alt type synclient >/dev/null 2>&1 && { synclient VertEdgeScroll=0 synclient HorizEdgeScroll=0 - synclient MaxTapTime=0 + synclient MaxTapTime=0 # disable tap synclient MaxSpeed=2.0 synclient MinSpeed=0.2 + synclient VertTwoFingerScroll=0 + synclient HorizTwoFingerScroll=0 + } xset s 1800 # go blank after 30 min From 9d5cb1adc69eb6acd84d0cd094b9e183825530d8 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 4 Apr 2012 00:05:39 +0900 Subject: [PATCH 135/269] misc changes --- bashrc | 31 ++++++++++++++++++++++--------- conkyrc | 6 +++--- conkyrc.2 | 2 +- profile | 2 +- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/bashrc b/bashrc index 986a5b0..8fae15a 100755 --- a/bashrc +++ b/bashrc @@ -41,7 +41,7 @@ else export EDITOR=vi fi export LC_MESSAGES=C -export CDPATH=".:~" +# export CDPATH=".:~" export VISUAL="$EDITOR" export GIT_PAGER="$PAGER" export GIT_EDITOR="$EDITOR" @@ -87,11 +87,13 @@ alias q=exit alias p="$PAGER" alias c=cat 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 halt="sudo halt" alias reboot="sudo reboot" alias rand="echo \$RANDOM" -# alias apt-get="sudo apt-get" alias ut="ssh 6365454829@un001.ecc.u-tokyo.ac.jp" alias xunp="file-roller -h" # alias pacome="sudo \paco -D" @@ -99,7 +101,7 @@ alias pcalc="python -i -c 'from math import *' " alias py3=python3 alias py2=python2 alias _reloadrc="test -f ~/.bashrc && source ~/.bashrc" -alias mytime="date +%Y%m%d-%H%M%S" +# alias mytime="date +%Y%m%d-%H%M%S" alias sh="ENV=$HOME/.shrc PS1=\$\ sh" # type trash >/dev/null 2>&1 && alias rm=trash alias wicdc=wicd-curses @@ -115,8 +117,8 @@ null type pacman-color && { export PACMAN=pacman-color # used by yaourt } null type pacmatic && { - alias pacman="pacmatic" - export PACMAN="pacmatic" + alias pacman="env pacman_program=${pacman_program} pacmatic" + export PACMAN="env pacman_program=${pacman_program} pacmatic" } alias ubuntu-upgrade="sudo apt-get autoremove --yes && sudo apt-get update --yes && sudo apt-get upgrade --yes" @@ -166,6 +168,7 @@ bak(){ cp -v ${file} ${file}.bak done } + di(){ if type colordiff >/dev/null 2>&1 && test $TERM != dumb then @@ -175,6 +178,7 @@ di(){ fi ${diffcmd} -u "$@" | ${PAGER} } + throw-away(){ mkdir -p ~/.backup/tb for file in "$@" @@ -182,10 +186,12 @@ throw-away(){ mv $file ~/.backup/tb done } + mkcd(){ mkdir -p $1 cd $1 } + catclip(){ if iswindows then @@ -194,6 +200,7 @@ catclip(){ xclip -o -selection "clipboard" fi } + setclip(){ if iswindows then @@ -212,6 +219,7 @@ setclip(){ fi fi } + if iswindows; then alias _open_file='cmd.exe //c start ""' elif isdarwin; then @@ -225,6 +233,7 @@ elif islinux; then else alias _open_file=cat fi + o(){ if test $# -eq 0 then @@ -241,12 +250,15 @@ o(){ done fi } + convmv-sjis2utf8-test(){ convmv -r -f sjis -t utf8 * } + convmv-sjis2utf8-notest(){ convmv -r -f sjis -t utf8 * --notest } + _my_git_config(){ git config --global user.name '10sr' git config --global user.email '8slashes+git@gmail.com' @@ -407,6 +419,7 @@ __my_prompt_function(){ # used by PS1 local git=$(__try_exec __git_ps1 [GIT:%s]) local date=$(LANG=C __try_exec date +"%a, %d %b %Y %T %z") fi + local dirs=$(dirs | wc -l) # local svn=$(type svn >/dev/null 2>&1 && __try_exec __my_svn_ps1 [SVN:%s]) if test -z "$DISPLAY" then @@ -417,22 +430,22 @@ __my_prompt_function(){ # used by PS1 fi # local battery=$(battery-state [%s] | sed -e 's`%`%%`g') # very slow - __my_set_title + # __my_set_title ${USER}@${HOSTNAME} ${PWD} printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}${battery}${ip}\n" printf "${c2}${USER}@${HOSTNAME}${cdef} ${date}\n" - printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " + printf "shlv:${SHLVL} jobs:${jobnum} dirs:${dirs} last:${lastreturn} " } __my_set_title(){ - TERMTITLE="${USER}@${HOSTNAME} ${PWD}" + title="$(echo $@)" case $TERM in rxvt*|xterm*|aterm) test -t 1 && test -n "$DISPLAY" && test -z "$EMACS" && - echo -n -e "\033]0;${TERMTITLE}\007" + echo -n -e "\033]0;${title}\007" ;; esac } diff --git a/conkyrc b/conkyrc index 3a5b0ff..1464774 100644 --- a/conkyrc +++ b/conkyrc @@ -12,7 +12,7 @@ update_interval 1.0 total_run_times 0 own_window yes -own_window_type override +own_window_type desktop own_window_transparent yes own_window_colour hotpink own_window_hints undecorated,below,skip_taskbar,sticky,skip_pager @@ -33,7 +33,7 @@ default_outline_color black color0 white # value color1 white # vertical border color2 green # name -color3 yellow # displays +color3 gray # displays color4 888888 # border of netspeed graph no_buffers yes @@ -69,4 +69,4 @@ ${color2}up ${color1}|${color0} ${upspeed}/s ${color4}${upspeedgraph 0000ff ff0000} ${color0}${alignr}conky ${conky_version} ${color0}${hr} -${color3}${alignr}${texeci 10 bash -c 'xrandr|\grep " connected "|cut -f 1,3 -d " "'} +${color3}${alignr}${texeci 10 bash -c 'xrandr|grep " connected "|cut -f 1,3 -d " "'} diff --git a/conkyrc.2 b/conkyrc.2 index 75e69c8..533239c 100644 --- a/conkyrc.2 +++ b/conkyrc.2 @@ -12,7 +12,7 @@ update_interval 1.0 total_run_times 0 own_window yes -own_window_type override +own_window_type desktop own_window_transparent yes own_window_colour hotpink own_window_hints undecorated,below,skip_taskbar,sticky,skip_pager diff --git a/profile b/profile index e3537ce..7ef445d 100755 --- a/profile +++ b/profile @@ -17,7 +17,7 @@ export ENV=~/.shrc # export TMP=/tmp # export TEMP=/tmp test -f "${HOME}/.pythonrc" && export PYTHONSTARTUP="${HOME}/.pythonrc" -export PYTHONPATH=~/.py +export PYTHONPATH="~/.local/share/lib/python3.2/site-packages" addtopath(){ for p in "$@" From 42cfcdf82fc27a3b17d40dc53fbb347203a803e5 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 4 Apr 2012 22:34:00 +0900 Subject: [PATCH 136/269] fix time format prefs --- emacs.el | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/emacs.el b/emacs.el index 8478091..b53ec49 100644 --- a/emacs.el +++ b/emacs.el @@ -65,7 +65,7 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ;; start and quit (setq inhibit-startup-message t) -(setq frame-title-format (list '(:eval (my-format-time-string)) +(setq frame-title-format (list '(:eval (format-time-string (or display-time-format ""))) " | %b " '(:eval (number-to-string (length (buffer-list-not-start-with-space)))) " buffers [" @@ -226,15 +226,12 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." ;; display date (add-hook 'after-init-hook (lambda () - (setq display-time-string-forms - '(dayname ", " day " " monthname " " year " " 24-hours ":"minutes ":" seconds)) - ;; (setq display-time-string-forms - ;; '((my-format-time-string))) (when display-time-mode (display-time-update)) )) (setq display-time-interval 29) (setq display-time-day-and-date t) +(setq display-time-format "%a, %-d %b %Y %T") (if window-system (display-time-mode 0) (display-time-mode 1)) @@ -1623,11 +1620,6 @@ when SEC is nil, stop auto save if enabled." (kill-buffer buf))) (buffer-list))) -(defun my-format-time-string (&optional time) - "" - (let ((system-time-locale "C")) - (format-time-string "%a, %d %b %Y %T" time))) - (defvar my-filer nil) (setq my-filer (or (executable-find "pcmanfm") (executable-find "nautilus"))) From 01bd5c3a9dd4cba0f39119f81bddaf12dc787474 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 6 Apr 2012 00:51:53 +0900 Subject: [PATCH 137/269] TouchpadOff=2 disables tapping and scrolling --- xinitrc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/xinitrc b/xinitrc index b4bc9ab..b0407f0 100644 --- a/xinitrc +++ b/xinitrc @@ -8,18 +8,13 @@ xmodmap -e 'keycode 101 = Alt_R Meta_R' # hiragana key as alt #xmodmap -e 'add Control = Caps_Lock' type synclient >/dev/null 2>&1 && { - synclient VertEdgeScroll=0 - synclient HorizEdgeScroll=0 - synclient MaxTapTime=0 # disable tap synclient MaxSpeed=2.0 synclient MinSpeed=0.2 - synclient VertTwoFingerScroll=0 - synclient HorizTwoFingerScroll=0 - + synclient TouchpadOff=2 # tapping and scrolling are disabled } xset s 1800 # go blank after 30 min -xset dpms 1810 1820 1830 # standby, suspend and off seem to be not different for my environment +xset dpms 1810 1820 1830 # standby, suspend and off seem not to be different for my environment unset LC_MESSAGES export LANG=ja_JP.utf8 From b1ee51bc02b6dd0f83c80f372bf21c05662adef6 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 6 Apr 2012 16:00:59 +0900 Subject: [PATCH 138/269] add PROMPT_COMMAND --- bashrc | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/bashrc b/bashrc index 8fae15a..6e311dd 100755 --- a/bashrc +++ b/bashrc @@ -430,25 +430,23 @@ __my_prompt_function(){ # used by PS1 fi # local battery=$(battery-state [%s] | sed -e 's`%`%%`g') # very slow - # __my_set_title ${USER}@${HOSTNAME} ${PWD} - printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}${svn}${battery}${ip}\n" printf "${c2}${USER}@${HOSTNAME}${cdef} ${date}\n" printf "shlv:${SHLVL} jobs:${jobnum} dirs:${dirs} last:${lastreturn} " } - __my_set_title(){ title="$(echo $@)" - case $TERM in - rxvt*|xterm*|aterm) - test -t 1 && - test -n "$DISPLAY" && - test -z "$EMACS" && - echo -n -e "\033]0;${title}\007" - ;; + case $TERM in + (rxvt*|xterm*|aterm) + test -t 1 && + test -n "$DISPLAY" && + test -z "$EMACS" && + echo -n -e "\033]0;${1}\007" + ;; esac } +PROMPT_COMMAND="__my_set_title \${USER}@\${HOSTNAME}\ \${PWD};${PROMPT_COMMAND}" # from https://wiki.archlinux.org/index.php/X_resources invader(){ From fd102e0e6e4de138dfe37e93477fd46cc5659573 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 7 Apr 2012 00:12:11 +0900 Subject: [PATCH 139/269] misc changes --- bashrc | 4 ++-- emacs.el | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bashrc b/bashrc index 8fae15a..7bc80e1 100755 --- a/bashrc +++ b/bashrc @@ -62,7 +62,7 @@ fi ####################### uname -a -echo TERM $TERM on $(tty), running $BASH $BASH_VERSION +echo TERM $TERM connected to $(tty), running $BASH $BASH_VERSION echo ################################### @@ -450,7 +450,7 @@ __my_set_title(){ esac } -# from https://wiki.archlinux.org/index.php/X_resources +# copied from https://wiki.archlinux.org/index.php/X_resources invader(){ # ANSI color scheme script featuring Space Invaders # diff --git a/emacs.el b/emacs.el index b53ec49..d6767f0 100644 --- a/emacs.el +++ b/emacs.el @@ -231,7 +231,7 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." )) (setq display-time-interval 29) (setq display-time-day-and-date t) -(setq display-time-format "%a, %-d %b %Y %T") +(setq display-time-format "%a, %d %b %Y %T") (if window-system (display-time-mode 0) (display-time-mode 1)) From b6e25a4ca8156adc16485d273035648ddf2c9932 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 7 Apr 2012 00:55:46 +0900 Subject: [PATCH 140/269] enable view-mode on git output buffer --- emacs.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/emacs.el b/emacs.el index d6767f0..14ac716 100644 --- a/emacs.el +++ b/emacs.el @@ -1609,7 +1609,10 @@ when SEC is nil, stop auto save if enabled." (cd dir) (and (require 'ansi-color nil t) (ansi-color-apply-on-region (point-min) - (point-max)))))) + (point-max))) + (setq buffer-read-only t) + (view-mode 1) + ))) (define-key ctl-x-map "g" 'my-git-shell-command) (defun my-kill-buffers () From dd060d9db784a75ddd363b2d906ad0c69920e8dc Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 7 Apr 2012 01:22:53 +0900 Subject: [PATCH 141/269] ignore cursor keys --- emacs.el | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/emacs.el b/emacs.el index 14ac716..30c04b4 100644 --- a/emacs.el +++ b/emacs.el @@ -454,18 +454,11 @@ return nil if LIB unfound and downloading failed, otherwise the path of LIB." (global-set-key (kbd "C-") 'scroll-down) (global-set-key (kbd "C-") 'scroll-up) (global-set-key (kbd "") 'previous-line-mark) +(global-set-key (kbd "