How to auto upcase after prompt insert in capture templates

I am using org-roam-dailies-capture-templates for inserting vocabulary items (in their own subheader) in my dailies files for later reviewing with org-drill.

I got the capture template itself stored in ~/org/roam-capture-templates/ directory. Here’s the en_vocab.org file contents:

*** New word: %^{New word}                                :@drill:@enVocab:

%\1

**** meaning:

1. %?

When I call the template, I enter the new english word into the %^{New word} prompt. The %\1 simply repeats the word I entered in its place, giving the org-drill flashcard its front face. Now, the question is this: how do I get the template AUTO-CAPITALIZE, ie, turn the word I entered in %^{New word} prompt into ALL-CAPS?

I’ve spent hours trying to find solution online. Forums, stackexchange, and LLM agents didn’t yield a solution. Do you guys know a way to achieve that?

Any ideas? I would also like to know if org capture templates do not have a built-in functionality for upcase’ing the prompt inputs of the user.

So you repeat the word you enter in the prompt. You want both to be capitalized?

I am not sure if capitalization can be done with a built-in functionality.

Why do you need capitalization? Why not just enter all capital letters when promoted?

Yes.

CapsLock is too far away from my fingers. When I capture a word I don’t want to bother with hitting difficult to reach capslock key. I just want to jot it down and let emacs handle the auto upcase’ing.

Sure. But why do you want to use “WORD” instead of “word”?

I do not think it is easy within org-capture-templates / org-roam-capture-templates.

Capitalization catches my eye among my other notes in the dailies pages.
It gives a distinction and improves the overall structure of the daily
page, imo.

You can do this

*** New word: %(upcase (read-string \"New word: \"))

But then %\1 won’t repeat the word you enter.

If you don’t need to use capture template, I would not. But if you have a reason to use a capture template, then you would probably need to pass the WORD to a global variable. It feels a bit too complex a solution for the outcome if it were for me. I cannot judge how much capitalization means to you, so you could pursue this further.

Alternatively, it’s probably easier to create a command like this and assign a keybinding:

(defun my/upcase ()
  (interactive)
  (upcase-word -1))

If you replace the keybinding for upcase-word (M-u by default), when you enter a word in the prompt, you can upcase the word before the cursor.

No need to reach to a far-away key.

1 Like

If youd really like to achieve this without the easy path mentioned by @nobiot then you can try to modify the org-capture-fill-template and create a version for just this need.

Any step youd take will increase the complexity immensely - fundamentally this is not a hill i would like to die on.

I can even imagine creating a function that would iterate over files in the dailies directory and depending on specific parameters placed before do this capitalisation –

either ways the complexity is too much, using the right side shift key is the preferred solution - I don’t think capitalising some words while writing will disturb your thinking midway in any way -

but for the general class of problem that the mnemonic based keybinding loses its appeal after muscle memory has been built - I would try to establish a keybinding system that places statistically important keys in appropriate place - but this is altogether a different problem.