emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* using %(sexp) in remember templates
@ 2009-06-14 23:27 Shelagh Manton
  2009-06-15  5:01 ` Nick Dokos
  0 siblings, 1 reply; 3+ messages in thread
From: Shelagh Manton @ 2009-06-14 23:27 UTC (permalink / raw)
  To: emacs-orgmode

I'm trying to make a remember template that inserts some text 
automatically.

I read in the manual that %(sexp) would expand in the template. This 
would be what I want, if I've understood the manual aright. 

I made a small function that inserts text (org-csa) and this is the 
template I originally tried.
("CSA" ?C "* TODO %^{topic} %^g\n %t\n %(org-csa) %&" "CSA.org" bottom)

This put 

* TODO %^{topic} %^g
 <2009-06-15 Mon>
  %&

In the remember buffer.

I then tried 

("CSA" ?C "* TODO %^{topic} %^g\n %t\n %^(org-csa) %&" "~/.org/CSA.org" 
bottom)

Which prompted me for a string and added the (org-csa) in the remember 
buffer. (I filled in the various prompts)

* TODO charity ball :July:
 <2009-06-15 Mon>
 (org-csa) 

Have I misunderstood the manual? I thought that the sexp would be 
evaluated in the remember buffer. But neither with the ^ prompt which at 
least made the remember buffer work as expected or without where even the 
other prompts did not work at all, the (org-csa) did not get expanded.

Obviously I can evaluated it in the CSA.org buffer but that is not what I 
want at all. Maybe I should use org-eval? 

Shelagh

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

* Re: using %(sexp) in remember templates
  2009-06-14 23:27 using %(sexp) in remember templates Shelagh Manton
@ 2009-06-15  5:01 ` Nick Dokos
  2009-06-15  5:16   ` Shelagh Manton
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Dokos @ 2009-06-15  5:01 UTC (permalink / raw)
  To: Shelagh Manton; +Cc: emacs-orgmode

Shelagh Manton <shelagh.manton@gmail.com> wrote:

> I'm trying to make a remember template that inserts some text 
> automatically.
> 
> I read in the manual that %(sexp) would expand in the template. This 
> would be what I want, if I've understood the manual aright. 
> 
> I made a small function that inserts text (org-csa) and this is the 
> template I originally tried.
> ("CSA" ?C "* TODO %^{topic} %^g\n %t\n %(org-csa) %&" "CSA.org" bottom)
> 
The function should not insert anything into any buffer: it should
*return* what you want to be inserted. For example, the following
minimal .emacs works just fine (after fixing the path appropriately):

,----
| (add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp"))
| (add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode))
| (require 'org-install)
| (global-set-key "\C-cl" 'org-store-link)
| (global-set-key "\C-ca" 'org-agenda)
| 
| ;;;; 
| (setq org-remember-templates '(("CSA" ?C "* TODO %^{topic} %^g\n %t\n %(org-csa) %&" "CSA.org" bottom)))
| (defun org-csa ()
|     "foobar")
| (org-remember-insinuate)
| 
| ;;;;;
`----

HTH,
Nick

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

* Re: using %(sexp) in remember templates
  2009-06-15  5:01 ` Nick Dokos
@ 2009-06-15  5:16   ` Shelagh Manton
  0 siblings, 0 replies; 3+ messages in thread
From: Shelagh Manton @ 2009-06-15  5:16 UTC (permalink / raw)
  To: emacs-orgmode

On Mon, 15 Jun 2009 01:01:57 -0400, Nick Dokos wrote:

> Shelagh Manton <shelagh.manton@gmail.com> wrote:
> 
>> I'm trying to make a remember template that inserts some text
>> automatically.
>> 
>> I read in the manual that %(sexp) would expand in the template. This
>> would be what I want, if I've understood the manual aright.
>> 
>> I made a small function that inserts text (org-csa) and this is the
>> template I originally tried.
>> ("CSA" ?C "* TODO %^{topic} %^g\n %t\n %(org-csa) %&" "CSA.org" bottom)
>> 
> The function should not insert anything into any buffer: it should
> *return* what you want to be inserted. For example, the following
> minimal .emacs works just fine (after fixing the path appropriately):
> 
> ,----
> | (add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp")) |
> (add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" .
> org-mode)) | (require 'org-install)
> | (global-set-key "\C-cl" 'org-store-link) | (global-set-key "\C-ca"
> 'org-agenda) |
> | ;;;;
> | (setq org-remember-templates '(("CSA" ?C "* TODO %^{topic} %^g\n %t\n
> %(org-csa) %&" "CSA.org" bottom))) | (defun org-csa ()
> |     "foobar")
> | (org-remember-insinuate)
> |
> | ;;;;;
> `----
> 
> HTH,
> Nick
> 
> 
So my problem is that my function org-csa is inserting text? I will try 
this out.

Ah thanks that works nicely. A conceptual dissonance between returning 
values and inserting text.

Shelagh
> 
> 
> 
> _______________________________________________ Emacs-orgmode mailing
> list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2009-06-15  5:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-14 23:27 using %(sexp) in remember templates Shelagh Manton
2009-06-15  5:01 ` Nick Dokos
2009-06-15  5:16   ` Shelagh Manton

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