emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] lisp/org.el (org-open-at-point): prioritize link
@ 2014-02-27 13:28 Oleh
  2014-02-27 22:40 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Oleh @ 2014-02-27 13:28 UTC (permalink / raw)
  To: org mode

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

Hi all,

Can someone check this patch and commit it.
It allows to open links that look like this:

    [[id:164552ee-b92d-4af6-9570-60d039876fac][=foobar=]]

regards,
Oleh

[-- Attachment #2: 0001-lisp-org.el-org-open-at-point-prioritize-link.patch --]
[-- Type: text/x-patch, Size: 1067 bytes --]

From 6e848b0e601c9a28300b00aafcef8f2efda973f4 Mon Sep 17 00:00:00 2001
From: Oleh Krehel <ohwoeowho@gmail.com>
Date: Thu, 27 Feb 2014 14:23:35 +0100
Subject: [PATCH] lisp/org.el (org-open-at-point): prioritize link

* lisp/org.el (org-open-at-point): Check the parent of `context'.
  If it's a link, set `context' to its parent.

Makes sure links with verbatim descriptions are treated as links and
not verbatim.
---
 lisp/org.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/org.el b/lisp/org.el
index 3800d80..92211a8 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10460,6 +10460,8 @@ is used internally by `org-open-link-from-string'."
     (setq org-window-config-before-follow-link (current-window-configuration))
     (org-remove-occur-highlights nil nil t)
     (let* ((context (org-element-context))
+	   (parent (plist-get (cadr context) :parent))
+	   (context (if (eq (car parent) 'link) parent context))
            (type (org-element-type context)))
       (cond
        ;; On a headline or an inlinetask, but not on a timestamp,
-- 
1.8.4


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

* Re: [PATCH] lisp/org.el (org-open-at-point): prioritize link
  2014-02-27 13:28 [PATCH] lisp/org.el (org-open-at-point): prioritize link Oleh
@ 2014-02-27 22:40 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2014-02-27 22:40 UTC (permalink / raw)
  To: Oleh; +Cc: org mode

Hello,

Oleh <ohwoeowho@gmail.com> writes:

> Can someone check this patch and commit it.
> It allows to open links that look like this:
>
>     [[id:164552ee-b92d-4af6-9570-60d039876fac][=foobar=]]

I applied a generalization of your patch. Thank you.

While I'm at it, here are a few comments.

> +	   (parent (plist-get (cadr context) :parent))

This is too low level. It should really be:

  (parent (org-element-property :parent context))

> +	   (context (if (eq (car parent) 'link) parent context))

Same here. The preferred syntax is:

  (context (if (eq (org-element-type parent) 'link) parent context))


Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2014-02-27 22:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-27 13:28 [PATCH] lisp/org.el (org-open-at-point): prioritize link Oleh
2014-02-27 22:40 ` Nicolas Goaziou

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