emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Re: linking to region


From: Bernt Hansen
Subject: [Orgmode] Re: linking to region
Date: Thu, 24 Sep 2009 16:14:01 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Maurizio Vitale
<address@hidden> 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 <address@hidden>
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---






reply via email to

[Prev in Thread] Current Thread [Next in Thread]