From 20c67eb22cd0cf53857941b771fc5fbde0221f6a Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 29 Nov 2012 10:09:11 +0900 Subject: [PATCH 1/8] fix fetch-library --- emacs.el | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/emacs.el b/emacs.el index 3788dd2..28da04c 100644 --- a/emacs.el +++ b/emacs.el @@ -48,26 +48,23 @@ otherwise the path where the library installed." (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) - (or (download-file url - lpath - t) - (error "Download failed")) - (message "Downloading %s...done") - (when (and byte-compile-p - (require 'bytecomp nil t)) - (and (file-exists-p (byte-compile-dest-file lpath)) - (delete-file (byte-compile-dest-file lpath))) - (byte-compile-file lpath)) - ) - (error (and (file-writable-p lpath) - (delete-file lpath)) - (message "Downloading %s...failed" - url) - nil)) - (locate-library lib)) - locate-p))) + (if (progn (message "Downloading %s..." + url) + (download-file url + lpath + t)) + (progn (message "Downloading %s...done" + url) + (when (and byte-compile-p + (require 'bytecomp nil t)) + (and (file-exists-p (byte-compile-dest-file lpath)) + (delete-file (byte-compile-dest-file lpath))) + (byte-compile-file lpath))) + (progn (and (file-writable-p lpath) + (delete-file lpath)) + (message "Downloading %s...failed" + url)))) + (locate-library lib))) (defun download-file (url path &optional ok-if-already-exists) "Download file from URL and output to PATH." From 6994d9ea5c6306c72b0c3570e48b23d5046879b1 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 29 Nov 2012 10:47:54 +0900 Subject: [PATCH 2/8] add some edit keys --- _keysnail.js | 55 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/_keysnail.js b/_keysnail.js index e7922d2..17990d9 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -559,7 +559,6 @@ key.suspendKey = "Not defined"; // ================================= Hooks ================================= // - hook.setHook('KeyBoardQuit', function (aEvent) { ext.exec("hide-sidebar"); let(elem = document.commandDispatcher.focusedElement) elem && elem.blur(); @@ -587,6 +586,7 @@ hook.setHook('Unload', function () { }); + // ============================= Key bindings ============================== // key.setGlobalKey('C-', function () { @@ -615,21 +615,12 @@ key.setGlobalKey('C-', function () { } }, '選択中のタブを左へ'); -key.setGlobalKey('C-h', function (ev, arg) { - return; -}, 'ignore'); - key.setGlobalKey('', function (ev, arg) { let (elem = document.commandDispatcher.focusedElement) elem && elem.blur(); gBrowser.focus(); content.focus(); }, 'コンテンツへフォーカス', true); -key.setGlobalKey('C-p', function (ev, arg) { - return !document.getElementById("keysnail-prompt").hidden && - document.getElementById("keysnail-prompt-textbox").focus(); -}, 'KeySnail のプロンプトへフォーカス', true); - key.setGlobalKey('', function (ev, arg) { ext.exec("strong-fullscreen", arg, ev); }, 'go fullscreen with hiding toolbar and tabbar', true); @@ -826,3 +817,47 @@ key.setViewKey('U', function (ev, arg) { key.setEditKey('C-', function (ev) { command.walkInputElement(command.elementsRetrieverTextarea, true, true); }, '次のテキストエリアへフォーカス'); + +key.setEditKey('C-a', function (ev) { + command.beginLine(ev); +}, '行頭へ移動'); + +key.setEditKey('C-e', function (ev) { + command.endLine(ev); +}, '行末へ'); + +key.setEditKey('C-d', function (ev) { + goDoCommand("cmd_deleteCharForward"); +}, '次の一文字削除'); + +key.setEditKey('C-b', function (ev) { + command.previousChar(ev); +}, '一文字左へ移動'); + +key.setEditKey('C-f', function (ev) { + command.nextChar(ev); +}, '一文字右へ移動'); + +key.setEditKey('C-h', function (ev) { + goDoCommand("cmd_deleteCharBackward"); +}, '前の一文字を削除'); + +key.setEditKey('C-k', function (ev) { + command.killLine(ev); +}, 'カーソルから先を一行カット (Kill line)'); + +key.setEditKey('C-l', function (ev) { + command.recenter(ev); +}, 'カーソル位置が画面の中央へ来るようスクロール', true); + +key.setEditKey('C-n', function (ev) { + command.nextLine(ev); +}, '一行下へ'); + +key.setEditKey('C-p', function (ev) { + command.previousLine(ev); +}, '一行上へ'); + +key.setEditKey('C-o', function (ev) { + command.openLine(ev); +}, '行を開く (Open line)'); From a73e4e1f035a0a58540a921c95874f4dab102d0e Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 29 Nov 2012 11:57:57 +0900 Subject: [PATCH 3/8] add alias sudoe --- bashrc | 1 + 1 file changed, 1 insertion(+) diff --git a/bashrc b/bashrc index 93a46c9..4ae2a87 100755 --- a/bashrc +++ b/bashrc @@ -122,6 +122,7 @@ alias e3=e3em alias po=popd alias pu=pushd alias sudo="sudo " # use aliases through sudo +alias sudoe="sudoedit" alias halt="sudo halt" alias reboot="sudo reboot" alias suspend="dbus-send --system --print-reply --dest=org.freedesktop.UPower \ From d2884bee734b59482e3b33e2751ec8244c51dee7 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 29 Nov 2012 12:24:49 +0900 Subject: [PATCH 4/8] remove unused function --- emacs.el | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/emacs.el b/emacs.el index 28da04c..dc05beb 100644 --- a/emacs.el +++ b/emacs.el @@ -1098,8 +1098,6 @@ delete; o: select other; j, l: enlarge; h, k: shrink; q: quit." (when (lazy-load-eval 'bs '(bs-show) ;; (add-to-list 'bs-configurations ;; '("processes" nil get-buffer-process ".*" nil nil)) - (add-to-list 'bs-configurations - '("same-dir" nil buffer-same-dir-p ".*" nil nil)) (add-to-list 'bs-configurations '("this-frame" nil (lambda (buf) (memq buf (my-frame-buffer-get))) @@ -1118,12 +1116,7 @@ delete; o: select other; j, l: enlarge; h, k: shrink; q: quit." (setq bs-default-configuration "files") ;; (and bs--show-all ;; (call-interactively 'bs-toggle-show-all)) - (set (make-local-variable 'scroll-margin) 0))) - (defun buffer-same-dir-p (bf) - "return t if BF's dir is same as current dir, otherwise nil." - (let ((cdir (expand-file-name default-directory))) - (with-current-buffer bf - (equal (expand-file-name default-directory) cdir))))) + (set (make-local-variable 'scroll-margin) 0)))) (iswitchb-mode 1) From 99e0933f43fe36aef8534c8718db2448b9eef159 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 29 Nov 2012 12:37:26 +0900 Subject: [PATCH 5/8] fix bug --- emacs.el | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/emacs.el b/emacs.el index dc05beb..b4e7228 100644 --- a/emacs.el +++ b/emacs.el @@ -999,21 +999,21 @@ delete; o: select other; j, l: enlarge; h, k: shrink; q: quit." ;; http://cha.la.coocan.jp/doc/gnu_global.html (when (lazy-load-eval 'gtags '(gtags-mode)) - (setq gtags-mode-hook - '(lambda () - (setq gtags-select-buffer-single t) - ;; (local-set-key "\M-t" 'gtags-find-tag) - ;; (local-set-key "\M-r" 'gtags-find-rtag) - ;; (local-set-key "\M-s" 'gtags-find-symbol) - ;; (local-set-key "\C-t" 'gtags-pop-stack) - (define-key gtags-mode-map (kbd "C-x t h") 'gtags-find-tag-from-here) - (define-key gtags-mode-map (kbd "C-x t t") 'gtags-find-tag) - (define-key gtags-mode-map (kbd "C-x t r") 'gtags-find-rtag) - (define-key gtags-mode-map (kbd "C-x t s") 'gtags-find-symbol) - (define-key gtags-mode-map (kbd "C-x t p") 'gtags-find-pattern) - (define-key gtags-mdoe-map (kbd "C-x t f") 'gtags-find-file) - (define-key gtags-mode-map (kbd "C-x t b") 'gtags-pop-stack) ;back - ))) + (add-hook 'gtags-mode-hook + (lambda () + (setq gtags-select-buffer-single t) + ;; (local-set-key "\M-t" 'gtags-find-tag) + ;; (local-set-key "\M-r" 'gtags-find-rtag) + ;; (local-set-key "\M-s" 'gtags-find-symbol) + ;; (local-set-key "\C-t" 'gtags-pop-stack) + (define-key gtags-mode-map (kbd "C-x t h") 'gtags-find-tag-from-here) + (define-key gtags-mode-map (kbd "C-x t t") 'gtags-find-tag) + (define-key gtags-mode-map (kbd "C-x t r") 'gtags-find-rtag) + (define-key gtags-mode-map (kbd "C-x t s") 'gtags-find-symbol) + (define-key gtags-mode-map (kbd "C-x t p") 'gtags-find-pattern) + (define-key gtags-mdoe-map (kbd "C-x t f") 'gtags-find-file) + (define-key gtags-mode-map (kbd "C-x t b") 'gtags-pop-stack) ;back + ))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; term mode From a00dfe5a08a25b61c106ab9a9bb4ba1d29bfe7e1 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 29 Nov 2012 16:45:57 +0900 Subject: [PATCH 6/8] update mode-fg, mode-bg --- tmux.conf | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tmux.conf b/tmux.conf index 9a59b80..6ecc53c 100644 --- a/tmux.conf +++ b/tmux.conf @@ -22,23 +22,30 @@ set -g status-right "${USER}@#H | #(tmux -V) " set message-bg black set message-fg yellow +# default-color set -g status-bg green set -g status-fg white +set -g mode-bg white +set -g mode-fg black + if "test `hostname` = arch-aspireone" \ - "set -g status-bg blue; set -g pane-active-border-fg blue" + "set -g status-bg blue; set -g status-fg white; \ + set -g mode-bg blue; set -g mode-fg white; \ + set -g pane-active-border-fg blue;" if "test `hostname` = darwin-mba.local" \ - "set -g status-bg yellow; set -g pane-active-border-fg yellow; set -g status-fg black" + "set -g status-bg yellow; set -g status-fg black; \ + set -g mode-bg yellow; set -g mode-fg black; \ + set -g pane-active-border-fg yellow;" if "test `hostname` = newkiwi" \ - "set -g status-bg magenta; set -g pane-active-border-fg magenta" + "set -g status-bg magenta; set -g status-fg white; \ + set -g mode-bg magenta; set -g mode-fg white; \ + set -g pane-active-border-fg magenta;" -# window-status-current +# face of currently active window name in status bar setw -g window-status-current-fg black setw -g window-status-current-bg white setw -g window-status-current-attr bold -set -g mode-bg white -set -g mode-fg black - # this does not work because it runs asyncly # if "test -n \"tmux display -p '#{client_termname}' | grep -o 256color\"" \ # "set -g default-terminal screen-256color" "set -g default-terminal screen" From b4331eb49a71f2111b3dc4df51f988403f2af62a Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 29 Nov 2012 16:46:09 +0900 Subject: [PATCH 7/8] fix function man --- bashrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bashrc b/bashrc index 4ae2a87..4b55646 100755 --- a/bashrc +++ b/bashrc @@ -223,7 +223,7 @@ man() { LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ LESS_TERMCAP_ue=$(printf "\e[0m") \ LESS_TERMCAP_us=$(printf "\e[1;32m") \ - command man "$@" + man "$@" } scr(){ From eed1b05237e7d0fdce50a947d9c841f406373e85 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Thu, 29 Nov 2012 16:46:28 +0900 Subject: [PATCH 8/8] fix prefs for python-mode --- emacs.el | 53 +++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/emacs.el b/emacs.el index b4e7228..9e20f36 100644 --- a/emacs.el +++ b/emacs.el @@ -964,33 +964,34 @@ delete; o: select other; j, l: enlarge; h, k: shrink; q: quit." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 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))) +(when (lazy-load-eval 'python '(python-mode)) + (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 '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)