[O] "Body" of current section
Hello I can use org-element-at-point to get information about the current section. What function do I run in order to get its "body" i.e. ignoring the header and the properties drawer? Many thanks Richard
Re: [O] Function to return content of item
That is very kind of you - many thanks indeed for your assistance. On Mon, May 8, 2017 at 4:05 PM, John Kitchin <jkitc...@andrew.cmu.edu> wrote: > I think this is basically what you are looking for. > > (defun org-heading-content () > (interactive) > (let (bp ep) > (setq bp (save-excursion >(or (and (outline-previous-heading) > (progn (org-end-of-meta-data) >(point))) >(point-min))) > ep (save-excursion >(or (and (outline-next-heading) (point)) >(point-max > (buffer-substring-no-properties bp ep))) > > Richard Parsons writes: > > > John, many thanks for your reply. > > > > Regarding subheadings, I would only want the content of the current > > sub-item, so if it is a subheading I only want the text from after the > > subheading (and after its property drawer) up to the next heading (or the > > end of the file). > > > > Also, when I run your code on a paragraph, I just get the contents from > > that paragraph (rather than all paragraphs in that item). Maybe "item" is > > the wrong work, is "node" better? > > > > Maybe I need to write some code using the org motion commands in order to > > manually identify the region that I'm looking for. > > > > Many thanks > > Richard > > > > > > On Mon, May 8, 2017 at 1:45 AM, John Kitchin <jkitc...@andrew.cmu.edu> > > wrote: > > > >> I don't know of a function. Something like this may be what you want. > >> not all elements have :contents-begin though > >> > >> (let ((el (org-element-context))) > >> (buffer-substring-no-properties > >> (org-element-property :contents-begin el) > >> (org-element-property :contents-end el))) > >> > >> > >> It also a little tricky to figure out what to do about subheadings. Do > >> they count as content or not? > >> > >> Richard Parsons writes: > >> > >> > Hi there > >> > > >> > Is there a function that will give me the content of the current > item? I > >> > mean simply the text of the whole item without its heading or > properties > >> > drawer. > >> > > >> > It seems to me likely that such a function would exist, but I haven't > >> been > >> > able to find it in the documentation. > >> > > >> > Many thanks > >> > Richard > >> > >> > >> -- > >> Professor John Kitchin > >> Doherty Hall A207F > >> Department of Chemical Engineering > >> Carnegie Mellon University > >> Pittsburgh, PA 15213 > >> 412-268-7803 > >> @johnkitchin > >> http://kitchingroup.cheme.cmu.edu > >> > > > -- > Professor John Kitchin > Doherty Hall A207F > Department of Chemical Engineering > Carnegie Mellon University > Pittsburgh, PA 15213 > 412-268-7803 > @johnkitchin > http://kitchingroup.cheme.cmu.edu > -- Richard Parsons Email: richard.lee.pars...@googlemail.com
[O] Function to return content of item
Hi there Is there a function that will give me the content of the current item? I mean simply the text of the whole item without its heading or properties drawer. It seems to me likely that such a function would exist, but I haven't been able to find it in the documentation. Many thanks Richard
[O] Show 'Project' in Agenda
Hello everyone In the agenda view, I can see the headline above each TODO by moving point to it. The headline appears in the status bar. Is there a way that I can add a column to the agenda with all those headlines in, so that I can see them all at once? Thanks Richard
[O] Sorting Agenda By Priority
Hi all I want to sort the agenda file so that the tasks marked with priorities A, B and C are all at the top, with tasks marked with no priority underneath. I've tried reading the manual on this (http://orgmode.org/manual/Sorting-of-agenda-items.html#Sorting-of-agenda-items), but don't understand it. I'm guessing that I have to change the variable org-agenda-sorting-strategy somehow, but I'm not sure what to. Thanks for helping a new user! Richard
Re: [O] Sorting Agenda By Priority
On Fri, Oct 7, 2011 at 12:26 PM, Bernt Hansen be...@norang.ca wrote: Richard Parsons richard.lee.pars...@gmail.com writes: Hi all I want to sort the agenda file so that the tasks marked with priorities A, B and C are all at the top, with tasks marked with no priority underneath. I've tried reading the manual on this (http://orgmode.org/manual/Sorting-of-agenda-items.html#Sorting-of-agenda-items), but don't understand it. I'm guessing that I have to change the variable org-agenda-sorting-strategy somehow, but I'm not sure what to. Thanks for helping a new user! Welcome to the org-mode community! Thank you very much. It's a great community and I continue to be very impressed. What you describe should be the default behaviour. But items with no priority default to B so you need to drop the default priority below the items you normally set a priority for (ie D if A, B, and C are the only priorities you use). Ah, so I was barking up the wrong tree. See org-default-priority, org-lowest-priority ,[ example org file ] | * TODO [#C] Priority C task | * TODO [#B] Priority B task | * TODO [#A] High priority task | * TODO Some other task | | (setq org-default-priority ?D) | (setq org-lowest-priority ?F) That worked perfectly. Thanks! Richard
[O] Merge Properties into Template
Hi all I'm new to emacs and I'm new to org-mode, apologies if I should have found this myself, but I have searched and come up blank. I have a node with properties and I would like to merge that data into a template. For example: * Dogs ** Fido :PROPERTIES: :BREED:West Highland Terrier :COLOR:White :AGE: 2 :END: * Templates ** Dog Template Your dog, called [HEADLINE], is a [COLOR] [BREED], who is [AGE] years old. I want to merge the item called Fido into the template called Dog Template. Could someone point me to the right bit of the manual so I can learn how to do this? Or should I be looking to use a different elisp module to achieve this, something that plays nicely with org-mode? Many thanks Richard
Re: [O] Merge Properties into Template
Hi Christian On Thu, Oct 6, 2011 at 1:50 PM, Christian Moe m...@christianmoe.com wrote: Org doesn't already have a particular way to do this, I think, so a little elisp is called for. It's fairly easy with the Org Properties API. Firstly, thank you so much for taking the time to write some code, which (even as a newbie) I was able to get running quickly and easily. Here's a modest example that will work with your sample document: ...snip... Evaluate this code. Then place point in the Fido entry, do `M-x cm/org-merge', and type `Dog Template' at the prompt. To improve on that, how do you want to use it? My actual use case is that I want to merge data about letters and phone calls into documents for printing with TeX. Once Fido's data are merged with the template, what do you want to do with the results? Mail them to someone? Export them to HTML? Make a new Org entry with the contents and file it somewhere? Of practical benefit to me would be either: (a) make a new Org entry and file it (as you suggest) or (b) simply put it in the kill ring, so that I can yank it wherever I want. Again, thanks so much for your help, and also the other replies I received. I'm very impressed by the org-mode community responding so quickly to my question. Richard