summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien <bzg@gnu.org>2020-01-26 08:44:16 +0100
committerBastien <bzg@gnu.org>2020-01-26 08:44:16 +0100
commitac2c0f9a754c4312765f95858e9034cb22751d3f (patch)
tree5338cdb334acde34eb17ad7f5b26b03f60b11e17
parent1f6bacf88c7af53ad22311dd1245c132586fc73d (diff)
downloadorg-mode-ac2c0f9a754c4312765f95858e9034cb22751d3f.tar.gz
org.el: Don't forceably try ot open attachments
* lisp/org.el (org-open-at-point): Don't forceably try ot open attachments. This commit fixes a bug: when trying to open links in a subtree with no attachments, `org-open-at-point' would create an ID property with no apparent reason.
-rw-r--r--lisp/org.el50
1 files changed, 25 insertions, 25 deletions
diff --git a/lisp/org.el b/lisp/org.el
index f94fa3d..8ca15c6 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8681,31 +8681,31 @@ a link."
;; a link, a footnote reference.
((memq type '(headline inlinetask))
(org-match-line org-complex-heading-regexp)
- (if (and (match-beginning 5)
- (>= (point) (match-beginning 5))
- (< (point) (match-end 5)))
- ;; On tags.
- (org-tags-view
- arg
- (save-excursion
- (let* ((beg (match-beginning 5))
- (end (match-end 5))
- (beg-tag (or (search-backward ":" beg 'at-limit) (point)))
- (end-tag (search-forward ":" end nil 2)))
- (buffer-substring (1+ beg-tag) (1- end-tag)))))
- ;; Not on tags.
- (pcase (org-offer-links-in-entry (current-buffer) (point) arg)
- (`(nil . ,_)
- (require 'org-attach)
- (message "Opening attachment-dir")
- (if (equal arg '(4))
- (org-attach-reveal-in-emacs)
- (org-attach-reveal)))
- (`(,links . ,links-end)
- (dolist (link (if (stringp links) (list links) links))
- (search-forward link nil links-end)
- (goto-char (match-beginning 0))
- (org-open-at-point arg))))))
+ (let ((tags-beg (match-beginning 5))
+ (tags-end (match-end 5))
+ (tags-str (match-string 5)))
+ (if (and tags-beg (>= (point) tags-beg) (< (point) tags-end))
+ ;; On tags.
+ (org-tags-view
+ arg
+ (save-excursion
+ (let* ((beg-tag (or (search-backward ":" tags-beg 'at-limit) (point)))
+ (end-tag (search-forward ":" tags-end nil 2)))
+ (buffer-substring (1+ beg-tag) (1- end-tag)))))
+ ;; Not on tags.
+ (pcase (org-offer-links-in-entry (current-buffer) (point) arg)
+ (`(nil . ,_)
+ (require 'org-attach)
+ (when (org-attach-dir)
+ (message "Opening attachment")
+ (if (equal arg '(4))
+ (org-attach-reveal-in-emacs)
+ (org-attach-reveal))))
+ (`(,links . ,links-end)
+ (dolist (link (if (stringp links) (list links) links))
+ (search-forward link nil links-end)
+ (goto-char (match-beginning 0))
+ (org-open-at-point arg)))))))
;; On a footnote reference or at definition's label.
((or (eq type 'footnote-reference)
(and (eq type 'footnote-definition)