Org-mode mailing list
 help / color / mirror / Atom feed
* Viewing link information
@ 2020-10-30 16:14 Russell Adams
  2020-10-30 16:38 ` Garjola Dindi
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Russell Adams @ 2020-10-30 16:14 UTC (permalink / raw)
  To: emacs-orgmode

Are there other ways to view information about an org link that I
don't list below?

 - M-x org-insert-link, the prompts for link and description show the
   current values. Requires interacting with the prompts.

 - Switch to fundamental mode

 - M-x org-toggle-link-display

Are there ways to see this information live while navigating? Maybe on
the modeline, or messages?

------------------------------------------------------------------
Russell Adams                            RLAdams@AdamsInfoServ.com

PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/

Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3


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

* Re: Viewing link information
  2020-10-30 16:14 Viewing link information Russell Adams
@ 2020-10-30 16:38 ` Garjola Dindi
  2020-10-30 16:48 ` Greg Minshall
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Garjola Dindi @ 2020-10-30 16:38 UTC (permalink / raw)
  To: emacs-orgmode

On Fri 30-Oct-2020 at 17:14:37 +01, Russell Adams
<RLAdams@AdamsInfoServ.Com> wrote: 
> Are there other ways to view information about an org link that I
> don't list below?
>
>  - M-x org-insert-link, the prompts for link and description show the
>    current values. Requires interacting with the prompts.
>
>  - Switch to fundamental mode
>
>  - M-x org-toggle-link-display
>
> Are there ways to see this information live while navigating? Maybe on
> the modeline, or messages?
>

I have this in my init file. I don't remember where I got it from.

It displays the link target in the minibuffer when point is on a link. 

#+BEGIN_SRC emacs-lisp
(defvar my/org-link-target-message-timer nil
  "Variable to store the link message timer in.")

(defun my/org-link-target-show-link-messages ()
  "Turn on link messages.
You will see a message in the minibuffer when on an org link."
  (interactive)
  (or my/org-link-target-message-timer
      (setq my/org-link-target-message-timer
            (run-with-idle-timer 0.5 t
	    'my/org-link-target-link-message)
	    my/org-link-target-show-link-on-enter t)))


(defun my/org-link-target-cancel-link-messages ()
  "Stop showing messages in minibuffer when on a link."
  (interactive)
  (cancel-timer my/org-link-target-message-timer)
  (setq my/org-link-target-message-timer nil
	my/org-link-target-show-link-on-enter nil))

(setq my/org-link-target-show-link-on-enter t)

(when my/org-link-target-show-link-on-enter
  (my/org-link-target-show-link-messages))

(defun my/org-link-target-link-message ()
  "Print a minibuffer message about the link that point is on."
  (interactive)
  ;; the way links are recognized in org-element-context counts blank
  ;; spaces after a link and the closing brackets in literal links. We
  ;; don't try to get a message if the cursor is on those, or if it is
  ;; on a blank line.
  (when (not (or (looking-at " ")	;looking at a space
		 (lookinpg-at "^$")	;looking at a blank line
		 (looking-at "]")	;looking at a bracket at the end
                                        ;looking at the end of the line.
		 (looking-at "$")))

    (save-restriction
      (widen)
      (when (eq major-mode 'org-mode)
        (let* ((object (org-element-context))
               (type (org-element-property :type object))
               (link-content (org-element-property :path
               object)))
          (save-excursion
            (when (-contains? '("http" "https" "file") type)
              (message "%s:%s" type link-content))))))))
#+END_SRC



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

* Re: Viewing link information
  2020-10-30 16:14 Viewing link information Russell Adams
  2020-10-30 16:38 ` Garjola Dindi
@ 2020-10-30 16:48 ` Greg Minshall
  2020-10-31  2:47 ` Maxim Nikulin
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Greg Minshall @ 2020-10-30 16:48 UTC (permalink / raw)
  To: Russell Adams; +Cc: emacs-orgmode

Russell,

> Are there other ways to view information about an org link that I
> don't list below?

i'll admit, this is how i do it: position cursor just before link, right
arrow, C-d: having deleted the initial '[', the rest is revealed.  then,
C-_ to undo.


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

* Re: Viewing link information
  2020-10-30 16:14 Viewing link information Russell Adams
  2020-10-30 16:38 ` Garjola Dindi
  2020-10-30 16:48 ` Greg Minshall
@ 2020-10-31  2:47 ` Maxim Nikulin
  2020-11-09 17:05 ` ian martins
  2020-11-09 22:15 ` Diego Zamboni
  4 siblings, 0 replies; 7+ messages in thread
From: Maxim Nikulin @ 2020-10-31  2:47 UTC (permalink / raw)
  To: emacs-orgmode

2020-10-30 Russell Adams wrote:
> Are there other ways to view information about an org link that I
> don't list below?
...
> Are there ways to see this information live while navigating? Maybe on
> the modeline, or messages?

C-h .

Displaying links in minibuffer is regularly discussed here. E.g. the 
following message has a link to an older thread therein
https://orgmode.org/list/rjddg8$c9f$1@ciao.gmane.io/

Sometimes I think of something like footnotes or margin notes 
representation for links in the visible part of the buffer. Unsure 
however if it would be really convenient and feasible. Unlike with 
literal links option, long URLs should not distort paragraphs but no 
additional action is required to view link target.



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

* Re: Viewing link information
  2020-10-30 16:14 Viewing link information Russell Adams
                   ` (2 preceding siblings ...)
  2020-10-31  2:47 ` Maxim Nikulin
@ 2020-11-09 17:05 ` ian martins
  2020-11-10 16:42   ` Maxim Nikulin
  2020-11-09 22:15 ` Diego Zamboni
  4 siblings, 1 reply; 7+ messages in thread
From: ian martins @ 2020-11-09 17:05 UTC (permalink / raw)
  To: Org-Mode mailing list

[-- Attachment #1: Type: text/plain, Size: 899 bytes --]

There is a shortcut to copy the link here
<https://orgmode.org/worg/org-hacks.html#org98f055b>. You could display it
in the same way.

On Fri, Oct 30, 2020 at 12:15 PM Russell Adams <RLAdams@adamsinfoserv.com>
wrote:

> Are there other ways to view information about an org link that I
> don't list below?
>
>  - M-x org-insert-link, the prompts for link and description show the
>    current values. Requires interacting with the prompts.
>
>  - Switch to fundamental mode
>
>  - M-x org-toggle-link-display
>
> Are there ways to see this information live while navigating? Maybe on
> the modeline, or messages?
>
> ------------------------------------------------------------------
> Russell Adams                            RLAdams@AdamsInfoServ.com
>
> PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/
>
> Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3
>
>

[-- Attachment #2: Type: text/html, Size: 1378 bytes --]

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

* Re: Viewing link information
  2020-10-30 16:14 Viewing link information Russell Adams
                   ` (3 preceding siblings ...)
  2020-11-09 17:05 ` ian martins
@ 2020-11-09 22:15 ` Diego Zamboni
  4 siblings, 0 replies; 7+ messages in thread
From: Diego Zamboni @ 2020-11-09 22:15 UTC (permalink / raw)
  To: Org-mode

[-- Attachment #1: Type: text/plain, Size: 1443 bytes --]

Hi Russell,

I am using Doom Emacs, and in its default Org configuration it does exactly
that: the link target is shown in the minibuffer after a brief delay, when
the cursor is on the link. A bit of investigation reveals that it's using
org-eldoc. This seems to be the code responsible for it:

https://github.com/hlissner/doom-emacs/blob/develop/modules/lang/org/config.el#L167-L171

  (defadvice! +org-display-link-in-eldoc-a (&rest _)
    "Display full link in minibuffer when cursor/mouse is over it."
    :before-until #'org-eldoc-documentation-function
    (when-let (link (org-element-property :raw-link (org-element-context)))
      (format "Link: %s" link)))

--Diego


On Fri, Oct 30, 2020 at 5:15 PM Russell Adams <RLAdams@adamsinfoserv.com>
wrote:

> Are there other ways to view information about an org link that I
> don't list below?
>
>  - M-x org-insert-link, the prompts for link and description show the
>    current values. Requires interacting with the prompts.
>
>  - Switch to fundamental mode
>
>  - M-x org-toggle-link-display
>
> Are there ways to see this information live while navigating? Maybe on
> the modeline, or messages?
>
> ------------------------------------------------------------------
> Russell Adams                            RLAdams@AdamsInfoServ.com
>
> PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/
>
> Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3
>
>

[-- Attachment #2: Type: text/html, Size: 2216 bytes --]

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

* Re: Viewing link information
  2020-11-09 17:05 ` ian martins
@ 2020-11-10 16:42   ` Maxim Nikulin
  0 siblings, 0 replies; 7+ messages in thread
From: Maxim Nikulin @ 2020-11-10 16:42 UTC (permalink / raw)
  To: emacs-orgmode

2020-11-10 ian martins wrote:
> There is a shortcut to copy the link here 
> <https://orgmode.org/worg/org-hacks.html#org98f055b>. You could display 
> it in the same way.

It seems that original question was on viewing link, not copying it.

As to copy, another possibility (borrowed from some stackoverflow 
answer) is to use text properties:

   (let* ((prop (get-text-property (point) 'htmlize-link))
          (target (if (and (listp prop) (eq (car prop) ':uri)) (cadr 
prop))))

Maybe it is worth adding actions for particular target types, e.g 
stripping file:// to allow usage of the path in a shell command.



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

end of thread, other threads:[~2020-11-10 16:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-30 16:14 Viewing link information Russell Adams
2020-10-30 16:38 ` Garjola Dindi
2020-10-30 16:48 ` Greg Minshall
2020-10-31  2:47 ` Maxim Nikulin
2020-11-09 17:05 ` ian martins
2020-11-10 16:42   ` Maxim Nikulin
2020-11-09 22:15 ` Diego Zamboni

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git