7 May 2012 14:28
Re: can I force all-caps in part of a headline in a capture template?
Christopher W. Ryan <cryan <at> binghamton.edu>
2012-05-07 12:28:37 GMT
2012-05-07 12:28:37 GMT
Richard, this is great! Thank you.
--Chris
Richard Lawrence wrote:
> Richard Lawrence<richard.lawrence <at> berkeley.edu> writes:
>
>> Try this: in your .emacs, add the following code:
>>
>> (defun prompt-for-lastname-and-upcase ()
>> (upcase (read-string "Last name: ")))
>>
>> This defines a function that will prompt the user to type a last name
>> into the minibuffer, converts the result into uppercase, and returns it
>> as a string.
>>
>> Then, in your capture template, change "%^{LASTNAME}" to
>> "%(prompt-for-lastname-and-upcase)".
>
>
> By the way, if you need to do the same thing for other fields, you can
> do something like this instead:
>
> (defun prompt-and-upcase (prompt-str)
> (upcase (read-string prompt-str)))
>
> This generalizes the original function I gave you; you can pass in a
> prompt string.
>
> Then, in your capture template, wherever you need an uppercase field:
>
> %(prompt-and-upcase "Whatever prompt you need: ")
>
> e.g.,
>
> %(prompt-and-upcase "Last name: ")
>
> Best,
> Richard
>
>
RSS Feed