From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: refine org-babel-tangle-jump-to-org? Date: Thu, 06 Jun 2013 09:06:59 -0600 Message-ID: <8761xr8ei4.fsf@gmail.com> References: <87r4goy0uo.fsf@krugs.de> <87ehcoktsl.fsf@gmail.com> <87fvx3bnzl.fsf@krugs.de> <87wqqfjnmi.fsf@gmail.com> <878v2rsfol.fsf@krugs.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ukbn9-0004UU-Un for emacs-orgmode@gnu.org; Thu, 06 Jun 2013 11:07:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ukbn8-0002Ev-3E for emacs-orgmode@gnu.org; Thu, 06 Jun 2013 11:07:55 -0400 Received: from mail-pb0-x22f.google.com ([2607:f8b0:400e:c01::22f]:52541) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ukbn7-0002Eg-Tc for emacs-orgmode@gnu.org; Thu, 06 Jun 2013 11:07:54 -0400 Received: by mail-pb0-f47.google.com with SMTP id rr13so726070pbb.20 for ; Thu, 06 Jun 2013 08:07:53 -0700 (PDT) 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: Rainer M Krug Cc: emacs-orgmode@gnu.org > the tangled file looks as follow, including the empty lines at > beginning and end: > > ,---- > | > | ## [[file:~/tmp/jumpBack.org::*newASM%20(./newASM.R)][newASM\ \(\./newASM\.R\):1]] > | > | logList("##########################################################################") > | logList("##########################################################################") > | logList("####") > | logList("#### Simulation object ASM created.") > | logList("####") > | logList("#### It has been undergone basic initialisation and will") > | logList("#### be initialised for usage when simulated by running") > | logList("####") > | logList("#### > sim(ASM)") > | logList("####") > | logList("#### or manually, without simulating, by running") > | logList("#### > ASM <- initialize(ASM)") > | logList("####") > | logList("##########################################################################") > | logList("####") > | logList( paste("#### GISDBASE : ", parms(ASM)$baseDir) ) > | logList( paste("#### LOCATION : ", parms(ASM)$grassLocation) ) > | logList( paste("#### MAPSET : ", parms(ASM)$grassMapset) ) > | logList("####") > | logList("##########################################################################") > | logList("##########################################################################") > | logEnd() > | return(ASM) > | } > | > | ## newASM\ \(\./newASM\.R\):1 ends here > | > `---- > > This one works, although the cursor is consistently two characters to the left then > where it should be. > This is off because the first line of your example is not indented correctly when tangled. Specifically, it is indented by two spaces in the source file and by four spaces in the code block. Setting the `org-src-preserve-indentation' variable to t should fix this. > > If I change > > ,---- > | #+PROPERTY: padline yes > `---- > > to > > ,---- > | #+PROPERTY: padline no > `---- > > the padlines are gone, ant the jumping back is completely off (from > first r in return() it jumps to the third # in the last logList()). > For now I think both padlines and link comments are required for the jumping functionality to work. I've updated the documentation to reflect this. ,---- | @subheading Jumping between code and Org | | When tangling code from an Org-mode buffer to a source code file, you'll | frequently find yourself viewing the file of tangled source code (e.g., many | debuggers point to lines of the source code file). It is useful to be able | to navigate from the tangled source to the Org-mode buffer from which the | code originated. | | The @code{org-babel-tangle-jump-to-org} function provides this jumping from | code to Org-mode functionality. Two header arguments are required for | jumping to work, first the @xref{padline} option must be set to true (the | default setting), second the @xref{comments} header argument must be set to | @code{links}, which will insert comments into the source code buffer which | point back to the original Org-mode file. `---- -- Eric Schulte http://cs.unm.edu/~eschulte