942 |
;; the advice. |
;; the advice. |
943 |
(eval-after-load |
(eval-after-load |
944 |
"iso-acc" |
"iso-acc" |
945 |
(defadvice iso-accents-mode (around viper-iso-accents-advice activate) |
'(defadvice iso-accents-mode (around viper-iso-accents-advice activate) |
946 |
"Set viper-automatic-iso-accents to iso-accents-mode." |
"Set viper-automatic-iso-accents to iso-accents-mode." |
947 |
(let ((arg (ad-get-arg 0))) |
(let ((arg (ad-get-arg 0))) |
948 |
ad-do-it |
ad-do-it |
949 |
(setq viper-automatic-iso-accents |
(setq viper-automatic-iso-accents |
950 |
(if (eq viper-current-state 'vi-state) |
(if (eq viper-current-state 'vi-state) |
951 |
(if arg |
(if arg |
952 |
;; if iso-accents-mode was called with positive arg, turn |
;; if iso-accents-mode was called with positive arg, turn |
953 |
;; accents on |
;; accents on |
954 |
(> (prefix-numeric-value arg) 0) |
(> (prefix-numeric-value arg) 0) |
955 |
;; else: toggle viper-automatic-iso-accents |
;; else: toggle viper-automatic-iso-accents |
956 |
(not viper-automatic-iso-accents)) |
(not viper-automatic-iso-accents)) |
957 |
;; other states: accept what iso-accents-mode has done |
;; other states: accept what iso-accents-mode has done |
958 |
iso-accents-mode)) |
iso-accents-mode)) |
959 |
;; turn off ISO accents in vi-state |
;; turn off ISO accents in vi-state |
960 |
(if (eq viper-current-state 'vi-state) |
(if (eq viper-current-state 'vi-state) |
961 |
(viper-set-iso-accents-mode nil)) |
(viper-set-iso-accents-mode nil)) |
962 |
(if (memq viper-current-state '(vi-state insert-state replace-state)) |
(if (memq viper-current-state '(vi-state insert-state replace-state)) |
963 |
(message "Viper ISO accents mode: %s" |
(message "Viper ISO accents mode: %s" |
964 |
(if viper-automatic-iso-accents "on" "off"))) |
(if viper-automatic-iso-accents "on" "off"))) |
965 |
))) |
))) |
966 |
|
|
967 |
;; International input methods |
;; International input methods |
968 |
(if viper-emacs-p |
(if viper-emacs-p |
969 |
(eval-after-load "mule-cmds" |
(eval-after-load "mule-cmds" |
970 |
(progn |
'(progn |
971 |
(defadvice inactivate-input-method (after viper-mule-advice activate) |
(defadvice inactivate-input-method (after viper-mule-advice activate) |
972 |
"Set viper-special-input-method to disable intl. input methods." |
"Set viper-special-input-method to disable intl. input methods." |
973 |
(viper-inactivate-input-method-action)) |
(viper-inactivate-input-method-action)) |
974 |
(defadvice activate-input-method (after viper-mule-advice activate) |
(defadvice activate-input-method (after viper-mule-advice activate) |
975 |
"Set viper-special-input-method to enable intl. input methods." |
"Set viper-special-input-method to enable intl. input methods." |
976 |
(viper-activate-input-method-action)) |
(viper-activate-input-method-action)) |
977 |
)) |
)) |
978 |
;; XEmacs Although these hooks exist in Emacs, they don't seem to be always |
;; XEmacs Although these hooks exist in Emacs, they don't seem to be always |
979 |
;; called on input-method activation/deactivation, so we the above advise |
;; called on input-method activation/deactivation, so we the above advise |
980 |
;; functions instead. |
;; functions instead. |
981 |
(eval-after-load "mule-cmds" |
(eval-after-load "mule-cmds" |
982 |
(progn |
'(progn |
983 |
(add-hook 'input-method-activate-hook |
(add-hook 'input-method-activate-hook |
984 |
'viper-activate-input-method-action t) |
'viper-activate-input-method-action t) |
985 |
(add-hook 'input-method-inactivate-hook |
(add-hook 'input-method-inactivate-hook |
986 |
'viper-inactivate-input-method-action t))) |
'viper-inactivate-input-method-action t))) |
987 |
) |
) |
988 |
(eval-after-load "mule-cmds" |
(eval-after-load "mule-cmds" |
989 |
(defadvice toggle-input-method (around viper-mule-advice activate) |
'(defadvice toggle-input-method (around viper-mule-advice activate) |
990 |
"Adjust input-method toggling in vi-state." |
"Adjust input-method toggling in vi-state." |
991 |
(if (and viper-special-input-method (eq viper-current-state 'vi-state)) |
(if (and viper-special-input-method (eq viper-current-state 'vi-state)) |
992 |
(viper-inactivate-input-method) |
(viper-inactivate-input-method) |
993 |
ad-do-it))) |
ad-do-it))) |
994 |
|
|
995 |
) ; viper-set-hooks |
) ; viper-set-hooks |
996 |
|
|