From ec417663e3f744cd740c2f276a5a9969111e3b34 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 12 Oct 2012 09:59:25 +0900 Subject: [PATCH 01/22] always use gmail for mailto --- _keysnail.js | 1 + 1 file changed, 1 insertion(+) diff --git a/_keysnail.js b/_keysnail.js index dfda27d..1e709f8 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -312,6 +312,7 @@ ext.add('my-setpref', function(){ "extensions.yass.edgetype":0, "extensions.yass.selectedpreset":"red", "font.default.x-western":"sans-serif", + "gecko.handlerService.schemes.mailto.1.name":"Gmail", "general.warnOnAboutConfig":false, "keyword.URL":"http://www.bing.com/search?q=", "network.dns.disableIPv6":true, From d58fc4a17cf94c20fdd9ced5dc6e90e4992e4341 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 14 Oct 2012 01:16:57 +0900 Subject: [PATCH 02/22] make git ignore c object files --- gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gitignore b/gitignore index 9aa7e52..cf10f19 100644 --- a/gitignore +++ b/gitignore @@ -8,3 +8,5 @@ GPATH GRTAGS GSYMS GTAGS + +*.o From a501008ff2daa56e4d1e6f0d035d2a2da4523791 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 14 Oct 2012 02:41:40 +0900 Subject: [PATCH 03/22] underline inactive mode-ine --- emacs.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs.el b/emacs.el index e8caba8..1754f62 100644 --- a/emacs.el +++ b/emacs.el @@ -440,6 +440,8 @@ otherwise the path where the library installed." (if (face-inverse-video-p 'mode-line) fg bg)) (set-face-foreground 'mode-line-inactive (if (face-inverse-video-p 'mode-line) bg fg))) +(set-face-underline-p 'mode-line-inactive + t) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; file handling From 069aa5b7170c0ac6c21196d036a6f32be90321c4 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 14 Oct 2012 12:21:28 +0900 Subject: [PATCH 04/22] my-save-this-buffer -> my-save-current-buffer --- emacs.el | 133 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 68 insertions(+), 65 deletions(-) diff --git a/emacs.el b/emacs.el index 1754f62..5bb0440 100644 --- a/emacs.el +++ b/emacs.el @@ -137,6 +137,12 @@ otherwise the path where the library installed." (setq ring-bell-function 'ignore) (mouse-avoidance-mode 'banish) +(and window-system + (dllib-if-unfound + "https://raw.github.com/10sr/emacs-lisp/master/save-window-size.el" + t) + (require 'save-window-size nil t)) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; global keys @@ -292,8 +298,11 @@ otherwise the path where the library installed." (fset 'yes-or-no-p 'y-or-n-p) -(define-key read-expression-map (kbd "TAB") 'lisp-complete-symbol) ;; complete symbol when `eval' +(define-key read-expression-map (kbd "TAB") 'lisp-complete-symbol) + +(define-key minibuffer-local-map (kbd "C-u") + (lambda () (interactive) (delete-region (point-at-bol) (point)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; letters, font-lock mode and fonts @@ -473,6 +482,20 @@ otherwise the path where the library installed." (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p) +(setq bookmark-default-file "~/.emacs.d/bmk") + +(and (dllib-if-unfound + "https://github.com/10sr/emacs-lisp/raw/master/read-only-only-mode.el" + t) + (require 'read-only-only-mode nil t)) + +(and (dllib-if-unfound + "https://raw.github.com/10sr/emacs-lisp/master/smart-revert.el" + t) + (require 'smart-revert nil t) + (smart-revert-on) + ) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; editting (setq require-final-newline t) @@ -602,17 +625,6 @@ otherwise the path where the library installed." (require 'simple nil t) -(and window-system - (dllib-if-unfound - "https://raw.github.com/10sr/emacs-lisp/master/save-window-size.el" - t) - (require 'save-window-size nil t)) - -(and (dllib-if-unfound - "https://github.com/10sr/emacs-lisp/raw/master/read-only-only-mode.el" - t) - (require 'read-only-only-mode nil t)) - (defun make () "Run \"make -k \" in current directory." (interactive) @@ -675,51 +687,18 @@ otherwise the path where the library installed." (setq auto-mode-alist (append '(("PKGBUILD\\'" . pkgbuild-mode)) auto-mode-alist))) -(setq python-python-command (or (executable-find "python3") - (executable-find "python"))) -(defun my-python-run-as-command () - "" - (interactive) - (shell-command (concat python-python-command " " buffer-file-name))) -(defun my-python-display-python-buffer () - "" - (interactive) - (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-b") 'my-python-display-python-buffer) - (define-key python-mode-map (kbd "C-m") 'newline-and-indent))) - -(add-hook 'inferior-python-mode-hook - (lambda () - (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))) - (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") - (add-hook 'apropos-mode-hook (lambda () (define-key apropos-mode-map "n" 'next-line) (define-key apropos-mode-map "p" 'previous-line) )) -(define-key minibuffer-local-map (kbd "C-u") - (lambda () (interactive) (delete-region (point-at-bol) (point)))) - (add-hook 'isearch-mode-hook (lambda () ;; (define-key isearch-mode-map @@ -843,18 +822,42 @@ otherwise the path where the library installed." (require 'git-command nil t) (define-key ctl-x-map "g" 'git-command)) -(and (dllib-if-unfound - "https://raw.github.com/10sr/emacs-lisp/master/smart-revert.el" - t) - (require 'smart-revert nil t) - (smart-revert-on) - ) - (and (dllib-if-unfound "http://www.emacswiki.org/emacs/download/sl.el" t) (require 'sl nil t)) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; python + +(setq python-python-command (or (executable-find "python3") + (executable-find "python"))) +(defun my-python-run-as-command () + "" + (interactive) + (shell-command (concat python-python-command " " buffer-file-name))) +(defun my-python-display-python-buffer () + "" + (interactive) + (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-b") 'my-python-display-python-buffer) + (define-key python-mode-map (kbd "C-m") 'newline-and-indent))) + +(add-hook 'inferior-python-mode-hook + (lambda () + (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))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; GNU GLOBAL(gtags) ;; http://uguisu.skr.jp/Windows/gtags.html @@ -1704,7 +1707,7 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; auto saving -(defun my-save-this-buffer (silent-p) +(defun my-save-current-buffer (silent-p) "save current buffer if can without asking" (let ((cm (if (current-message) (format "%s\n" (current-message)) @@ -1742,22 +1745,22 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." ;; (file-writable-p buffer-file-name)) ;; (save-buffer))) ; silent one -(defvar my-auto-save-this-buffer nil "auto save timer object") +(defvar my-auto-save-current-buffer nil "auto save timer object") -(defun my-auto-save-this-buffer (sec &optional silent-p) +(defun my-auto-save-current-buffer (sec &optional silent-p) "auto save current buffer if idle for SEC. when SEC is nil, stop auto save if enabled." (if sec - (progn (when my-auto-save-this-buffer - (cancel-timer my-auto-save-this-buffer) - (setq my-auto-save-this-buffer nil)) - (setq my-auto-save-this-buffer - (run-with-idle-timer sec t 'my-save-this-buffer silent-p))) - (when my-auto-save-this-buffer - (cancel-timer my-auto-save-this-buffer) - (setq my-auto-save-this-buffer nil)))) - -(my-auto-save-this-buffer 2 t) + (progn (when my-auto-save-current-buffer + (cancel-timer my-auto-save-current-buffer) + (setq my-auto-save-current-buffer nil)) + (setq my-auto-save-current-buffer + (run-with-idle-timer sec t 'my-save-current-buffer silent-p))) + (when my-auto-save-current-buffer + (cancel-timer my-auto-save-current-buffer) + (setq my-auto-save-current-buffer nil)))) + +(my-auto-save-current-buffer 2 t) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; misc funcs From f2d4ba5eba0b56a33969b72a83dfdecf905f4bb9 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 14 Oct 2012 12:44:24 +0900 Subject: [PATCH 05/22] update eshell prefs --- emacs.el | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/emacs.el b/emacs.el index 5bb0440..62ae945 100644 --- a/emacs.el +++ b/emacs.el @@ -1547,32 +1547,18 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." ; ("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*\"))") + (concat "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 $*") )) )) -;; (eval-after-load "em-alias" -;; '(progn ;; (eshell/alias "ll" "ls -l") -;; ;; (eshell/alias "la" "ls -a") -;; ;; (eshell/alias "lla" "ls -al") -;; (eshell/alias "sgcc" (if (eq system-type 'windows-nt) -;; "gcc -o win.$1.exe $1" -;; "gcc -o ${uname}.$1.out $1")) -;; (eshell/alias "slmgcc" (if (eq system-type 'windows-nt) -;; "gcc -lm -o win.$1.exe $1" -;; "gcc -lm -o ${uname}.$1.out $1")) -;; ;; (eshell/alias "ut" "ssh g841105@un001.ecc.u-tokyo.ac.jp") -;; (add-to-list 'recentf-exclude (concat eshell-directory-name "alias")))) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; get last modified date From 6dd221441cd203a54f5ed9b8878867644ffcf690 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 14 Oct 2012 13:19:22 +0900 Subject: [PATCH 06/22] fix paren matching --- emacs.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs.el b/emacs.el index 62ae945..3b3f611 100644 --- a/emacs.el +++ b/emacs.el @@ -1557,7 +1557,7 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." "(view-buffer (get-buffer \"*eshell output*\"))") ("g" "git $*") )) - )) + ))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; get last modified date From 8d85fa2e1218b9570d101b017e7dc2ea02855efe Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 14 Oct 2012 13:20:29 +0900 Subject: [PATCH 07/22] fix edit keybindings --- emacs.el | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/emacs.el b/emacs.el index 3b3f611..a0f2b67 100644 --- a/emacs.el +++ b/emacs.el @@ -540,20 +540,15 @@ otherwise the path where the library installed." (global-set-key (kbd "C-h") (kbd "DEL")) (global-set-key (kbd "C-m") 'reindent-then-newline-and-indent) -(global-set-key (kbd "C-o") - ;; (lambda () - ;; (interactive) - ;; (move-end-of-line nil) - ;; (newline-and-indent)) - (kbd "C-e C-m") - ) -;(global-set-key (kbd "C-k") 'kill-whole-line) -(global-set-key (kbd "M-k") 'my-copy-whole-line) +(global-set-key (kbd "C-o") (kbd "C-e C-m")) + +(define-key esc-map "k" 'my-copy-whole-line) ;; (global-set-key "\C-z" 'undo) ; undo is M-u -(global-set-key (kbd "M-u") 'undo) -(global-set-key (kbd "C-r") 'query-replace-regexp) +(define-key esc-map "u" 'undo) +(define-key esc-map "i" (kbd "ESC TAB")) +;(global-set-key (kbd "C-r") 'query-replace-regexp) (global-set-key (kbd "C-s") 'isearch-forward-regexp) -(global-set-key (kbd "M-i") (kbd "ESC TAB")) +(global-set-key (kbd "C-r") 'isearch-backward-regexp) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; gmail From a8393f05c7a31db77128c8e7e96d6c0db5e74f67 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 14 Oct 2012 13:31:20 +0900 Subject: [PATCH 08/22] fix vertical-border face --- emacs.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs.el b/emacs.el index a0f2b67..b9eda2d 100644 --- a/emacs.el +++ b/emacs.el @@ -451,6 +451,8 @@ otherwise the path where the library installed." (if (face-inverse-video-p 'mode-line) bg fg))) (set-face-underline-p 'mode-line-inactive t) +(set-face-underline-p 'vertical-border + nil) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; file handling From a04fbe5e74a9c6990d21c30ba0c5fcc5f0605d74 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 14 Oct 2012 13:41:51 +0900 Subject: [PATCH 09/22] reorder sexps --- emacs.el | 191 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 98 insertions(+), 93 deletions(-) diff --git a/emacs.el b/emacs.el index b9eda2d..e8e874d 100644 --- a/emacs.el +++ b/emacs.el @@ -151,21 +151,12 @@ otherwise the path where the library installed." (global-set-key (kbd "") 'scroll-down) (global-set-key (kbd "") 'scroll-up) -(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) @@ -500,6 +491,14 @@ otherwise the path where the library installed." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; editting + +(defun my-copy-whole-line () + "" + (interactive) + (kill-new (concat (buffer-substring (point-at-bol) + (point-at-eol)) + "\n"))) + (setq require-final-newline t) (setq kill-whole-line t) (setq scroll-conservatively 35 @@ -552,6 +551,8 @@ otherwise the path where the library installed." (global-set-key (kbd "C-s") 'isearch-forward-regexp) (global-set-key (kbd "C-r") 'isearch-backward-regexp) +(define-key my-prefix-map (kbd "C-o") 'occur) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; gmail @@ -579,6 +580,14 @@ otherwise the path where the library installed." (substitute-key-definition 'kill-buffer 'my-query-kill-this-buffer global-map) ;;(global-set-key "\C-xk" 'my-query-kill-this-buffer) +(defun my-kill-buffers () + "" + (interactive) + (mapcar (lambda (buf) + (when (buffer-file-name buf) + (kill-buffer buf))) + (buffer-list))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; share clipboard with x @@ -617,6 +626,67 @@ otherwise the path where the library installed." (require 'sudoku nil t) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; window + +;; 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) + +;; forked from http://d.hatena.ne.jp/khiker/20100119/window_resize +(define-key my-prefix-map (kbd "C-w") 'my-window-organizer) + +(defun my-window-organizer () + "Control window size and position." + (interactive) + (save-selected-window + (select-window (window-at 0 0)) + (let ( ;; (window-obj (selected-window)) + ;; (current-width (window-width)) + ;; (current-height (window-height)) + action + c) + (catch 'end-flag + (while t + (setq action + (read-key-sequence-vector + (format "size[%dx%d] 1: maximize; 2, 3: split; 0: \ +delete; o: select other; j, l: enlarge; h, k: shrink; q: quit." + (window-width) + (window-height)))) + (setq c (aref action 0)) + (cond ((= c ?l) + (unless (eq (window-width) (frame-width)) + (enlarge-window-horizontally 1))) + ((= c ?h) + (unless (eq (window-width) (frame-width)) + (shrink-window-horizontally 1))) + ((= c ?j) + (enlarge-window 1)) + ((= c ?k) + (shrink-window 1)) + ((= c ?o) + (other-window 1)) + ((memq c '(?d ?0)) + (unless (eq (selected-window) + (next-window (selected-window) 0 1)) + (delete-window (selected-window)))) + ((= c ?1) + (delete-other-windows)) + ((= c ?2) + (split-window-vertically)) + ((= c ?3) + (split-window-horizontally)) + ((memq c '(?q ?\C-g)) + (message "Quit") + (throw 'end-flag t)) + (t + (beep)))))))) +;; (aref (read-key-sequence-vector "aa") 0) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; some modes and hooks @@ -824,6 +894,8 @@ otherwise the path where the library installed." t) (require 'sl nil t)) +(defalias 'qcalc 'quick-calc) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; python @@ -1745,28 +1817,8 @@ when SEC is nil, stop auto save if enabled." (my-auto-save-current-buffer 2 t) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; misc funcs - -(defun dir-show (&optional dir) - (interactive) - (let ((bf (get-buffer-create "*dir show*")) - (list-directory-brief-switches "-C")) - (with-current-buffer bf - (list-directory (or nil - default-directory) - nil)) - )) - -(defalias 'qcalc 'quick-calc) - -(defun my-kill-buffers () - "" - (interactive) - (mapcar (lambda (buf) - (when (buffer-file-name buf) - (kill-buffer buf))) - (buffer-list))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; x open (defvar my-filer nil) (setq my-filer (or (executable-find "pcmanfm") @@ -1789,6 +1841,19 @@ when SEC is nil, stop auto save if enabled." ;; (recentf-add-file file) (message "Opening %s...done" file)) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; misc funcs + +(defun dir-show (&optional dir) + (interactive) + (let ((bf (get-buffer-create "*dir show*")) + (list-directory-brief-switches "-C")) + (with-current-buffer bf + (list-directory (or nil + default-directory) + nil)) + )) + (defun my-keyboard-quit () "" (interactive) @@ -1813,13 +1878,6 @@ this is test, does not rename files" (interactive) (shell-command "convmv -r -f sjis -t utf8 * --notest")) -(defun my-copy-whole-line () - "" - (interactive) - (kill-new (concat (buffer-substring (point-at-bol) - (point-at-eol)) - "\n"))) - (defun kill-ring-save-buffer-file-name () "get current filename" (interactive) @@ -1829,62 +1887,9 @@ this is test, does not rename files" (message file)) (message "not visiting file.")))) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; forked from http://d.hatena.ne.jp/khiker/20100119/window_resize -(define-key my-prefix-map (kbd "C-w") 'my-window-organizer) - -(defun my-window-organizer () - "Control window size and position." - (interactive) - (save-selected-window - (select-window (window-at 0 0)) - (let ( ;; (window-obj (selected-window)) - ;; (current-width (window-width)) - ;; (current-height (window-height)) - action - c) - (catch 'end-flag - (while t - (setq action - (read-key-sequence-vector - (format "size[%dx%d] 1: maximize; 2, 3: split; 0: \ -delete; o: select other; j, l: enlarge; h, k: shrink; q: quit." - (window-width) - (window-height)))) - (setq c (aref action 0)) - (cond ((= c ?l) - (unless (eq (window-width) (frame-width)) - (enlarge-window-horizontally 1))) - ((= c ?h) - (unless (eq (window-width) (frame-width)) - (shrink-window-horizontally 1))) - ((= c ?j) - (enlarge-window 1)) - ((= c ?k) - (shrink-window 1)) - ((= c ?o) - (other-window 1)) - ((memq c '(?d ?0)) - (unless (eq (selected-window) - (next-window (selected-window) 0 1)) - (delete-window (selected-window)))) - ((= c ?1) - (delete-other-windows)) - ((= c ?2) - (split-window-vertically)) - ((= c ?3) - (split-window-horizontally)) - ((memq c '(?q ?\C-g)) - (message "Quit") - (throw 'end-flag t)) - (t - (beep)))))))) -;; (aref (read-key-sequence-vector "aa") 0) - - ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; emacsを殺伐とさせる -;; ;; 補完させるとき失敗するからなし +;; ;; savage emacs +;; ;; when enabled emacs fails to complete ;; ;; http://e-arrows.sakura.ne.jp/2010/05/emacs-should-be-more-savage.html ;; (defadvice message (before message-for-stupid (arg &rest arg2) activate) ;; (setq arg From 663bcd2542004be4e6e301d14b011145fb4b916c Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 14 Oct 2012 13:59:27 +0900 Subject: [PATCH 10/22] add interactive function reload-rcfile --- emacs.el | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/emacs.el b/emacs.el index e8e874d..d61e55d 100644 --- a/emacs.el +++ b/emacs.el @@ -91,10 +91,7 @@ otherwise the path where the library installed." (set-scroll-bar-mode nil)) (add-hook 'kill-emacs-hook ;; load when exitting to examine if file is written properly - (lambda () - (when (file-readable-p "~/.emacs") - (load-file "~/.emacs")) - )) + 'reload-rcfile) (add-hook 'after-init-hook (lambda () @@ -112,10 +109,6 @@ otherwise the path where the library installed." ;; my prefix map (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) @@ -143,6 +136,12 @@ otherwise the path where the library installed." t) (require 'save-window-size nil t)) +(defun reload-rcfile () + "Reload emacs rc file." + (interactive) + (when (file-readable-p user-init-file) + (load-file user-init-file))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; global keys From 06058ef0d0f97d9694b66779f1c7104650ed3e76 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 14 Oct 2012 14:03:30 +0900 Subject: [PATCH 11/22] reload-rcfile -> reload-init-file --- emacs.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/emacs.el b/emacs.el index d61e55d..77b571f 100644 --- a/emacs.el +++ b/emacs.el @@ -90,8 +90,8 @@ otherwise the path where the library installed." (and (fboundp 'set-scroll-bar-mode) (set-scroll-bar-mode nil)) (add-hook 'kill-emacs-hook - ;; load when exitting to examine if file is written properly - 'reload-rcfile) + ;; load init file when terminating emacs to ensure file is not broken + 'reload-init-file) (add-hook 'after-init-hook (lambda () @@ -136,8 +136,8 @@ otherwise the path where the library installed." t) (require 'save-window-size nil t)) -(defun reload-rcfile () - "Reload emacs rc file." +(defun reload-init-file () + "Reload emacs init file." (interactive) (when (file-readable-p user-init-file) (load-file user-init-file))) From 6e906cf43432a3ccbb7b214bb81c6f54d5669f05 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 14 Oct 2012 14:55:35 +0900 Subject: [PATCH 12/22] do not save recentf list when kill emacs --- emacs.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs.el b/emacs.el index 77b571f..a3affdd 100644 --- a/emacs.el +++ b/emacs.el @@ -1168,10 +1168,11 @@ delete; o: select other; j, l: enlarge; h, k: shrink; q: quit." (add-hook 'find-file-hook 'recentf-save-list t) ; save to file immediately after adding file to recentf list + (remove-hook 'kill-emacs-hook + 'recentf-save-list) ;; (add-hook 'find-file-hook ;; (lambda () ;; (recentf-add-file default-directory))) - ;; (add-to-list 'recentf-filename-handlers 'abbreviate-file-name) (and (dllib-if-unfound "https://raw.github.com/10sr/emacs-lisp/master/recentf-show.el" t) From c35260ec3cb2a7e9fb1115d7d113cf694ec7ccc1 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 14 Oct 2012 16:19:19 +0900 Subject: [PATCH 13/22] mv tint2rc to conf --- tint2rc => conf/tint2rc | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tint2rc => conf/tint2rc (100%) diff --git a/tint2rc b/conf/tint2rc similarity index 100% rename from tint2rc rename to conf/tint2rc From 679e370ea55cd19df111caf694e49f6d4a819ef1 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 14 Oct 2012 16:38:21 +0900 Subject: [PATCH 14/22] update for pasteboard.el --- emacs.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emacs.el b/emacs.el index a3affdd..9f1db5f 100644 --- a/emacs.el +++ b/emacs.el @@ -608,7 +608,8 @@ otherwise the path where the library installed." "https://raw.github.com/10sr/emacs-lisp/master/pasteboard.el" t) (require 'pasteboard nil t) - (turn-on-pasteboard)) + (turn-on-pasteboard) + (pasteboard-enable-rtun)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; package From 75bb8ffa1baae02bc9d50beaa193e4a440cb03ff Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 14 Oct 2012 16:40:12 +0900 Subject: [PATCH 15/22] add alias for pasteboard so that need not to set default-command in tmux.conf --- bashrc | 6 ++++++ tmux.conf | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bashrc b/bashrc index 3554a10..2622521 100755 --- a/bashrc +++ b/bashrc @@ -381,6 +381,12 @@ mkcd(){ cd $1 } +if null type reattach-to-user-namespace +then + alias pbpaste="reattach-to-user-namespace pbpaste" + alias pbcopy="reattach-to-user-namespace pbcopy" +fi + catclip(){ if iswindows then diff --git a/tmux.conf b/tmux.conf index 8d40d52..d4f87fa 100644 --- a/tmux.conf +++ b/tmux.conf @@ -11,7 +11,7 @@ set -g base-index 1 set -g default-command /bin/bash #set -g default-terminal screen-256color #set -g default-terminal screen-16color -set default-path "$HOME" # not work as i expected +set default-path "${HOME}" # not work as i expected #set -g status-left "" #set -g status-right "#H | %a, %d %b %Y %T %z #(tmux -V)" @@ -30,8 +30,8 @@ if "test `hostname` = darwin-mba.local" \ if "test `hostname` = newkiwi" \ "set -g status-bg magenta; set -g pane-active-border-fg magenta" -if "test -f /opt/local/bin/reattach-to-user-namespace" \ - "set-option -g default-command '/opt/local/bin/reattach-to-user-namespace bash'" +# if "test -f /opt/local/bin/reattach-to-user-namespace" \ +# "set -g default-command '/opt/local/bin/reattach-to-user-namespace -l bash'" # window-status-current setw -g window-status-current-fg black From 43ece7bf143c155cd18cff6563d49ff7ac507adc Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 14 Oct 2012 17:48:05 +0900 Subject: [PATCH 16/22] enable rtun only when using tmux --- bashrc | 2 +- emacs.el | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bashrc b/bashrc index 2622521..47368af 100755 --- a/bashrc +++ b/bashrc @@ -381,7 +381,7 @@ mkcd(){ cd $1 } -if null type reattach-to-user-namespace +if test -n "$TMUX" && null type reattach-to-user-namespace then alias pbpaste="reattach-to-user-namespace pbpaste" alias pbcopy="reattach-to-user-namespace pbcopy" diff --git a/emacs.el b/emacs.el index 9f1db5f..25b32cc 100644 --- a/emacs.el +++ b/emacs.el @@ -609,6 +609,7 @@ otherwise the path where the library installed." t) (require 'pasteboard nil t) (turn-on-pasteboard) + (getenv "TMUX") (pasteboard-enable-rtun)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; From b49cb1bd775ac1edd715dda1e01a80421d649529 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 14 Oct 2012 17:50:31 +0900 Subject: [PATCH 17/22] rm rtun prefs from tmux.conf --- tmux.conf | 3 --- 1 file changed, 3 deletions(-) diff --git a/tmux.conf b/tmux.conf index d4f87fa..8256825 100644 --- a/tmux.conf +++ b/tmux.conf @@ -30,9 +30,6 @@ if "test `hostname` = darwin-mba.local" \ if "test `hostname` = newkiwi" \ "set -g status-bg magenta; set -g pane-active-border-fg magenta" -# if "test -f /opt/local/bin/reattach-to-user-namespace" \ -# "set -g default-command '/opt/local/bin/reattach-to-user-namespace -l bash'" - # window-status-current setw -g window-status-current-fg black setw -g window-status-current-bg white From 4202fab9e7306b691fe88cc5821e705ec7f97dbe Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 15 Oct 2012 00:59:45 +0900 Subject: [PATCH 18/22] add alias rm --- bashrc | 1 + 1 file changed, 1 insertion(+) diff --git a/bashrc b/bashrc index 47368af..eae93a3 100755 --- a/bashrc +++ b/bashrc @@ -112,6 +112,7 @@ null type vim && alias vi=vim alias pstree="LANG=C pstree" alias cp="cp -v" alias mv="mv -v" +alias rm="rm -v" alias psaux="ps auxww" alias q=exit alias e3=e3em From 58d7eb5a8aecce89f3379c5db71ea8edf4bfcccd Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 15 Oct 2012 16:06:21 +0900 Subject: [PATCH 19/22] update recentf sexps --- emacs.el | 6 ++++-- setup.sh | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/emacs.el b/emacs.el index 25b32cc..58aa54d 100644 --- a/emacs.el +++ b/emacs.el @@ -1164,14 +1164,16 @@ delete; o: select other; j, l: enlarge; h, k: shrink; q: quit." recentf-show-file-shortcuts-flag nil) (when (require 'recentf nil t) + (add-hook 'recentf-mode-hook + 'recentf-save-list) (recentf-mode 1) (add-to-list 'recentf-exclude (regexp-quote recentf-save-file)) (define-key ctl-x-map (kbd "C-r") 'recentf-open-files) (add-hook 'find-file-hook 'recentf-save-list t) ; save to file immediately after adding file to recentf list - (remove-hook 'kill-emacs-hook - 'recentf-save-list) + (add-hook 'kill-emacs-hook + 'recentf-load-list) ;; (add-hook 'find-file-hook ;; (lambda () ;; (recentf-add-file default-directory))) diff --git a/setup.sh b/setup.sh index 384ad1a..d24df8c 100755 --- a/setup.sh +++ b/setup.sh @@ -95,6 +95,7 @@ mac_defaults(){ mac_start_daemon(){ test "`uname`" = Darwin || return 1 + sudo launchctl setenv LC_ALL C sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist } From c32ec252bbbe17726fb72c0524da4104ff1ccd43 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 16 Oct 2012 00:16:15 +0900 Subject: [PATCH 20/22] fix makefile-mode keybind --- emacs.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emacs.el b/emacs.el index 58aa54d..e1def7a 100644 --- a/emacs.el +++ b/emacs.el @@ -693,6 +693,10 @@ delete; o: select other; j, l: enlarge; h, k: shrink; q: quit." (require 'simple nil t) +(add-hook 'makefile-mode-hook + (lambda () + (define-key makefile-mode-map (kbd "C-m") 'newline-and-indent))) + (defun make () "Run \"make -k \" in current directory." (interactive) From 3e193b45f3c1f52d9465771fb4fd6e3612908af0 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 18 Oct 2012 11:53:07 +0900 Subject: [PATCH 21/22] small fix --- bashrc | 1 - 1 file changed, 1 deletion(-) diff --git a/bashrc b/bashrc index eae93a3..32086b8 100755 --- a/bashrc +++ b/bashrc @@ -79,7 +79,6 @@ _tmux_prefs(){ iswindows && alias tty="echo cmd.exe" type fortune >/dev/null 2>&1 && { - echo fortune echo fortune -o From 0828adeb88463b3b27b418d0164b52d406448e4b Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 20 Oct 2012 13:31:34 +0900 Subject: [PATCH 22/22] update setup.sh --- setup.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/setup.sh b/setup.sh index d24df8c..64c540e 100755 --- a/setup.sh +++ b/setup.sh @@ -56,7 +56,7 @@ git_config(){ git config --global status.relativePaths false git config --global status.showUntrackedFiles normal git config --global log.date iso - git config --global alias.graph "log --graph --date-order -C -M --pretty=tformat:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=iso -n 500" + git config --global alias.graph "log --graph --date-order -C -M --pretty=tformat:\"<%C(green)%h%C(reset)> %C(white)%ad%C(reset) [%C(red)%an%C(reset)] %C(yellow)%d%C(reset) %C(white bold)%s%C(reset)\" --all --date=iso -n 499" git config --global alias.st "status -s -b" git config --global alias.b "branch" git config --global alias.sb "show-branch" @@ -95,8 +95,11 @@ mac_defaults(){ mac_start_daemon(){ test "`uname`" = Darwin || return 1 - sudo launchctl setenv LC_ALL C - sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist + test "`launchctl getenv LC_ALL`" = C || sudo launchctl setenv LC_ALL C + if ! (launchctl list | grep com.apple.locate) + then + sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist + fi } get_install_script http://www.frexx.de/xterm-256-notes/data/colortable16.sh \