emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* can I force all-caps in part of a headline in a capture template?
@ 2012-05-07  0:20 Christopher W. Ryan
  2012-05-07  3:02 ` Richard Lawrence
  0 siblings, 1 reply; 4+ messages in thread
From: Christopher W. Ryan @ 2012-05-07  0:20 UTC (permalink / raw)
  To: emacs-orgmode

I work for a public health department. Twice in the past 5 years we have 
had to open evacuation shelters during a flood, for anywhere from 80 to 
120 medically-frail evacuees. Our documentation system (paper) has 
improved, but it is still not ideal. I am experimenting with whether 
org-mode could meet our needs. It's basis in plain text may strike the 
proper balance between structure and flexibility.

Part of my .emacs includes the following:

(setq org-capture-templates
       '(("a" "Admit" entry
         (file "~/Shelter/ShelterAdmissions.org")
          "* admit  %^{LASTNAME},  %^{firstname} %U
           :PROPERTIES:
           %^{IDnumber}p
           %^{Birthdate}p
           %^{Age}p
           %^{Sex}p
           %^{Address1}p
           %^{Address2}p
           %^{City}p
           %^{State}p
           %^{Zipcode}p
           %^{Doctor1}p
           %^{Doctor2}p
           %^{Pharmacy1}p
           %^{Pharmacy2}p"
           :empty-lines: 1)
           )
)

The first line in my ShelterAdmissions.org file is:

#+TODO: admit(a) in(i!) out(o@) |  discharged(d@)

and things are working pretty well so far.

I'd like to know if there is a way to force LASTNAME to show up in 
all-caps in ShelterAdmissions.org, regardless of how it is typed into 
the capture template.

Thanks.

--Chris Ryan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: can I force all-caps in part of a headline in a capture template?
  2012-05-07  0:20 can I force all-caps in part of a headline in a capture template? Christopher W. Ryan
@ 2012-05-07  3:02 ` Richard Lawrence
  2012-05-07  3:24   ` Richard Lawrence
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Lawrence @ 2012-05-07  3:02 UTC (permalink / raw)
  To: emacs-orgmode

Hi Chris,

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)".

Best,
Richard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: can I force all-caps in part of a headline in a capture template?
  2012-05-07  3:02 ` Richard Lawrence
@ 2012-05-07  3:24   ` Richard Lawrence
  2012-05-07 12:28     ` Christopher W. Ryan
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Lawrence @ 2012-05-07  3:24 UTC (permalink / raw)
  To: emacs-orgmode

Richard Lawrence <richard.lawrence@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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: can I force all-caps in part of a headline in a capture template?
  2012-05-07  3:24   ` Richard Lawrence
@ 2012-05-07 12:28     ` Christopher W. Ryan
  0 siblings, 0 replies; 4+ messages in thread
From: Christopher W. Ryan @ 2012-05-07 12:28 UTC (permalink / raw)
  To: emacs-orgmode

Richard, this is great!  Thank you.

--Chris

Richard Lawrence wrote:
> Richard Lawrence<richard.lawrence@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
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-05-07 12:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-07  0:20 can I force all-caps in part of a headline in a capture template? Christopher W. Ryan
2012-05-07  3:02 ` Richard Lawrence
2012-05-07  3:24   ` Richard Lawrence
2012-05-07 12:28     ` Christopher W. Ryan

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).