diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2014-02-27 18:28:46 +0100 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2014-02-27 18:38:39 +0100 |
commit | 8b2d3645ac655f734d4c9812dd80520330b2edbc (patch) | |
tree | d23df31fe8b4eb52da4cb1b2cd0c73336af01c9b | |
parent | ef207f4424c87f7cbb87d978078523eeda2602a2 (diff) | |
download | org-mode-8b2d3645ac655f734d4c9812dd80520330b2edbc.tar.gz |
Ignore `org-open-at-point' when point is on white spaces
* lisp/org.el (org-open-at-point): Do not do anything when point is on
white spaces after an object.
* testing/lisp/test-org.el (test-org/custom-id): Modify test.
-rw-r--r-- | lisp/org.el | 11 | ||||
-rw-r--r-- | testing/lisp/test-org.el | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/lisp/org.el b/lisp/org.el index 3800d80..836935f 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -10482,6 +10482,17 @@ is used internally by `org-open-link-from-string'." (require 'org-attach) (org-attach-reveal 'if-exists)))) ((run-hook-with-args-until-success 'org-open-at-point-functions)) + ;; Do nothing on white spaces after an object. + ((let ((end (org-element-property :end context))) + (= (save-excursion + ;; Make sure we're not on invisible text, as it would + ;; make the check unpredictable on object's borders. + (when (invisible-p (point)) + (goto-char + (next-single-property-change (point) 'invisible nil end))) + (skip-chars-forward " \t" end) (point)) + end)) + (user-error "No link found")) ((eq type 'timestamp) (org-follow-timestamp-link)) ;; On tags within a headline or an inlinetask. ((save-excursion (beginning-of-line) diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 57e3d53..e3436e6 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -553,7 +553,7 @@ (should (org-test-with-temp-text "* H1\n:PROPERTIES:\n:CUSTOM_ID: custom\n:END:\n* H2\n[[#custom]]" - (goto-char (point-max)) + (goto-char (1- (point-max))) (org-open-at-point) (org-looking-at-p "\\* H1")))) |