In my workflow I copy emails into an orgmode file. I'd like to have head of the email formatted. In english emails (just as an explanation) I'd like to have *To:*
instead of To:
, because orgmode then prints the word between the two stars in bold. The word "To:" occurs at the beginning of a new line, but empty spaces may occur before the "To:" in the new line.
So the question is, can you write a function that replaces in a region (!) the words
"Von:", "Gesendet:", "An:", "Cc:", "Betreff:"
with
"*Von:*", , "*Gesendet:*", "*An:*", "*Cc:*", "*Betreff:*"
under the condition that the string is at the beginning of a new line, multiple empty spaces before the string are allowed.
I put the strings into "", but in the copied emails there are no "" around them, it's only Von:
, of course.
Let's assume the name of the function is "email-header". I'd mark a region in a buffer and do M-x email-header
and in the region all mentioned keywords shall be replaced as described.
Yeah, well, I'm only a user and hacking an example like https://stackoverflow.com/a/2592685 is far beyond my capabilities.