emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: jorge.alfaro-murillo@yale.edu (Jorge A. Alfaro-Murillo)
To: emacs-orgmode@gnu.org
Subject: Re: How to get the link the point is on?
Date: Thu, 25 Sep 2014 17:49:37 -0400	[thread overview]
Message-ID: <87lhp7gyku.fsf@yale.edu> (raw)
In-Reply-To: 8761gb8lq2.fsf@wmi.amu.edu.pl

Marcin Borkowski writes: 

> Hi list, 
> 
> my question is as in subject.  It is done by org-open-at-point 
> (somehow), but the logic seems to be buried in that function. 
> What I'd like to have is a function that would just extract the 
> link portion (which is normally invisible) and displayed it in 
> the echo area (something like hovering over a link in a web 
> browser). 

This returns the link at the line, it assumes one link per line:

#+BEGIN_SRC emacs-lisp
  (defun test ()
    (save-excursion
      (move-beginning-of-line 1)
      (if (search-forward-regexp org-any-link-re 
      (line-end-position) t)
          (let* ((complete-link (match-string 0))
                 (last-place (string-match "\\]" complete-link)))
            (substring-no-properties complete-link 2 
            last-place))))
 
#+END_SRC

Best,

-- 
Jorge.

  parent reply	other threads:[~2014-09-25 21:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-25 20:54 How to get the link the point is on? Marcin Borkowski
2014-09-25 21:41 ` Rasmus
2014-09-25 23:33   ` Jorge A. Alfaro-Murillo
2014-09-25 21:49 ` Kyle Meyer
2014-09-25 21:49 ` Jorge A. Alfaro-Murillo [this message]
2014-09-25 21:50 ` Thorsten Jolitz
2014-09-25 22:44   ` Marcin Borkowski
2014-09-26 16:54     ` Subhan Michael Tindall
2014-09-27  9:50     ` Sebastien Vauban

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=87lhp7gyku.fsf@yale.edu \
    --to=jorge.alfaro-murillo@yale.edu \
    --cc=emacs-orgmode@gnu.org \
    /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).