From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: [Use Question] Capture and long lines Date: Mon, 27 Jun 2011 02:39:53 -0400 Message-ID: <6153.1309156793@alphaville.dokosmarshall.org> References: <5115.1308766157@alphaville.americas.hpqcorp.net> Reply-To: nicholas.dokos@hp.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:60410) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qb5UU-00041t-Bg for emacs-orgmode@gnu.org; Mon, 27 Jun 2011 02:40:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qb5US-0002Y2-Hr for emacs-orgmode@gnu.org; Mon, 27 Jun 2011 02:40:14 -0400 Received: from vms173017pub.verizon.net ([206.46.173.17]:38258) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qb5US-0002Xw-93 for emacs-orgmode@gnu.org; Mon, 27 Jun 2011 02:40:12 -0400 Received: from alphaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173017.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LNF00GGQRUIZP60@vms173017.mailsrvcs.net> for emacs-orgmode@gnu.org; Mon, 27 Jun 2011 01:39:59 -0500 (CDT) In-reply-to: Message from Matthew Sauer of "Sun\, 26 Jun 2011 22\:17\:35 CDT." List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Matthew Sauer Cc: nicholas.dokos@hp.com, Org Mode Mailing List Matthew Sauer 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: . . . >=20 > 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. >=20 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 >=20 >=20 >=20 > On Wed, Jun 22, 2011 at 1:09 PM, Nick Dokos wrote: > > Matthew Sauer wrote: > > > >> I have one structured org file I use for school that I leave in long > >> lines. =C2=A0The capture template I have setup has \n at the end of wh= at I > >> would want to be a line but is still stringing them together in one > >> long line until i reach my wrap point. =C2=A0My headline has my deadli= ne in > >> it and org recognizes the deadline but that isn't working to get a new > >> line inserted (an actual hard return). =C2=A0Org is recongnizing it as= a > >> new line but it just runs in one long line. =C2=A0Am I missing somethi= ng > >> obvious or ???? =C2=A0 =C2=A0If 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 =C2=A0:ENGL102: \n > >> DEADLINE:<2011-06-28 Tue 18:30>\n =C2=A0ADDEND:<2011-06-28 Tue > >> =C2=A000:00>\n : > >> > >> Also the logbook just keeps adding in as one long line > >> :LOGBOOK: -State "STARTED =C2=A0from "TODO" [2011-06-22 Wed 09:56] :EN= D: > >> > >> > > > > 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 > > '( =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ("t" = "" entry (file+headline "~/lib/org/todo.org" "Tasks") "* TODO %? > > =C2=A0%U %a" :prepend t) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .= .. > > )) > > > > 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.