From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: anyway to create link to a line number in a file Date: Sat, 18 Feb 2012 12:31:27 -0500 Message-ID: <9088.1329586287@alphaville> References: Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([140.186.70.92]:56515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ryo8B-0000J4-Rn for emacs-orgmode@gnu.org; Sat, 18 Feb 2012 12:31:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ryo8A-00029e-OA for emacs-orgmode@gnu.org; Sat, 18 Feb 2012 12:31:31 -0500 Received: from g1t0028.austin.hp.com ([15.216.28.35]:11859) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ryo8A-00029S-Hc for emacs-orgmode@gnu.org; Sat, 18 Feb 2012 12:31:30 -0500 In-Reply-To: Message from Not To Miss of "Sat, 18 Feb 2012 11:31:44 EST." 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: Not To Miss Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org Not To Miss wrote: > I looked that section carefully and the whole manual briefly. I > haven't found anything yet. That's why I am asking on the mailing list > to see if anyone has some workaround. > > On Sat, Feb 18, 2012 at 9:03 AM, Sean O'Halpin wrote: > > On Fri, Feb 17, 2012 at 4:54 PM, Not To Miss wrote: > >> Hi all, > >> > >> I am reading a long text file and want to write down my notes with > >> org-mode. I extremely would like to put the line numbers down along > >> with my notes. Although there is a way to store a link for text search > >> for the current line, I haven't found a way to create a link to a line > >> number in the current buffer. Is there anyway to do that? Thanks > > > > Take a look at org-capture: http://orgmode.org/manual/Capture.html *Following* a link with a line number is no problem: org does that out of the box with a link like [[file:foo.txt::NNN][desc]] That is actually documented: (info "(org) External links") The problem is to make sure org-store-link will actually store the line number (along with everything else) so that then org-insert-link can insert the link in the proper format. I don't think there is a function to do that out of the box for line numbers, but you can easily (for some value of "easily") write your own. Look in (info "(org)Adding hyperlink types") for some hints. Briefly, you write a function that checks whether it wants to deal with the link or not, and you add it to org-store-link-functions. I don't have the time to try it out right now, but I believe this should work for what you want. Nick