emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Samuel Wales <samologist@gmail.com>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: emacs-orgmode@gnu.org, Thorsten Jolitz <tjolitz@gmail.com>
Subject: Re: Org-mode outside Org-mode
Date: Sat, 13 Apr 2013 13:48:56 -0700	[thread overview]
Message-ID: <CAJcAo8s9a-gixv=V9YNrAwUEFBCFeROfsOW0JC-y8jVXfxjq7g@mail.gmail.com> (raw)
In-Reply-To: <87fvz3f8uh.fsf@gmail.com>

Hi Eric,

Here is old not-working not-finished code that I abandoned.  But it
illustrates the goal.

Samuel

===

Maybe something like:

  - In source file, C-c ' to go to Org entry associated with nearest ID marker
    - C-u C-c ' to create ID marker and create its Org entry in your Org file
      - when it is created, you can refile it wherever
  - C-c ' in Org entry to go to associated source file ID marker

;; this is quick and dirty code
;;
;; it is brittle to store a file path.  it is much better to
;; incorporate ID markers into the Org ID system, then Org will
;; find the file using org-id-goto.  to tell the system where you
;; keep your source files, set a variable.
;;
;; doing so will eliminate the need to store a pathname property.
;;
;; maybe this can be refactored with detangling markers.
;;
;; see also annotation, which requires no marker, but is more
;; brittle and does not indicate that you have an annotation.
;; this should be merged with that.
(defconst alpha-org-id-pair-file-property "ID-pair-file")
(defun alpha-org-bounce-id-pair ()
  "The opposite of Org Babel.  C-c ' in source code to document
it in Org.  Same in documentation to go to source code."
  (interactive)
  (let ((id (org-id-get)))
    (if id
        (org-id-goto id)
      (let ((source (org-entry-get nil alpha-org-id-pair-file-property)))
        (find-file source)
        (re-search-forward id)
        (forward-line 1)))))
(defun* alpha-org-bounce-or-insert-id-pair (&key (comment ";; "))
  "Bounce to the other end of, or create, a (notes, ID
marker) pair.

Suppose you are editing an Emacs Lisp source code file.  You can
bounce between a special entry in your Org agenda file
\(e.g. notes.org\) and your external file \(e.g. file.el\)."
  (interactive)
  (let ((id (org-id-new "id-pair")))
    (save-excursion
      (alpha-org-insert-id-marker id :comment comment))
    (org-capture nil)))
(defun* alpha-org-insert-id-marker (id &key comment)
  "Insert an ID marker."
  (insert
   (concat (when comment comment)
           "$[id "
           id
           ;; (when link (concat " :link " link))
           ;; ;; (org-insert-link)
           ;; (when label (concat " :label \"" label "\""))
           "]"))
  (forward-line -1)
  (funcall indent-line-function))

On 4/6/13, Eric Schulte <schulte.eric@gmail.com> wrote:
> That could be handy.  For jumping back and for by function name, the
> following simple implementation might be sufficient.  It relies on file
> local variables to know which src and Org-mode files are related to each
> other.

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  ANYBODY
can get it.  There is NO hope without action.  This means YOU.

  parent reply	other threads:[~2013-04-13 20:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-15 15:39 Org-mode outside Org-mode Thorsten Jolitz
2013-03-15 16:47 ` Thomas S. Dye
2013-04-03 18:23 ` Samuel Wales
2013-04-04 14:09   ` Thorsten Jolitz
2013-04-04 20:17     ` Samuel Wales
2013-04-05  9:51       ` Thorsten Jolitz
2013-04-07  1:05         ` Eric Schulte
2013-04-07  7:49           ` Bastien
2013-04-12  1:04           ` Samuel Wales
2013-04-13 20:48           ` Samuel Wales [this message]
2013-04-12  1:19         ` Samuel Wales
2013-04-12 10:44           ` Thorsten Jolitz
2013-04-13 20:45             ` Samuel Wales
2013-04-27  8:35               ` Thorsten Jolitz
2013-04-24 14:20 ` Alexander Vorobiev
2013-04-24 18:39   ` Thorsten Jolitz
2013-04-25 17:33   ` Thorsten Jolitz

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='CAJcAo8s9a-gixv=V9YNrAwUEFBCFeROfsOW0JC-y8jVXfxjq7g@mail.gmail.com' \
    --to=samologist@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=schulte.eric@gmail.com \
    --cc=tjolitz@gmail.com \
    /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).