emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Oleh <ohwoeowho@gmail.com>
To: org mode <emacs-orgmode@gnu.org>
Subject: [PATCH] lisp/org.el (org-open-at-point): prioritize link
Date: Thu, 27 Feb 2014 14:28:57 +0100	[thread overview]
Message-ID: <CAA01p3pNBFfdTh870gR7J+xchzFiPS11+54BW67S7t0SVDbpGw@mail.gmail.com> (raw)

[-- 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


             reply	other threads:[~2014-02-27 13:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-27 13:28 Oleh [this message]
2014-02-27 22:40 ` [PATCH] lisp/org.el (org-open-at-point): prioritize link Nicolas Goaziou

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=CAA01p3pNBFfdTh870gR7J+xchzFiPS11+54BW67S7t0SVDbpGw@mail.gmail.com \
    --to=ohwoeowho@gmail.com \
    --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).