From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Org-mode outside Org-mode Date: Sat, 06 Apr 2013 19:05:58 -0600 Message-ID: <87fvz3f8uh.fsf@gmail.com> References: <87txoc7jvr.fsf@gmail.com> <874nfm9ylq.fsf@gmail.com> <87txnl486a.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:54258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UOe42-0006YC-Uu for emacs-orgmode@gnu.org; Sat, 06 Apr 2013 21:06:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UOe3x-0000g6-2T for emacs-orgmode@gnu.org; Sat, 06 Apr 2013 21:06:34 -0400 Received: from mail-da0-x22f.google.com ([2607:f8b0:400e:c00::22f]:44994) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UOe3w-0000fq-Rz for emacs-orgmode@gnu.org; Sat, 06 Apr 2013 21:06:28 -0400 Received: by mail-da0-f47.google.com with SMTP id s35so2079831dak.6 for ; Sat, 06 Apr 2013 18:06:28 -0700 (PDT) In-Reply-To: <87txnl486a.fsf@gmail.com> (Thorsten Jolitz's message of "Fri, 05 Apr 2013 11:51:25 +0200") 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: Thorsten Jolitz Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Thorsten Jolitz writes: > Samuel Wales writes: > > Hi Samuel, > >> IIUC, I don't think this is related. The idea is not to edit source >> code in Org buffers, and it is not to use a Navi buffer or to do >> navigation. >> >> The idea is to be in my-lisp.el, and do C-c ', and get to a canonical >> entry in my-org.org, then do C-c ' again and get back to my-lisp.el. >> 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. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: inline; filename=org-src-jump.el Content-Transfer-Encoding: quoted-printable ;;; org-src-jump.el --- jump between a source and related Org-mode files ;; Set the `os-org-file' variable in your source file and the ;; `os-src-file' in your Org-mode file as file local variables. ;;; Code: (require 'imenu) (require 'which-func) (defvar os-org-file nil "Org file related to a source buffer.") (put 'os-org-file 'safe-local-variable 'stringp) (defvar os-src-file nil "Src file related to an Org-mode buffer.") (put 'os-src-file 'safe-local-variable 'stringp) (defun org-src-jump () "Jump between Org-mode and src buffers." (interactive) (if (equal major-mode 'org-mode) ;; jump to function in src file (let ((func (org-entry-get (point) "ID"))) (unless os-src-file (error "Must set `os-src-file' in this buffer."= )) (find-file os-src-file) (goto-char (cdr (assoc func imenu--index-alist)))) ;; jump to heading in org file (let* ((func (which-function)) (m (org-id-find func 'marker))) (find-file os-org-file) (if m (goto-char m) ;; make a new Org-mode heading for this function (goto-char (point-max)) (org-insert-heading t) (org-entry-put (point) "ID" func) (insert func) (org-id-update-id-locations (list os-org-file)))))) (provide 'org-src-jump) --=-=-= Content-Type: text/plain Cheers, -- Eric Schulte http://cs.unm.edu/~eschulte --=-=-=--