summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2010-11-02 23:04:10 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2010-11-02 23:04:10 +0100
commitaeaf05238c062f2f4e76b51bcd73b296944f2797 (patch)
treecd98432340ed08970a0f1cb45cbc3e447be2b917
parentf0d2bcb1bf1510b9e3ce8995efcb1cb50f6a4290 (diff)
downloadorg-mode-aeaf05238c062f2f4e76b51bcd73b296944f2797.tar.gz
Limit creation of ID links only in Org mode buffers
* lisp/org-id.el (org-id-store-link): Test for org-mode before checking for IDs. Reporte and fix suggestion by Liam Healy
-rw-r--r--lisp/org-id.el21
1 files changed, 12 insertions, 9 deletions
diff --git a/lisp/org-id.el b/lisp/org-id.el
index d9e2e45..bb8dc39 100644
--- a/lisp/org-id.el
+++ b/lisp/org-id.el
@@ -600,15 +600,18 @@ optional argument MARKERP, return the position as a new marker."
(defun org-id-store-link ()
"Store a link to the current entry, using its ID."
(interactive)
- (let* ((link (org-make-link "id:" (org-id-get-create)))
- (case-fold-search nil)
- (desc (save-excursion
- (org-back-to-heading t)
- (or (and (looking-at org-complex-heading-regexp)
- (if (match-end 4) (match-string 4) (match-string 0)))
- link))))
- (org-store-link-props :link link :description desc :type "id")
- link))
+ (when (org-mode-p)
+ (let* ((link (org-make-link "id:" (org-id-get-create)))
+ (case-fold-search nil)
+ (desc (save-excursion
+ (org-back-to-heading t)
+ (or (and (looking-at org-complex-heading-regexp)
+ (if (match-end 4)
+ (match-string 4)
+ (match-string 0)))
+ link))))
+ (org-store-link-props :link link :description desc :type "id")
+ link)))
(defun org-id-open (id)
"Go to the entry with id ID."