diff options
author | Samuel Loury <konubinix@gmail.com> | 2013-02-13 16:22:04 +0100 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2013-02-13 16:22:04 +0100 |
commit | 9964d89d1b36be2bc7cc3377f986fb69d981d307 (patch) | |
tree | 3119ca27a93e7cf0a7bd16fb52fe3479850a474a | |
parent | 69032736c1e4d71f58eef9ac1928e3f4a46b7a9e (diff) | |
download | org-mode-9964d89d1b36be2bc7cc3377f986fb69d981d307.tar.gz |
org.el (org-open-at-point): Open a plain link even if the cursor is before it
* org.el (org-open-at-point): Open a plain link even if the
cursor is before it, which is consistent with the behavior
with respect to bracket and angle links.
TINYCHANGE
-rw-r--r-- | lisp/org.el | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lisp/org.el b/lisp/org.el index 2b1fef4..4176f78 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9979,13 +9979,21 @@ application the system uses for this file type." (throw 'match t)) (save-excursion - (let ((plinkpos (org-in-regexp org-plain-link-re))) - (when (or (org-in-regexp org-angle-link-re) - (and plinkpos (goto-char (car plinkpos)) - (save-match-data (not (looking-back "\\[\\["))))) - (setq type (match-string 1) - path (org-link-unescape (match-string 2))) - (throw 'match t)))) + (when (or (org-in-regexp org-angle-link-re) + (let ((match (org-in-regexp org-plain-link-re))) + ;; 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)))))) + (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) + (re-search-forward org-bracket-link-regexp line_ending t)))) + (setq type (match-string 1) + path (org-link-unescape (match-string 2))) + (throw 'match t))) (save-excursion (when (org-in-regexp (org-re "\\(:[[:alnum:]_@#%:]+\\):[ \t]*$")) (setq type "tags" |