emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Brady Trainor <algebrat@uw.edu>
To: emacs-orgmode@gnu.org
Subject: Re: extra newlines in TYPE checkitem for capture-templates
Date: Thu, 23 Oct 2014 22:00:23 -0700	[thread overview]
Message-ID: <87oat2njtk.fsf@uw.edu> (raw)
In-Reply-To: 87siiegonc.fsf@uw.edu

Brady Trainor <algebrat@uw.edu> writes:
>
> A solution would be to use file+headline, then not using :prepend
> prevents an extra line, but my headline is the date and varies.
>

I solved my problem this way by modifying the function insert-date-N-days-from-current to print instead of insert. Now I can use file+headline and avoid :prepend. 

#+BEGIN_SRC emacs-lisp
(defun print-date-N-days-from-current (&optional days)
  "Print date that is DAYS from current."
  (interactive "p*")
  (print
   (calendar-date-string
    (calendar-gregorian-from-absolute
     (+ (calendar-absolute-from-gregorian (calendar-current-date))
        days)))))

(setq org-capture-templates
      `(("p" "pomodoro, checklist"
         checkitem (file+headline ,pomodoro ,(print-date-N-days-from-current 0))
         ""))) 
#+END_SRC

--
Brady

      reply	other threads:[~2014-10-24  5:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-24  2:57 extra newlines in TYPE checkitem for capture-templates Brady Trainor
2014-10-24  5:00 ` Brady Trainor [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87oat2njtk.fsf@uw.edu \
    --to=algebrat@uw.edu \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).