From a08bff41384389321d5ecc4180e176bd7361a402 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 5 Feb 2014 10:56:50 +0100 Subject: [PATCH] org.el (org-open-at-point): Fix bug when opening a plain link followed by a bracket link * org.el (org-open-at-point): Fix bug when opening a plain link followed by a bracket link. Thanks to John Kitchin for reporting this. --- lisp/org.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 8ce736119..12d3581d0 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -10339,7 +10339,8 @@ application the system uses for this file type." (let (type path link line search (pos (point))) (catch 'match (save-excursion - (skip-chars-forward "^]\n\r") + (or (org-in-regexp org-plain-link-re) + (skip-chars-forward "^]\n\r")) (when (org-in-regexp org-bracket-link-regexp 1) (setq link (org-extract-attributes (org-link-unescape (org-match-string-no-properties 1)))) @@ -10377,9 +10378,10 @@ application the system uses for this file type." ;; Check a plain link is not within a bracket link (and match (save-excursion - (progn - (goto-char (car match)) - (not (org-in-regexp org-bracket-link-regexp)))))) + (save-match-data + (progn + (goto-char (car match)) + (not (org-in-regexp org-bracket-link-regexp))))))) (let ((line_ending (save-excursion (end-of-line) (point)))) ;; We are in a line before a plain or bracket link (or (re-search-forward org-plain-link-re line_ending t)