emacs/sekka.el in sekka-0.8.8 vs emacs/sekka.el in sekka-0.9.0

- old
+ new

@@ -102,11 +102,17 @@ "変換結果に、漢字のエントリ type=j が含まれていなかったら、自動的にGoogleIMEを APIを使って変換候補を取得する。 non-nil で明示的に呼びだすまでGoogleIMEは起動しない。" :type 'boolean :group 'sekka) +(defcustom sekka-kakutei-with-spacekey t + "*Non-nil であれば、リアルタイムガイド表示中のSPACEキーでの確定動作を有効にする" + :type 'boolean + :group 'sekka) + + (defface sekka-guide-face '((((class color) (background light)) (:background "#E0E0E0" :foreground "#F03030"))) "リアルタイムガイドのフェイス(装飾、色などの指定)" :group 'sekka) @@ -693,11 +699,11 @@ (define-key sekka-select-mode-map "q" 'sekka-select-cancel) (define-key sekka-select-mode-map "\C-a" 'sekka-select-kanji) (define-key sekka-select-mode-map "\C-p" 'sekka-select-prev) (define-key sekka-select-mode-map "\C-n" 'sekka-select-next) (define-key sekka-select-mode-map sekka-rK-trans-key 'sekka-select-next) -(define-key sekka-select-mode-map " " 'sekka-select-next) +(define-key sekka-select-mode-map (kbd "SPC") 'sekka-select-next) (define-key sekka-select-mode-map "\C-u" 'sekka-select-hiragana) (define-key sekka-select-mode-map "\C-i" 'sekka-select-katakana) (define-key sekka-select-mode-map "\C-k" 'sekka-select-katakana) (define-key sekka-select-mode-map "\C-l" 'sekka-select-hankaku) (define-key sekka-select-mode-map "\C-e" 'sekka-select-zenkaku) @@ -712,10 +718,11 @@ (define-key map "\C-b" 'popup-close) (define-key map [left] 'popup-close) (define-key map "\C-n" 'popup-next) (define-key map "\C-j" 'popup-next) + (define-key map (kbd "SPC") 'popup-next) (define-key map [down] 'popup-next) (define-key map "\C-p" 'popup-previous) (define-key map [up] 'popup-previous) (define-key map [f1] 'popup-help) @@ -976,12 +983,12 @@ (let ((temp-list '())) (mapcar (lambda (alist) (let ((markers (sekka-assoc-ref 'markers alist nil))) (sekka-debug-print (format "markers=%S\n" markers)) - (sekka-debug-print (format "marker-position car=%d\n" (marker-position (car markers)))) - (sekka-debug-print (format "marker-position cdr=%d\n" (marker-position (cdr markers)))) + (sekka-debug-print (format "marker-position car=%S\n" (marker-position (car markers)))) + (sekka-debug-print (format "marker-position cdr=%S\n" (marker-position (cdr markers)))) (when (and (marker-position (car markers)) ;; 存在するバッファを指しているか (marker-position (cdr markers))) (if (= (marker-position (car markers)) (marker-position (cdr markers))) ;; マークの開始と終了が同じ位置を指している場合は、 @@ -1285,10 +1292,35 @@ (cons ,(string-to-char (cdr pair)) unread-command-events)) nil)))) sticky-list) (define-key sticky-map sticky-key '(lambda ()(interactive)(insert sticky-key)))) + +(defun sekka-spacekey-init-function () + (define-key global-map (kbd "SPC") + '(lambda (&optional arg)(interactive "P") + (cond ((and (< 0 sekka-timer-rest) + sekka-kakutei-with-spacekey) + (cond + ((string= " " (char-to-string (preceding-char))) + (insert " ")) + ((eq 10 (preceding-char)) ;; 直前に改行があった + (insert " ")) + ((string= "/" (char-to-string (preceding-char))) + (delete-region (- (point) 1) (point)) + (insert " ")) + (t + (sekka-rK-trans)))) + (t + (cond + ((null arg) + (insert " ")) + (t + (dotimes(i arg) + (insert " "))))))))) + + (defun sekka-realtime-guide () "リアルタイムで変換中のガイドを出す sekka-modeがONの間中呼び出される可能性がある。" (cond ((or (null sekka-mode) @@ -1408,10 +1440,13 @@ (sekka-kill-sekka-mode)) (setq sekka-mode (if (null arg) (not sekka-mode) (> (prefix-numeric-value arg) 0)))) (when sekka-sticky-shift (add-hook 'sekka-mode-hook 'sekka-sticky-shift-init-function)) + + (add-hook 'sekka-mode-hook 'sekka-spacekey-init-function) + (when sekka-mode (run-hooks 'sekka-mode-hook)) (sekka-debug-print "sekka-mode-internal :2\n") ;; Ctrl-G押下時、リアルタイムガイドをOFFにするhook @@ -1453,10 +1488,10 @@ ;; input-method として登録する。 (set-language-info "Japanese" 'input-method "japanese-sekka") (setq default-input-method "japanese-sekka") (defconst sekka-version - "0.8.8" ;;SEKKA-VERSION + "0.9.0" ;;SEKKA-VERSION ) (defun sekka-version (&optional arg) "入力モード変更" (interactive "P") (message sekka-version))