Created
October 7, 2010 05:35
-
-
Save iRi-E/614604 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
;; Define a command to toggle zenkaku/hankaku of parentheses in DDSKK, | |
;; and automatically select it according to major mode. | |
(defvar my-skk-paren-state nil | |
"Non-nil means use zenkaku parentheses in DDSKK.") | |
(make-variable-buffer-local 'my-skk-paren-state) | |
(defvar my-skk-zenkaku-paren-major-modes | |
'(text-mode | |
LaTeX-mode) | |
"List of major mode's symbols that zenkaku parentheses are used | |
prior to ASCII ones.") | |
(eval-after-load 'skk | |
'(progn | |
(defun my-skk-paren-left (arg) | |
(if my-skk-paren-state "(" "(")) | |
(defun my-skk-paren-right (arg) | |
(if my-skk-paren-state ")" ")")) | |
;; Register rules | |
(mapc (lambda (rule) | |
(add-to-list 'skk-rom-kana-rule-list rule)) | |
'(("(" nil my-skk-paren-left) | |
(")" nil my-skk-paren-right))) | |
(setq skk-rule-tree (skk-compile-rule-list | |
skk-rom-kana-base-rule-list | |
skk-rom-kana-rule-list)) | |
(defun my-skk-toggle-paren (arg) | |
(interactive "P") | |
(if (setq my-skk-paren-state | |
(if (null arg) | |
(not my-skk-paren-state) | |
(> (prefix-numeric-value arg) 0))) | |
(message "DDSKK uses zenkaku parentheses") | |
(message "DDSKK uses hannkaku parentheses"))) | |
(add-hook 'after-change-major-mode-hook | |
(lambda () | |
(if (memq major-mode my-skk-zenkaku-paren-major-modes) | |
(my-skk-toggle-paren 1)))) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment