emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Use Question] Capture and long lines
@ 2011-06-22 17:16 Matthew Sauer
  2011-06-22 18:09 ` Nick Dokos
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Sauer @ 2011-06-22 17:16 UTC (permalink / raw)
  To: Org Mode Mailing List

I have one structured org file I use for school that I leave in long
lines.  The capture template I have setup has \n at the end of what I
would want to be a line but is still stringing them together in one
long line until i reach my wrap point.  My headline has my deadline in
it and org recognizes the deadline but that isn't working to get a new
line inserted (an actual hard return).  Org is recongnizing it as a
new line but it just runs in one long line.  Am I missing something
obvious or ????    If it isn't something obvious I will make up a
sample target file, example of a capture and send them out to the
group

* WORKING Read Chapter 9  :ENGL102: \n
DEADLINE:<2011-06-28 Tue 18:30>\n  ADDEND:<2011-06-28 Tue
 00:00>\n :

Also the logbook just keeps adding in as one long line
:LOGBOOK: -State "STARTED  from "TODO" [2011-06-22 Wed 09:56] :END:


Is this inherent in the way it works with longlines or is their a way
to insert: ¶
when I want an actual hard return in the template that is going into
the longlines file?

Matthew

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

* Re: [Use Question] Capture and long lines
  2011-06-22 17:16 [Use Question] Capture and long lines Matthew Sauer
@ 2011-06-22 18:09 ` Nick Dokos
  2011-06-27  3:17   ` Matthew Sauer
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Dokos @ 2011-06-22 18:09 UTC (permalink / raw)
  To: Matthew Sauer; +Cc: nicholas.dokos, Org Mode Mailing List

Matthew Sauer <improv.philosophy@gmail.com> wrote:

> I have one structured org file I use for school that I leave in long
> lines.  The capture template I have setup has \n at the end of what I
> would want to be a line but is still stringing them together in one
> long line until i reach my wrap point.  My headline has my deadline in
> it and org recognizes the deadline but that isn't working to get a new
> line inserted (an actual hard return).  Org is recongnizing it as a
> new line but it just runs in one long line.  Am I missing something
> obvious or ????    If it isn't something obvious I will make up a
> sample target file, example of a capture and send them out to the
> group
> 
> * WORKING Read Chapter 9  :ENGL102: \n
> DEADLINE:<2011-06-28 Tue 18:30>\n  ADDEND:<2011-06-28 Tue
>  00:00>\n :
> 
> Also the logbook just keeps adding in as one long line
> :LOGBOOK: -State "STARTED  from "TODO" [2011-06-22 Wed 09:56] :END:
> 
> 

Looks as if you are escaping the newlines - are you using \\n in your
templates? If so, try losing one of the backslashes - or put explicit
newlines in the string which should amount to the same thing:

(setq org-capture-templates
'(                   ("t" "" entry (file+headline "~/lib/org/todo.org" "Tasks") "* TODO %?
  %U %a" :prepend t)
                     ...
))

Nick

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

* Re: [Use Question] Capture and long lines
  2011-06-22 18:09 ` Nick Dokos
@ 2011-06-27  3:17   ` Matthew Sauer
  2011-06-27  6:39     ` Nick Dokos
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Sauer @ 2011-06-27  3:17 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Org Mode Mailing List

[-- Attachment #1: Type: text/plain, Size: 2087 bytes --]

I can refile into the longlines format buffer and it looks fine until
I close and reopen the buffer, then it is all drawn out into one long
line, the headline instead of broken up.   One other behavior I have
noticed is that when I change state it generates the logbook and
changes the state but then changes it from
:LOGBOOK:
- state changed from etc
:END:
to all being in one long line like
:LOGBOOK - state changed from etc :END: . . .

I have attatched a sample buffer with some sample TODO's refiled in
from capture and the capture templates out of my .emacs in it as well.

Matthew




On Wed, Jun 22, 2011 at 1:09 PM, Nick Dokos <nicholas.dokos@hp.com> wrote:
> Matthew Sauer <improv.philosophy@gmail.com> wrote:
>
>> I have one structured org file I use for school that I leave in long
>> lines.  The capture template I have setup has \n at the end of what I
>> would want to be a line but is still stringing them together in one
>> long line until i reach my wrap point.  My headline has my deadline in
>> it and org recognizes the deadline but that isn't working to get a new
>> line inserted (an actual hard return).  Org is recongnizing it as a
>> new line but it just runs in one long line.  Am I missing something
>> obvious or ????    If it isn't something obvious I will make up a
>> sample target file, example of a capture and send them out to the
>> group
>>
>> * WORKING Read Chapter 9  :ENGL102: \n
>> DEADLINE:<2011-06-28 Tue 18:30>\n  ADDEND:<2011-06-28 Tue
>>  00:00>\n :
>>
>> Also the logbook just keeps adding in as one long line
>> :LOGBOOK: -State "STARTED  from "TODO" [2011-06-22 Wed 09:56] :END:
>>
>>
>
> Looks as if you are escaping the newlines - are you using \\n in your
> templates? If so, try losing one of the backslashes - or put explicit
> newlines in the string which should amount to the same thing:
>
> (setq org-capture-templates
> '(                   ("t" "" entry (file+headline "~/lib/org/todo.org" "Tasks") "* TODO %?
>  %U %a" :prepend t)
>                     ...
> ))
>
> Nick
>

[-- Attachment #2: test.org --]
[-- Type: application/octet-stream, Size: 2608 bytes --]

* Configuration
#+TITLE:     Test.org
#+AUTHOR:    Matthew Sauer
#+EMAIL:     Improv.Philosophy@gmail.com
#+DATE:      2011-02-05 Sat
#+DESCRIPTION: 
#+KEYWORDS: 
#+LANGUAGE:  en
#+OPTIONS:   H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
#+OPTIONS:   TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc
#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
#+EXPORT_SELECT_TAGS: export
#+EXPORT_EXCLUDE_TAGS: noexport
#+LINK_UP:   
#+LINK_HOME: 
#+XSLT: 
# Local Variables:
# mode: flyspell
# mode: longlines
# auto-fill-inhibit-regexp: "\\#\\+?"
# Local Variables:
# mode: flyspell
# mode: longlines
# fill-column: 130
# End:
* Tasks
** TODO Test todo \n :TEST:\n %G\n Added: [2011-06-26 Sun 12:50]\n \n 
** TODO Test2     :LOGBOOK:    - Refiled on [2011-06-26 Sun 12:56]    :END:  :TEST: %G Added: [2011-06-26 Sun 12:55] * Appts
** Recently Modified     :LOGBOOK:    :END:
** TODO Test3   :TEST: %G Added: [2011-06-26 Sun 22:05]
* Calendar

* Capture

Here are the capture templates


 '(org-capture-templates (quote (("H" "English Homework" entry (file+headline "/cygdrive/c/Dropbox/Org/Engl102.org" "Homework") "* TODO  %^{Description}   %^G \n             DEADLINE:%^{Deadline:}T\n             %T\\n             %?" :empty-lines 1) ("t" "TODO" entry (file+headline "/cygdrive/c/Dropbox/Org/Refile.org" "Refile") "* TODO %^{Brief Description} \n %^g\n %G\n Added: %U\n %?\n") ("j" "Journal/Blog/Private" entry (file+headline "/cygdrive/c/Dropbox/Org/Refile.org" "Refile") "* %^{Head Line} %U %^g\n Added:%T\n %i%?\n") ("a" "Appt" entry (file+headline "/cygdrive/c/Dropbox/Org/Refile.org" "Refile") "* %^{Brief Description}  %^g\n  %^{When?}T \n %?\n Added: %U %\n") ("s" "Someday" entry (file+headline "/cygdrive/c/Dropbox/Org/someday.org" "Someday") "* %^{Someday Heading} %U\n Added: %T\n	   %?\\n ") ("c" "Contact" entry (file+headline "/cygdrive/c/Dropbox/Org/Contacts.org" "Contacts") " * %^{Contact Name}\n :PROPERTIES:\n :EMAIL: %^{Contact Email}\n :PHONE: %^{Contact Phone}\n :NOTES: %^{Notes?}\n :END:\\n") ("e" "English Notes" entry (file+datetree "/cygdrive/c/Dropbox/Org/Engl102.org") "* %^{Headline} \n             %^g\n Added: %T\n %?\n" :empty-lines 1) ("u" "Theatre" entry (file+datetree "/cygdrive/c/Dropbox/Org/Thea143.org") "* %^{Class Session:} %^g\n Added: %T\n  %k\n %K\n %?\n" :empty-lines 1) ("l" "Clock This" entry (file+headline "/cygdrive/c/Dropbox/Org/Refile.org" "Refile") "* %^{What to clock}\n ADDED:%T\n %?\n            " :empty-lines 1 :clock-in t :clock-keep t))))



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

* Re: [Use Question] Capture and long lines
  2011-06-27  3:17   ` Matthew Sauer
@ 2011-06-27  6:39     ` Nick Dokos
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Dokos @ 2011-06-27  6:39 UTC (permalink / raw)
  To: Matthew Sauer; +Cc: nicholas.dokos, Org Mode Mailing List

Matthew Sauer <improv.philosophy@gmail.com> wrote:

> I can refile into the longlines format buffer and it looks fine until
> I close and reopen the buffer, then it is all drawn out into one long
> line, the headline instead of broken up.   One other behavior I have
> noticed is that when I change state it generates the logbook and
> changes the state but then changes it from
> :LOGBOOK:
> - state changed from etc
> :END:
> to all being in one long line like
> :LOGBOOK - state changed from etc :END: . . .
> 
> I have attatched a sample buffer with some sample TODO's refiled in
> from capture and the capture templates out of my .emacs in it as well.
> 

I don't know much about longlines, so the following is pretty much a
flying guess: I have not tested it, I have not even tried to implement
it. Forewarned is forearmed.

longlines implements "hard" newlines by giving them a 'hard
text-property.  So after the template is inserted into the capture
buffer, you need to turn the newlines into hard newlines by doing
something like what longlines-decode-region does: go through the buffer
and add the text-property to each newline. longlines-decode-region does
that with the following code:

--8<---------------cut here---------------start------------->8---
  (save-excursion
    (let ((reg-max (max beg end)))
      (goto-char (min beg end))
      (while (search-forward "\n" reg-max t)
	(set-hard-newline-properties
	 (match-beginning 0) (match-end 0)))))
--8<---------------cut here---------------end--------------->8---

So you write a function that does that and hook it into the capture process
at the appropriate point: after the template is inserted into the
capture buffer but before you have entered any data. I think
org-capture-mode-hook will do that, but again I don't know for sure[fn:1]. And
of course you need to do that conditionally, otherwise every capture
will go through this process, which you probably don't want.

Again, I emphasize the tentative nature of these suggestions. I hope they
are useful, but they may be completely off the mark.

Nick


> 
> 
> 
> On Wed, Jun 22, 2011 at 1:09 PM, Nick Dokos <nicholas.dokos@hp.com> wrote:
> > Matthew Sauer <improv.philosophy@gmail.com> wrote:
> >
> >> I have one structured org file I use for school that I leave in long
> >> lines.  The capture template I have setup has \n at the end of what I
> >> would want to be a line but is still stringing them together in one
> >> long line until i reach my wrap point.  My headline has my deadline in
> >> it and org recognizes the deadline but that isn't working to get a new
> >> line inserted (an actual hard return).  Org is recongnizing it as a
> >> new line but it just runs in one long line.  Am I missing something
> >> obvious or ????    If it isn't something obvious I will make up a
> >> sample target file, example of a capture and send them out to the
> >> group
> >>
> >> * WORKING Read Chapter 9  :ENGL102: \n
> >> DEADLINE:<2011-06-28 Tue 18:30>\n  ADDEND:<2011-06-28 Tue
> >>  00:00>\n :
> >>
> >> Also the logbook just keeps adding in as one long line
> >> :LOGBOOK: -State "STARTED  from "TODO" [2011-06-22 Wed 09:56] :END:
> >>
> >>
> >
> > Looks as if you are escaping the newlines - are you using \\n in your
> > templates? If so, try losing one of the backslashes - or put explicit
> > newlines in the string which should amount to the same thing:
> >
> > (setq org-capture-templates
> > '(                   ("t" "" entry (file+headline "~/lib/org/todo.org" "Tasks") "* TODO %?
> >  %U %a" :prepend t)
> >                     ...
> > ))
> >
> > Nick
> >

Footnotes:

[fn:1] Some experiments suggest that the hook is actually run twice:
that may (or may not) complicate things - I don't know.

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

end of thread, other threads:[~2011-06-27  6:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-22 17:16 [Use Question] Capture and long lines Matthew Sauer
2011-06-22 18:09 ` Nick Dokos
2011-06-27  3:17   ` Matthew Sauer
2011-06-27  6:39     ` Nick Dokos

Code repositories for project(s) associated with this 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).