emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Martin Pohlack <mp26@os.inf.tu-dresden.de>
To: org-mode <emacs-orgmode@gnu.org>
Subject: org-remember to org-capture
Date: Fri, 27 Jan 2012 15:05:50 +0100	[thread overview]
Message-ID: <4F22AF3E.70109@os.inf.tu-dresden.de> (raw)

Hi,

I am in the process of switching from org-remember to org-capture.

I used a custom function with org-remember to capture into a
host-specific sub-tree under "* Inbox" in order to minimize git merge
conflicts between my machines.

My tree typically looks like this:

* Inbox
*** Inbox:host1
***** INBOX idea 1
***** INBOX idea 2
*** Inbox:host2
***** INBOX idea 3

The custom function with org-remember only needed to create the target
headline's name.  Org-remember would find it or create it (IIRC):

---->8----------------------------------------------------------------
(defun my-host-name ()
  "Returns the name of the current host minus the domain."
  (let ((hostname (downcase (system-name))))
    (save-match-data
      (substring hostname (string-match "^[^.]+" hostname) (match-end 0)))))

(defun my-org-remember-headline ()
  (concatenate 'string "Inbox:" (my-host-name)))
---->8----------------------------------------------------------------

The problem is now that org-capture expects a function that creates
the target node and positions point at a child of the target, is this
correct?

My hacky solution is to use the file+function template and looks like
this:

---->8----------------------------------------------------------------
(defun my-org-capture-function ()
  (goto-char
   (org-find-exact-headline-in-buffer
    (concatenate 'string "Inbox:" (my-host-name)) nil t))
  (org-end-of-line)
  (org-insert-subheading ""))
---->8----------------------------------------------------------------

But it looks clumsy and always inserts as first child.  Is there a
more elegant approach, maybe using the refiling mechanism?

Thanks,
Martin

             reply	other threads:[~2012-01-27 14:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-27 14:05 Martin Pohlack [this message]
2012-01-28 16:00 ` org-remember to org-capture Bastien
2012-01-28 21:34   ` Martin Pohlack

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F22AF3E.70109@os.inf.tu-dresden.de \
    --to=mp26@os.inf.tu-dresden.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).