emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* extra newlines in TYPE checkitem for capture-templates
@ 2014-10-24  2:57 Brady Trainor
  2014-10-24  5:00 ` Brady Trainor
  0 siblings, 1 reply; 2+ messages in thread
From: Brady Trainor @ 2014-10-24  2:57 UTC (permalink / raw)
  To: emacs-orgmode



I am prepending a checkboxed plain list item to a file named "pomodoro.org" (I'm not really doing pomodoro here anymore, it started as this but the unique filename stuck, and it is my ad-hoc datetree). It is organized much like a datetree, but flatter and newest first, thus the use of prepend. However, the capture buffer includes two extra newlines, which I must get rid of before or after completing the capture. 

Is this desired behavior for capture-templates TYPE checkitem? 

I am still on ELPA version of org, 8.2.10. 

Here is my 

#+BEGIN_SRC emacs-lisp
(setq pomodoro "~/pomodoro.org")
(setq org-capture-templates
      `(("p" "pomodoro, checklist" checkitem (file ,pomodoro)
         ""
         :prepend t
         :empty-lines 0
         :empty-lines-before 0
         :empty-lines-after 0
         ;; :unnarrowed t
         )))
#+END_SRC

The result of consecutive captures looks like: 

#+BEGIN_SRC org

- [ ] a second capture

- [ ] a first capture

#+END

The spacing is doubled if I use `:unnarrowed t'. 

I have also tried `(file+regexp ,pomodoro "- \\[")', but I still get the extra line. 

A solution would be to use file+headline, then not using :prepend prevents an extra line, but my headline is the date and varies. 

Thank you, 

--
Brady

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

* Re: extra newlines in TYPE checkitem for capture-templates
  2014-10-24  2:57 extra newlines in TYPE checkitem for capture-templates Brady Trainor
@ 2014-10-24  5:00 ` Brady Trainor
  0 siblings, 0 replies; 2+ messages in thread
From: Brady Trainor @ 2014-10-24  5:00 UTC (permalink / raw)
  To: emacs-orgmode

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

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

end of thread, other threads:[~2014-10-24  5:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-24  2:57 extra newlines in TYPE checkitem for capture-templates Brady Trainor
2014-10-24  5:00 ` Brady Trainor

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