Created
December 5, 2010 15:28
-
-
Save kiwanami/729169 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; ATOK X3 IIIMECF | |
;; 基本設定 | |
(setq iiimcf-server-control-hostlist | |
(list (concat "/tmp/.iiim-" (user-login-name) "/:0.0"))) | |
(require 'iiimcf-sc) | |
(setq iiimcf-server-control-default-language "ja") | |
(setq iiimcf-server-control-default-input-method "atokx3") | |
(setq default-input-method 'iiim-server-control) | |
;; キー設定 | |
(setq iiimcf-keycode-spec-alist | |
(append | |
'((13 10 0) ; c-m commit -> [Enter] | |
(7 27) ; c-g -> [esc] | |
;; MS-IMEのキー体系を仮定 | |
(1 36 65535) ; c-a head position -> [Home] | |
(5 35 65535) ; c-e last position -> [End] | |
(2 37 65535) ; c-b backward bunsetu -> [←] | |
(16 38 65535) ; c-p previous candidate -> [↑] | |
(6 39 65535) ; c-f next bunsetu -> [→] | |
(14 40 65535) ; c-n next candidate -> [↓] | |
(11 37 65535 1) ; c-k narrow bunsetu -> [Shift+←] | |
(12 39 65535 1) ; c-l widen bunsetu -> [Shift+→] | |
(21 121 65535) ; c-u alphabet -> [F10] | |
(15 118 65535) ; c-o kana -> [F7] | |
) | |
iiimcf-keycode-spec-alist)) | |
(defun atok-insert-half-space () | |
(interactive) (insert " ")) | |
(define-key iiimcf-server-control-initial-state-keymap | |
(kbd "S-SPC") 'atok-insert-half-space) | |
(defun atok-undo-commit () | |
(interactive) | |
(when iiimcf-server-control-ic-id | |
(iiimcf-server-control-keyforward last-input-event) | |
(iiimcf-set-icfocus iiimcf-server-control-ic-id))) | |
(define-key iiimcf-server-control-initial-state-keymap | |
(kbd "<C-backspace>") | |
'atok-undo-commit) | |
;; (iiimp-debug) | |
;; 候補一覧ポップアップ | |
(require 'popup) | |
(defvar iiimcf-UI-draw-lookup-choice-popup-instance nil) | |
(defun iiimcf-UI-draw-lookup-choice-popup-position () | |
;; uic via dynamic scope!!! | |
(let* ((pos (marker-position (iiimcf-UI-marker uic))) | |
(text (iiimcf-UI-preedit-text uic)) | |
(len (length text)) | |
(pts 0) pte cprop position) | |
(setq text (copy-sequence text)) | |
(while pts | |
(setq cprop (get-text-property pts 'iiim-feedback text) | |
pte (next-single-property-change pts 'iiim-feedback text)) | |
(if (eq 'reverse (car cprop)) | |
(setq position (+ pos pts) pts nil) | |
(setq pts pte))) | |
position)) | |
(defun iiimcf-UI-draw-lookup-choice-popup (mk candidates) | |
(let ((cands (aref candidates 0)) | |
(index (aref candidates 1)) | |
(title (aref candidates 2)) lst) | |
(setq lst (loop for pair in cands | |
for num = (car pair) | |
for str = (cdr pair) | |
collect (popup-make-item | |
(format "%s:%s" num str)))) | |
(unless (and | |
iiimcf-UI-draw-lookup-choice-popup-instance | |
(popup-p iiimcf-UI-draw-lookup-choice-popup-instance)) | |
(setq iiimcf-UI-draw-lookup-choice-popup-instance | |
(popup-create (iiimcf-UI-draw-lookup-choice-popup-position) ; pos | |
(popup-preferred-width lst) ; width | |
10 ; height | |
:around t | |
:face 'popup-menu-face | |
:selection-face 'popup-menu-selection-face))) | |
(popup-set-list iiimcf-UI-draw-lookup-choice-popup-instance lst) | |
(popup-draw iiimcf-UI-draw-lookup-choice-popup-instance) | |
(popup-select iiimcf-UI-draw-lookup-choice-popup-instance index))) | |
(defun iiimcf-UI-clear-lookup-choice-popup (marker) | |
(when | |
(and | |
iiimcf-UI-draw-lookup-choice-popup-instance | |
(popup-p iiimcf-UI-draw-lookup-choice-popup-instance)) | |
(popup-delete iiimcf-UI-draw-lookup-choice-popup-instance)) | |
(setq iiimcf-UI-draw-lookup-choice-popup-instance nil)) | |
(defadvice iiimcf-UI-draw-lookup-choice-echo-line | |
(around iiimcf-ui-popup (mk candidates)) | |
(iiimcf-UI-draw-lookup-choice-popup mk candidates) | |
;ad-do-it | |
) | |
(defadvice iiimcf-UI-clear-lookup-choice-echo-line | |
(around iiimcf-ui-popup (mk)) | |
(iiimcf-UI-clear-lookup-choice-popup mk) | |
;ad-do-it | |
) | |
(ad-activate-regexp "^iiimcf-ui-popup") | |
;;(ad-unadvise 'iiimcf-UI-draw-lookup-choice-echo-line) | |
;;(ad-unadvise 'iiimcf-UI-clear-lookup-choice-echo-line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment