Closed driftcrow closed 4 years ago
I'm not sure what you're asking for. Please provide more detail and an example.
An example template for ledeger like: "%(org-read-date) * recieve %^{Received From} %^{For why} Assets:%^{Account|Personal|Home} %^{Amount} %^{Currency|CNY|USD|JPY} Income:Gifts "
these are multi field for input ,so I want when the cursor in some field the input switch to English, and in some fields as For why, from then switch the input method to Chinese for input Chinese word.
Thank you for the example. I understand what you're trying to achieve now. This use-case isn't general enough to integrate into doct, but it shouldn't be too hard to configure something.
You could add a function to minibuffer-setup-hook
which checks the prompt
and conditionally enables an input method. e.g.:
(defun +minibuffer-polyglot ()
"Switch input method if minibuffer prompt starts with \"!\"."
(if (string-prefix-p "!" (minibuffer-prompt))
(set-input-method "chinese-b5-quick")
(deactivate-input-method)))
(add-hook 'minibuffer-setup-hook #'+minibuffer-polyglot t)
Here the prompt for !one
should use the chinese-b5-quick
input method, and two
should use the default input method:
(let ((org-capture-templates
(doct '("polyglot test" :keys "p"
:file "/tmp/polyglot.org"
:type plain
:template "%^{!one} %^{two}"))))
(org-capture nil "p"))
Note this solution will work with any minibuffer prompt, which may be more than you want.
In that case I would look into temporarily adding the hook only during org-capture-mode,
or making use of minibuffer-with-setup-hook
if you're calling your own read function.
You can obviously also change the condition and input-method in +minibuffer-polyglot
to whatever suits your needs.
Does that help?
Most sincere thanks for your response my request , I'll try it .
support auto switch input method in some field like Chinese name