emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: maurizio.vitale@polymath-solutions.com
Cc: emacs-orgmode@gnu.org
Subject: Re: linking to region
Date: Thu, 24 Sep 2009 16:14:01 -0400	[thread overview]
Message-ID: <87ljk4hzhy.fsf@gollum.intra.norang.ca> (raw)
In-Reply-To: 87ocp0jl9m.fsf@cuma.i-did-not-set--mail-host-address--so-tickle-me

Maurizio Vitale
<mav@cuma.i-did-not-set--mail-host-address--so-tickle-me> 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 <bernt@norang.ca>
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	other threads:[~2009-09-24 20:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-24 17:38 linking to region Maurizio Vitale
2009-09-24 20:14 ` Bernt Hansen [this message]
2009-09-24 20:39   ` Maurizio Vitale
2009-09-24 20:44     ` Bernt Hansen
2009-09-24 20:52       ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ljk4hzhy.fsf@gollum.intra.norang.ca \
    --to=bernt@norang.ca \
    --cc=emacs-orgmode@gnu.org \
    --cc=maurizio.vitale@polymath-solutions.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).