emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to get the link the point is on?
@ 2014-09-25 20:54 Marcin Borkowski
  2014-09-25 21:41 ` Rasmus
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Marcin Borkowski @ 2014-09-25 20:54 UTC (permalink / raw)
  To: Org-mode

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).

I skimmed through org.el, and either I couldn't find a function which
does it, or this email is a feature request;).

TIA,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to get the link the point is on?
  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
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Rasmus @ 2014-09-25 21:41 UTC (permalink / raw)
  To: emacs-orgmode

Marcin Borkowski <mbork@wmi.amu.edu.pl> 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).
>
> I skimmed through org.el, and either I couldn't find a function which
> does it, or this email is a feature request;).

If point is on a link you can

   (org-element-property :raw-link (org-element-context))

Hope it helps,
Rasmus

-- 
May the Force be with you

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to get the link the point is on?
  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 21:49 ` Kyle Meyer
  2014-09-25 21:49 ` Jorge A. Alfaro-Murillo
  2014-09-25 21:50 ` Thorsten Jolitz
  3 siblings, 0 replies; 9+ messages in thread
From: Kyle Meyer @ 2014-09-25 21:49 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Org-mode

Marcin Borkowski <mbork@wmi.amu.edu.pl> wrote:
[...]
> 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).

There may be a better way, but I think below does what you want.

#+begin_src elisp
  (defun org-display-link ()
    (interactive)
    (message "%s" (org-element-property :raw-link (org-element-context))))
#+end_src

--
Kyle

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to get the link the point is on?
  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 21:49 ` Kyle Meyer
@ 2014-09-25 21:49 ` Jorge A. Alfaro-Murillo
  2014-09-25 21:50 ` Thorsten Jolitz
  3 siblings, 0 replies; 9+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2014-09-25 21:49 UTC (permalink / raw)
  To: emacs-orgmode

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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to get the link the point is on?
  2014-09-25 20:54 How to get the link the point is on? Marcin Borkowski
                   ` (2 preceding siblings ...)
  2014-09-25 21:49 ` Jorge A. Alfaro-Murillo
@ 2014-09-25 21:50 ` Thorsten Jolitz
  2014-09-25 22:44   ` Marcin Borkowski
  3 siblings, 1 reply; 9+ messages in thread
From: Thorsten Jolitz @ 2014-09-25 21:50 UTC (permalink / raw)
  To: emacs-orgmode

Marcin Borkowski <mbork@wmi.amu.edu.pl> 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).
>
> I skimmed through org.el, and either I couldn't find a function which
> does it, or this email is a feature request;).

you know about 

,----[ C-h f org-toggle-link-display RET ]
| org-toggle-link-display is an interactive compiled Lisp function in
| `org.el'.
| 
| It is bound to <menu-bar> <Org> <Hyperlinks> <Descriptive Links>,
| <menu-bar> <Org> <Hyperlinks> <Literal Links>.
| 
| (org-toggle-link-display)
| 
| Toggle the literal or descriptive display of links.
`----

?

-- 
cheers,
Thorsten

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to get the link the point is on?
  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
  0 siblings, 2 replies; 9+ messages in thread
From: Marcin Borkowski @ 2014-09-25 22:44 UTC (permalink / raw)
  To: emacs-orgmode


On 2014-09-25, at 23:50, Thorsten Jolitz wrote:

> Marcin Borkowski <mbork@wmi.amu.edu.pl> 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).
>>
>> I skimmed through org.el, and either I couldn't find a function which
>> does it, or this email is a feature request;).
>
> you know about 
>
> ,----[ C-h f org-toggle-link-display RET ]
> | org-toggle-link-display is an interactive compiled Lisp function in
> | `org.el'.
> | 
> | It is bound to <menu-bar> <Org> <Hyperlinks> <Descriptive Links>,
> | <menu-bar> <Org> <Hyperlinks> <Literal Links>.
> | 
> | (org-toggle-link-display)
> | 
> | Toggle the literal or descriptive display of links.
> `----
>
> ?

Yes, I do, but this is not what I'm looking for.  I want to see the
`descriptive' links, only to be able (sometimes) to look up the actual
target of the link.  (And I don't like the idea of moving the point to
the end, pressing <backspace> to delete the rightmost bracket, and then
pressing C-\ to undo it...)

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to get the link the point is on?
  2014-09-25 21:41 ` Rasmus
@ 2014-09-25 23:33   ` Jorge A. Alfaro-Murillo
  0 siblings, 0 replies; 9+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2014-09-25 23:33 UTC (permalink / raw)
  To: emacs-orgmode

Rasmus writes: 

> If point is on a link you can 
> 
>    (org-element-property :raw-link (org-element-context)) 

That's way easier =)

-- 
Jorge.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to get the link the point is on?
  2014-09-25 22:44   ` Marcin Borkowski
@ 2014-09-26 16:54     ` Subhan Michael Tindall
  2014-09-27  9:50     ` Sebastien Vauban
  1 sibling, 0 replies; 9+ messages in thread
From: Subhan Michael Tindall @ 2014-09-26 16:54 UTC (permalink / raw)
  To: 'Marcin Borkowski', emacs-orgmode@gnu.org


[SNIP]
> -----Original Message-----
> From: emacs-orgmode-bounces+subhant=familycareinc.org@gnu.org
> [mailto:emacs-orgmode-bounces+subhant=familycareinc.org@gnu.org] On
> Behalf Of Marcin Borkowski
> Sent: Thursday, September 25, 2014 3:45 PM
> To: emacs-orgmode@gnu.org
> Subject: Re: [O] How to get the link the point is on?
[SNIP]
> > you know about
> >
> > ,----[ C-h f org-toggle-link-display RET ]
> > | org-toggle-link-display is an interactive compiled Lisp function in
> > | `org.el'.
> > |
> > | It is bound to <menu-bar> <Org> <Hyperlinks> <Descriptive Links>,
> > | <menu-bar> <Org> <Hyperlinks> <Literal Links>.
> > |
> > | (org-toggle-link-display)
> > |
> > | Toggle the literal or descriptive display of links.
> > `----
> >
> > ?
> 
> Yes, I do, but this is not what I'm looking for.  I want to see the `descriptive'
> links, only to be able (sometimes) to look up the actual target of the link.
> (And I don't like the idea of moving the point to the end, pressing
> <backspace> to delete the rightmost bracket, and then pressing C-\ to undo
> it...)
[>] 

I accomplish this by using C-c C-l  RET RET (which is bound to org-insert-link and resides in org.el)
Technically it pops up the long link and description for editing in the message buffer, but they default to current values so effectively provide an easy display.  Works from anywhere in the highlighted link.
If nothing else it should point you at some modifiable code you can use for display.

Subhan


> 
> Best,
> 
> --
> Marcin Borkowski
> http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
> Adam Mickiewicz University


This message is intended for the sole use of the individual and entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email and delete the message.  Thank you.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How to get the link the point is on?
  2014-09-25 22:44   ` Marcin Borkowski
  2014-09-26 16:54     ` Subhan Michael Tindall
@ 2014-09-27  9:50     ` Sebastien Vauban
  1 sibling, 0 replies; 9+ messages in thread
From: Sebastien Vauban @ 2014-09-27  9:50 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Marcin Borkowski wrote:
> On 2014-09-25, at 23:50, Thorsten Jolitz wrote:
>> Marcin Borkowski <mbork-12VZH/wba7B4rM3dGMyr8Q@public.gmane.org> writes:
>>>
>>> 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).
>>>
>>> I skimmed through org.el, and either I couldn't find a function which
>>> does it, or this email is a feature request;).
>>
>> you know about 
>>
>> ,----[ C-h f org-toggle-link-display RET ]
>> | org-toggle-link-display is an interactive compiled Lisp function in
>> | `org.el'.
>> | 
>> | It is bound to <menu-bar> <Org> <Hyperlinks> <Descriptive Links>,
>> | <menu-bar> <Org> <Hyperlinks> <Literal Links>.
>> | 
>> | (org-toggle-link-display)
>> | 
>> | Toggle the literal or descriptive display of links.
>> `----
>
> Yes, I do, but this is not what I'm looking for.  I want to see the
> `descriptive' links, only to be able (sometimes) to look up the actual
> target of the link.  (And I don't like the idea of moving the point to
> the end, pressing <backspace> to delete the rightmost bracket, and then
> pressing C-\ to undo it...)

When I want to see *all* the contents in my Org file (that is LOGBOOK
entries, URL in links, etc.), I use M-x visible-mode.

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-09-27  9:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).