Re: [O] can't find org-version?
So in version 7.8 and earlier, org-version is both a variable and a function. The function is not useful to coders because it displays the version string as a message: (org-version) Org-mode version 7.8.03 (release_7.8.03.437.g60ca.dirty) org-version 7.8.03 I used org-version as a variable because there was an incompatibility between 7.7 and 7.8 for the function org-export-remove-or-extract-drawers. So, what is the proper way to get the version number in 7.9? It seems awkward to me that all clients would have to require something other than just org to get the version number, but I can live with that. What I don't want to do, though, is mess around with testing for the existence of various functions and variables just to figure out where to get the version number from. Why not just keep the variable org-version around just like in 7.8 and earlier? Otherwise, can someone please post a code snippet that gets me the version string 7.8.03 that will work with 7.7, 7.8 and 7.9? ...cj On 9/4/12 6:13 AM, Giovanni Ridolfi wrote: Da: Nick Dokos nicholas.do...@hp.com Inviato: Martedì 4 Settembre 2012 14:04 Giovanni Ridolfi giovanni.rido...@yahoo.it wrote: Would you please try to add (require 'org-install) instead of (require 'org) and see if org-toodledo works? As mentioned in one of the above threads, the version of a package is pretty fundamental and I'd expect it to be provided by the base require. The variable org-version *is indeed provided* but not in the file your code expects it. Is it? I can only find a function named org-version, not a variable. Hi, Nick, you're right, therfore, obviously ;-) I was wrong. The function is org-version and it gets its arguments from the variables org-release and org-git-version defined in the file lisp/org-version.el thanks for pointing it up. cheers, Giovanni
Re: [O] can't find org-version?
Hi Nick, On 9/4/12 10:15 AM, Nick Dokos wrote: Here is a snippet of code that works in those two and in 7.9.1 as well: (setq version (if (boundp 'org-version) org-version (org-version)) Thanks -- I do not have a copy of 7.9 available, so wasn't sure what parameters to call. I can certainly add this to org-toodledo.el, but I guess I fail to understand why it was changed in the first place. The above solution means that every package out there that is dependent on org and needs to look up the version needs to change to work with 7.9 If org simply kept the org-version as a variable, there would be no need for this. If 7.9 is still an early release, I'd suggest adding the org-version variable back to org so as not to break other packages that may also depend the version string. ...cj
Re: [O] can't find org-version?
I'm the maintainer of the org-toodledo and the OP did indeed contact me first. org-toodledo effectively does: (require 'org) Then uses the variable org-version. This has worked just fine for a few years, but when the OP upgraded to 7.9, the org-toodledo function that checks the org-version yields an error along the lines of variable not defined. I did some googling and came across these threads which seemed relevant: http://thread.gmane.org/gmane.emacs.orgmode/59337 http://comments.gmane.org/gmane.emacs.orgmode/55412 It seems wrong to me that hacking org-toodledo is the appropriate solution. As mentioned in one of the above threads, the version of a package is pretty fundamental and I'd expect it to be provided by the base require. ...cj On 9/3/12 12:23 AM, Giovanni Ridolfi wrote: Da: Benjamin Slade sl...@jnanam.net Since updating to org 7.9, I've had an odd problem with another package that depends on org-mode (org-toodledo). It reports that it can't find org-version. So the problem is in org-toodledo. Did you ask its maintainer?
Re: [O] Multicolumn
Hi Erich, I have a hack for multicolumn support that may help... It's not great, but serves my purpose. I implemented a TWiki mode that uses orgtbl-minor-mode. TWiki pages support multicolumn cells by adding vertical bars with no separators: Display: | Multicol | | C1 | C2 | TWiki format: | Multicol || | C1 | C2 | Notice the double vertical bars after Multicol. The number of vertical bars on every row must be the same. You can join as many cells as you want that way. I basically wanted to be able to still use orgtbl-minor-mode to edit such tables. So I hacked my twiki-import/export code to convert || to | | and vice-versa. So the orgtbl version of the above looks like this in the buffer: | Multicol | | | C1 | C2 | The down side is that the text Multicol will expand the display size of C1, so if it gets long, the table grows: | This is a long multicol cell | | | C1 | C2 | So it gets me what I want, which is orgtbl editing, and import/export support to twiki format. Seems a similar technique could be backed in to any org export engine. ...cj On 8/28/12 5:10 PM, Neuwirth Erich wrote: After some googling it seems that multicolumn support is not yet implemented in org tables. I would need multicolumn headers quite urgently, but I have not yet found a way to make this possible. I think that tables with headers like this: | |mean | s.e.| | gender | varA | varB | varA | varB | are quite common, so I really want to put this feature on the wish list. I am not able to implement this myself. Erich
[O] Tab to indent plain lists
Hi Folks, I take miscellaneous meeting notes using plain lists. It's usually a pretty hectic trying to take notes during a meeting, so I'm making up the structure as I go along. I often get to a point where I indented an item wrong: - item 1 - item 1.1 - item 2 I need to get up to item 1.1 and move it as a child of 1. I'd like [tab] to adjust the indentation. I discovered the 'org-cycle-include-plain-lists' variable. The documentation for the var states: If `org-cycle-include-plain-lists' has not been set, TAB fixes the indentation of the current line in a heuristic way. That sounds like what I want, but setting to nil doesn't do it, it just makes TAB a nop. Any thoughts? ...cj
Re: [O] org-link minor mode
This is pretty cool, Sean. One issue I'm having is that it does not properly handle breaking the link: [[link][description]] is displayed as link, with the cursor after link. In org-mode, if I hit backspace, it deletes the trailing ']' and changes the display to [[link][description]. But using this minor mode, it keeps still just shows link. If I turn minor mode off again, it's clear that the trailing bracket was deleted. I took a look at the org source regarding links, but I couldn't quite figure out how org does this. It just calls org-delete-backward-char, which doesn't appear to have any magic for links. Thanks ...cj On 8/12/12 4:25 PM, Sean O'Halpin wrote: Hi, I've been hacking this weekend to try to create a minor mode that enables org-mode bracket links in modes other than org-mode. I believe this has been mooted before (e.g. http://lists.gnu.org/archive/html/emacs-orgmode/2009-08/msg00573.html). The following codes works for me but I'm sure it could be improved. I'm an elisp noob so I'd very much appreciate feedback on the approach I'm taking. For example, I'm not sure how to prevent turning on org-link-minor-mode from an org-mode buffer - advice would be welcome. Regards, Sean #+begin_src emacs-lisp (require 'org) (define-minor-mode org-link-minor-mode Toggle display of org-mode style bracket links in non-org-mode buffers. :lighter org-link (let ((org-link-minor-mode-keywords (list '(org-activate-bracket-links (0 'org-link t) (save-excursion (save-match-data (goto-char (point-min)) (if org-link-minor-mode (progn (font-lock-add-keywords nil org-link-minor-mode-keywords t) (set (make-local-variable 'org-descriptive-links) org-descriptive-links) (if org-descriptive-links (add-to-invisibility-spec '(org-link))) (font-lock-fontify-buffer) ) (progn (font-lock-remove-keywords nil org-link-minor-mode-keywords) (org-remove-from-invisibility-spec '(org-link)) (while (re-search-forward org-bracket-link-regexp nil t) ;; Remove all org-link properties (remove-text-properties (match-beginning 0) (match-end 0) (text-properties-at (match-beginning 0))) ) ) ) (provide 'org-link-minor-mode) #+end_src
Re: [O] Capturing to a list in a dynamic 2nd level heading
Hi Simon, I have a capture template that does almost exactly that, I just use a user entered subheading -- should be easy enough to tweak for your task. When chosen as a capture option, it asks for a discussion context and looks up a 2nd level heading below Discussion Items matching that context. If it exists, it just adds to it. If not, it creates a new context at the end of the Discussion Items element. Note that you must create Discussion Items first, and it must be top-level. ...cj Capture template: (d Discussion Item item (file+function ~/org/Todo.org (lambda () (let* ((ctxt (read-string Discussion context: )) (ctxt-pt (condition-case msg (org-find-olp (list Discussion Items ctxt) t) (error nil (if ctxt-pt (progn (goto-char ctxt-pt) (org-end-of-subtree) (insert-string \n)) (goto-char (org-find-olp (list Discussion Items) t)) (org-end-of-subtree) (insert-string (format \n** %s\n ctxt))) On 8/13/12 12:26 PM, Simon Brown wrote: Hi all, Is it possible with org-capture to create a template that would create the following: * Log ** 2012 - Week 33 - One liner of interest - Another one liner of interest So that is a capture template that generates the 2nd level heading when required and the text entered is converted to a list entry which is added to the end of the list. (format-time-string %G - Week %W) is the correct date string, but file+headline creates a top level heading and file+olp expects it to already exist. It seems that the text entered must also become a sub heading. Is that correct? I'm trying to achieve something very similar to this http://metajack.im/2009/01/01/journaling-with-emacs-orgmode/ Any suggestions greatly appreciated. I haven't managed to strike gold in the list archive. Simon
Re: [O] The Quantified Shower
Oh man, what a great post... But the mp3 links are broken! I really want to hear The Shower Song w/hair. This makes me think of my obsession with finding the optimal order of tasks that I do in a given day. (I can save 5 seconds if I overlap rinsing the espresso cup with one hand while I flush the espresso maker with the other...) ...cj On 8/7/12 5:52 AM, Bastien wrote: I have long given up on reckoning how many I am (outside or inside), and I'm always amazed at those attempts to quantify one's own life. I'm still trying to figure out if this post is a joke or not: http://jeapostrophe.github.com/blog/2012/08/06/shower/ Maybe the fun is precisely in wondering so :)
Re: [O] are super-hidden technical blocks required?
Nice! I like this approach. The only slight change I would make is to the All entries are unfolded one level. If there are only hidden properties but there is other content, show the other content but not the PROPERTIES drawer: * All entries are unfolded one level ** Only hidden properties with other content This is more content The :PROPERTIES: is not shown. Question -- are you proposing a new step in cycling that opens all property drawers, or is this already available via some command or setting? I've never seen a way to open everything including PROPERTIES via Tab or S-Tab cycling. ...cj On 8/7/12 9:20 AM, Torsten Wagner wrote: Hey Bastien, On 7 August 2012 19:23, Bastien b...@gnu.org wrote: that a drawer doesn't make an entry non-empty while cycling, ohhh you challenge us... does not ... non-empty is in fact the same like if there is only a drawer, the entry is still empty right ?! Yes, I agree that should be separated. Maybe an idea would be a rule like if all properties in a drawer are marked as hidden and there is nothing else for the particular entry (no body), do not open the entry for the next cycling rounds. I just tested a bit and org-mode is clever enough already to avoid any text-insertion before the property drawer if text get added to a collapsed entry. Thus, this rule just might work and hide technical properties completely during cycling. Combined with a #+HIDDEN_PROP: line each and everyone can adjust individually how much and what he likes to hide. #+HIDDEN_PROP: * - all properties are hidden would be the extreme and all property drawers will be hidden in case they are the only element of a entry. In case other elements are included, they collapsed drawer line will be dimmed by a different face to indicate that only hidden properties are included #+HIDDEN_PROP: this means no properties are hidden would be the other extreme and nothing would be hidden (that essentially would represent the present state). I created two mock-ups. One shows the present solution and the other shows how certain properties can be marked hidden and which effect does this have on different level and combinations. Hope that helps within this discussion. I choose a arbitrary colour scheme to make it rather good visible. Torsten
Re: [O] are super-hidden technical blocks required?
Hi Folks, I thought I'd throw in my 2c on the topic. I work on org-toodledo which syncs TODO items with Toodledo.com. On first sync, it creates adds a ToodledID property to track the ID assigned by the server. In my use case, that majority of TODO items have *no* other properties. As such, many items have a PROPERTIES drawer with just the one entry. What I see is visual clutter. Many of my TODO items are also very small -- often no body at all. So the only thing beneath the item is the property drawer plus other properties like DEADLINE/SCHEDULED/CLOSED. When trying to browse my todo list, it gets a little painful when every other line is :PROPERTIES:..., or DEADLINE, etc. I rarely (never?) edit any of these properties directly manually. I either modify them via agenda mode, keys (C-c C-s), or via column view that pulls out interesting properties that I like to edit. So for me, I want the entire *drawer* to disappear, as well as SCHEDULED/DEADLINE and CLOSED lines. I've personally thought there should be an extra step in the visibility cycling: TAB - FOLDED - CHILDREN - SUBTREE - PROPERTIES S-TAB - OVERVIEW - CONTENTS - SHOW ALL (minus PROPS) - PROPERTIES ...cj On 8/1/12 9:19 PM, Torsten Wagner wrote: Hey Bastien, thanks for keeping the topic up. Well, I guess people who are dealing with import/export from third-party programs might have an idea how to use this functionality (and can tell us how useful this would be). I can try to contact the authors of mobileorg for iphone and android as well as some other authors of sync-tools (if they are not already contributing to this discussion). Lets see what is there opinion. All the best Torsten On 1 August 2012 22:29, Bastien b...@gnu.org wrote: Hi Thorsten, thanks for the detailed example. As I said, I tend to be conversative about such topics. Not because I'm already too old, but because this is often not worth the time-to-implement/complexity-in-code. So I'm still open to read a very compelling case where tech properties need to be hidden... Of course, need is subjective -- let's say if you manage to have at least 3 friends complaining about tech properties being visible when unfolding a drawer, I'm all ears :) -- Bastien
Re: [O] Don't show future TODO items in the agenda
Hi Mark and Bastien, I have also been interested in this sort of functionality. This message made me dig a little and I think it's covered by the following: (setq org-agenda-todo-ignore-scheduled 'future) Basically, a global TODO list, but don't tell me about stuff that isn't due yet. ...cj On 7/12/12 3:43 AM, Bastien wrote: mrigetitd...@safe-mail.net writes: I have a bunch of TODO items, each with a timestamp, which I would like to not being displayed in the agenda if the day of their timestamp/schedule is in the future. Can you share an example of .org file along with the custom agenda command (or the default agenda view) you are using?
Re: [O] Org Mode TOOD two way sync tool
Hi Karra, I've been working on org-toodledo.el to perform bi-directional sync of TODO items with the Toodledo server, and faced many of the same issues you raise about figuring out the exact format and grammar of a TODO item. You may find looking at my source useful, either as inspiration, integration, or just understanding what fields are what. The general approach was to build an object that represents a parsed TODO item, and fill that in from either the org-buffer TODO items, or from items retrieved from the server. That object can then be compared to others (one from the server and one from the local buffer), converted to a new org TODO, sent to the server as a new TODO, etc. The components of the TODO item are obviously targeted to what makes sense for Toodledo, but I think they are fairly generic. You might also look at org-element.el which I recently learned about which may also help. I have it on my TODO list to learn more about it to see if I can't refactor org-toodledo to leverage it. It is more geared toward generic org items as opposed to specifically TODO items. ...cj On 6/22/12 2:40 AM, Sriram Karra wrote: I am the author of ASynK (http://karra-asynk.appspot.com), a PIM sync tool and framework written in python that works across a variety of PIM providers such as Outlook, Google and BBDB. I am considering extending ASynK to do a bi-directional sync of Outlook tasks to Org Mode tasks. To be able to do this I need a working read/write API for reading and creating TODOs in org mode. *Offline parsers* My first preference is to be able to parser org files without required Emacs - this is the approach that I have implemented for BBDB sync. I considered PyOrgMode (https://github.com/bjonnh/PyOrgMode/network), but it appears unable to process TODOs, or even recurring events. To be able to extend PyOrgMode so I can read and write TODOs, I needed a full description of the format of TODO entries in all its forms. The Org manual itself has this information, I'm sure but scattered all over the place, given its real audience. Can someone point me to some sort of a concise representation, if any, of the org file format grammar? *org-protocol* * * By quickly reading the documentation I figured that org-protocol can be used to create entries, but is there a way to use it to do generic queries like list all TODOs in a specified file, with a particular property value and such? Any help is much appreciated. -Karra
Re: [O] Org Mode TOOD two way sync tool
Hi Karra, On 6/22/12 8:33 AM, Sriram Karra wrote: Chris, thanks for the pointer to org-toodledo. Does org-toodledo's handle all the options and formats of possible TODOs supported by org mode? That's a loaded question ;-) I'd have to say probably not, but it so far supports all of my TODOs. Brief list of properties handled: * TODO state * DEADLINE / SCHEDULED with repeaters * CLOSED * tags * Effort * hierarchy * folder (toodledo folders, that is) - map to a heading I'd say extending support to other properties wouldn't be too hard if it's a direct mapping that doesn't involve too much logic. Are you yet to implement support for anything that is parsed by the Emacs org-mode? I'm not sure what you mean -- are you referring to org-element? If not, can you clarify? ...cj
Re: [O] on the go capture
I use Toodledo (http://toodledo.com). I've been working on org-toodledo.el that syncs todo items between an org file and the toodledo server. There are multiple other toodledo clients including one for the iPhone / iPad that work nicely. The system works pretty well for my needs (todo list management). I do most of my work in org-mode, and use toodledo mostly just for the mobile use case (or remote when I don't have my computer). The project is up on git: https://github.com/christopherjwhite/org-toodledo ...cj On 6/13/12 1:00 PM, Sample Hampton wrote: Users, What do you use to capture when away from orgmode (in the car, on the subway) and what system do you use to migrate those captures into orgmode? Right now I just use a notebook and a pen--and it works fairly well--but moving from notebook to org is certainly a pain, and I am sure I am losing information. What do you use? And if you use mobileorg, then how well does it work? Thanks, Sample
[O] org-capture and org-link-type for Outlook mail messages on Mac OSX
Hi Folks, I thought I'd share a bit of hacking I've been doing over the last couple days. I had 2 basic needs: * create a TODO entry associated with an email message * include a clickable link back to that message in the entry For work email I use Outlook on a Mac. After some digging, I managed to cobble together an AppleScript with some glue lisp that solves both of the above. Testing is minimal at this point, but it works for me so, I thought I'd share it here first, then if folks think appropriate, I can post it up on the worg. I have hopes to extend support to Thunderbird (which I use for personal email), but there appears to be very limited AppleScript support, so does not look promising. ...cj -- OutlookToEmacsOrg -- -- This script uses org-protocol to capture the currently selected message in outlook -- as an Org item. The item creates a link of type 'mac-outlook' with the message ID -- within Outlook that can later be used by mdfind to find that message. -- -- If more than one message is selected, only the first message is used. If no message -- is selected, the script does nothing. -- -- The Title passed to org-protocol is formatted as [Sender] Subject, but could -- easily be modifed as below to any text. -- -- See http://orgmode.org/worg/org-contrib/org-protocol.html for details about -- how org-protocol works. -- -- This script assumes emacsclient is available via the Carbon Emacs application, but -- can be changed via the emacsclientBinary below. -- -- Script Installation for Outlook -- 1. Startup AppleScript Editor -- 2. Paste this script into a new file -- 3. Save as OutlookToEmacsOrg of file type Script Bundle in the directory: --/Users/you/Library/Application Support/Microsoft/Office/Outlook Script Menu Items -- 4. Restart Outlook, and this should show up in the Script menu (the squiggly next to Help) -- -- You probably also assign a shortcut via System Preferences. -- -- Emacs mac-outlook link support, put the following in your .emacs: -- -- (org-add-link-type mac-outlook 'org-mac-outlook-open) -- -- (defun org-mac-outlook-open (msgid) -- Open a message in outlook -- (shell-command (format open \`mdfind com_microsoft_outlook_recordID==%s`\ msgid))) -- -- Tested on Mac OS X 10.7.3, Emacs 23.4.2, Org 7.8.03, Outlook for Mac 2011 -- -- Special thanks to Lutz Meyer / LuMe96(at)gmail.com -- I got the critical -- pieces of applescript from OutlookToThings.scpt written by Lutz. property emacsclientBinary : /Applications/Emacs.app/Contents/MacOS/bin/emacsclient on urlencode(plaintext) set enctext to do shell script python -c 'import sys, urllib; print urllib.quote(sys.argv[1])' quoted form of plaintext return enctext end urlencode tell application Microsoft Outlook set msgCount to count current messages if (msgCount 1) then return end if set myMessage to (the first item of (get current messages)) set myID to id of myMessage as string set mySubject to subject of myMessage set mySender to sender of myMessage set mySenderName to name of mySender set myTitle to [ mySenderName ] mySubject set myCmd to emacsclientBinary \org-protocol:/capture:/eo set myCmd to myCmd /mac-outlook: myID set myCmd to myCmd / (my urlencode(myTitle)) set myCmd to myCmd \ --display dialog myCmd tell application Emacs activate end tell do shell script myCmd set the clipboard to myCmd end tell
Re: [O] org-capture and org-link-type for Outlook mail messages on Mac OSX
Ok -- just realized I had left in the selection of a custom org-capture-template which will likely not be in anyone else's config, so I made the org-capture-template configurable, and set to nil by default. Modified script below.. ...cj -- OutlookToEmacsOrg -- -- This script uses org-protocol to capture the currently selected message in outlook -- as an Org item. The item creates a link of type 'mac-outlook' with the message ID -- within Outlook that can later be used by mdfind to find that message. -- -- If more than one message is selected, only the first message is used. If no message -- is selected, the script does nothing. -- -- The Title passed to org-protocol is formatted as [Sender] Subject, but could -- easily be modifed as below to any text. -- -- See http://orgmode.org/worg/org-contrib/org-protocol.html for details about -- how org-protocol works. -- -- This script assumes emacsclient is available via the Carbon Emacs application, but -- can be changed via the emacsclientBinary below. -- -- Script Installation for Outlook -- 1. Startup AppleScript Editor -- 2. Paste this script into a new file -- 3. Save as OutlookToEmacsOrg of file type Script Bundle in the directory: --/Users/you/Library/Application Support/Microsoft/Office/Outlook Script Menu Items -- 4. Restart Outlook, and this should show up in the Script menu (the squiggly next to Help) -- -- You probably also assign a shortcut via System Preferences. -- -- Emacs mac-outlook link support, put the following in your .emacs: -- -- (org-add-link-type mac-outlook 'org-mac-outlook-open) -- -- (defun org-mac-outlook-open (msgid) -- Open a message in outlook -- (shell-command (format open \`mdfind com_microsoft_outlook_recordID==%s`\ msgid))) -- -- Tested on Mac OS X 10.7.3, Emacs 23.4.2, Org 7.8.03, Outlook for Mac 2011 -- -- Special thanks to Lutz Meyer / LuMe96(at)gmail.com -- I got the critical -- pieces of applescript from OutlookToThings.scpt written by Lutz. property emacsclientBinary : /Applications/Emacs.app/Contents/MacOS/bin/emacsclient -- Set to the empty string to use the default capture template, or fill -- in the letter code from org-capture-templates property orgCaptureTemplate : --property orgCaptureTemplate : x on urlencode(plaintext) set enctext to do shell script python -c 'import sys, urllib; print urllib.quote(sys.argv[1])' quoted form of plaintext return enctext end urlencode tell application Microsoft Outlook set msgCount to count current messages if (msgCount 1) then return end if set myMessage to (the first item of (get current messages)) set myID to id of myMessage as string set mySubject to subject of myMessage set mySender to sender of myMessage set mySenderName to name of mySender set myTitle to [ mySenderName ] mySubject set myCmd to emacsclientBinary \org-protocol:/capture: if (length of orgCaptureTemplate 0) then set myCmd to myCmd / orgCaptureTemplate end if set myCmd to myCmd /mac-outlook: myID set myCmd to myCmd / (my urlencode(myTitle)) set myCmd to myCmd \ --display dialog myCmd tell application Emacs activate end tell do shell script myCmd set the clipboard to myCmd end tell
[O] Extract item body with drawers/properties
Hi Folks, Is there a function to extract the body of an item minus all the auxiliary information? * Item This is the text I want. And here is the second line. SCHEDULED: 2012-05-12 DEADLINE: 2012-05-13 :PROPERTIES: :foo: bar :END: And it's conceivable there is more below drawers... ** Sub-Item 1 ** Sub-Item 2 Basically I want a function that does the following: (org-entry-get-text) This is the text I want And here is the second line. And it's conceivable there is more below drawers... Point is at * Item when this is called. For one project (org-toodledo), I coded a version (see below) that pulls out the drawers, drops properties SCHEDULED/DEADLINE/CLOSED, and pulls off any indentation, and it works pretty well, although it is probably not complete for all cases. However, I'm now working on extensions for another project (org-taskjuggler) and want to again pull out the note. I tried again to find such a function in the org source files, but I just can't seem to find it. Does it exist? If not, does it make sense to make my version below workable for org-mode developers in general? (Related, what is the right term for this block of text? Note? Content? Text?) Thanks ...cj (defun org-toodledo-entry-note () Extract the note for this task. (save-excursion (org-back-to-heading t) (when (looking-at org-complex-heading-regexp) (goto-char (match-end 0)) (let ((text (buffer-substring-no-properties (point) (if (re-search-forward org-complex-heading-regexp nil t) (match-beginning 0) (org-end-of-subtree t t) (with-temp-buffer (insert text) ;; Pull out DEADLINE / SCHEDULED / CLOSED fields (dolist (str (list (regexp-quote org-deadline-string) (regexp-quote org-scheduled-string) (regexp-quote org-closed-string))) (goto-char (point-min)) (when (re-search-forward (concat \\ str +[\[][^]\n]+[]][ \t]*) nil t) (replace-match ))) ;; Drop any empty lines with only (goto-char (point-min)) (while (re-search-forward ^ *\\( \\)+\n nil t) (replace-match )) ;; Drop any remaining (goto-char (point-min)) (while (re-search-forward nil t) (replace-match )) ;; org-export-remove-or-extract-drawers removed an argument sometime around version 7 (if (= (string-to-number org-version) 7) (org-export-remove-or-extract-drawers org-drawers nil) (org-export-remove-or-extract-drawers org-drawers nil nil)) ;; Trim leading/trailing empty lines, but preserve whitepace at the beginning of the line (goto-char (point-min)) (if (re-search-forward \\=\\( *\n\\)+ nil t) (replace-match )) (goto-char (point-min)) (if (re-search-forward \\( *\n\\)+\\' nil t) (replace-match )) (goto-char (point-max)) (insert \n) ;; Finally, if this was indented and indenting notes, remove indentation (when org-toodledo-indent-task-note (goto-char (point-min)) (when (re-search-forward ^ + nil t) (let ((str (match-string 0))) (goto-char (point-min)) (while (re-search-forward (format ^%s str) nil t) (replace-match ) (let ((s (buffer-substring-no-properties (point-min) (point-max (if (string-match \\(\\`[ \t]*[\n\r]+\\)+ s) (setq s (replace-match t t s))) (if (string-match \\([\n\r]+[ \t]*\\)+\\' s) (setq s (replace-match t t s))) s) ) ) ) ) )