From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: Re: linking to region Date: Thu, 24 Sep 2009 16:14:01 -0400 Message-ID: <87ljk4hzhy.fsf@gollum.intra.norang.ca> References: <87ocp0jl9m.fsf@cuma.i-did-not-set--mail-host-address--so-tickle-me> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mquhe-0003Au-7S for emacs-orgmode@gnu.org; Thu, 24 Sep 2009 16:14:10 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mquha-000385-2p for emacs-orgmode@gnu.org; Thu, 24 Sep 2009 16:14:09 -0400 Received: from [199.232.76.173] (port=42714 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MquhZ-00037W-QG for emacs-orgmode@gnu.org; Thu, 24 Sep 2009 16:14:05 -0400 Received: from mho-02-ewr.mailhop.org ([204.13.248.72]:65208) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MquhY-0003RM-Pj for emacs-orgmode@gnu.org; Thu, 24 Sep 2009 16:14:05 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: maurizio.vitale@polymath-solutions.com Cc: emacs-orgmode@gnu.org Maurizio Vitale writes: > Is it possible to grab a link to a region in a file in such a way that > C-c C-o visit the file after narrowing-to-region? > > The reason I'd like this is that I'm starting using org-mode for > requirement tracking and when referencing a standard I'd find > preferable to open only the relevant fragment rather than the complete > document. I don't think that's currently possible without writing a little lisp code. There is an org-follow-link-hook but it doesn't seem to be executed for all link types - only browser urls if I'm reading the code correctly. The following patch seems to fix it so it executes for plain file links too. You can probably create a function that goes to the point and then narrows the text around the point using this hook. I tested this by setting the hook with (setq org-follow-link-hook 'hide-other) HTH, Bernt --8<---------------cut here---------------start------------->8--- >From 1999493a3c9cdbf989a932726b6aadcf4b72c14e Mon Sep 17 00:00:00 2001 From: Bernt Hansen Date: Thu, 24 Sep 2009 16:04:38 -0400 Subject: [PATCH] Enable org-follow-link-hook for all link types This hook was only executing for browser links. Now we always execute the hook after visiting a link assuming no error occurs. --- This patch is available at git://git.norang.ca/org-mode for-carsten lisp/org.el | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 078c3b7..546df35 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8099,8 +8099,8 @@ application the system uses for this file type." (t (browse-url-at-point)))))) - (move-marker org-open-link-marker nil) - (run-hook-with-args 'org-follow-link-hook))) + (move-marker org-open-link-marker nil)) + (run-hook-with-args 'org-follow-link-hook)) (defun org-offer-links-in-entry (&optional nth zero) "Offer links in the curren entry and follow the selected link. -- 1.6.5.rc1.19.g8426 --8<---------------cut here---------------end--------------->8---