summaryrefslogtreecommitdiff
path: root/input-conf.el
diff options
context:
space:
mode:
Diffstat (limited to 'input-conf.el')
-rw-r--r--input-conf.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/input-conf.el b/input-conf.el
index ce01599..1ea7f0d 100644
--- a/input-conf.el
+++ b/input-conf.el
@@ -124,5 +124,24 @@ then enters the string STR, and returns the inputted string."
(kill-buffer temp-buffer)
result))
+(defun durand-convert-region-by-input-method (start end method)
+ "Convert the string in the region between START and END by the
+input-method METHOD.
+
+See the function `durand-convert-string-by-input-method' for
+more."
+ (interactive
+ (append
+ (cond ((region-active-p)
+ (list (region-beginning) (region-end)))
+ ((list (point) (point))))
+ (list (read-input-method-name "By which input method: "))))
+ (let* ((str (buffer-substring-no-properties start end))
+ (converted
+ (durand-convert-string-by-input-method str method)))
+ (delete-region start end)
+ (goto-char start)
+ (insert converted)))
+
(provide 'input-conf)
;;; input-conf.el ends here