summaryrefslogtreecommitdiff
path: root/contrib/lisp/org-wikinodes.el
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/lisp/org-wikinodes.el')
-rw-r--r--contrib/lisp/org-wikinodes.el53
1 files changed, 26 insertions, 27 deletions
diff --git a/contrib/lisp/org-wikinodes.el b/contrib/lisp/org-wikinodes.el
index bdc3e34..4efc373 100644
--- a/contrib/lisp/org-wikinodes.el
+++ b/contrib/lisp/org-wikinodes.el
@@ -1,6 +1,6 @@
;;; org-wikinodes.el --- Wiki-like CamelCase links to outline nodes
-;; Copyright (C) 2010-2012 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2013 Free Software Foundation, Inc.
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
@@ -9,12 +9,12 @@
;;
;; This file is not part of GNU Emacs.
;;
-;; GNU Emacs is free software: you can redistribute it and/or modify
+;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
-;; GNU Emacs is distributed in the hope that it will be useful,
+;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
@@ -281,30 +281,29 @@ with working links."
link file)
(goto-char (point-min))
(while (re-search-forward re nil t)
- (org-if-unprotected-at (match-beginning 0)
- (unless (save-match-data
- (or (org-at-heading-p)
- (org-in-regexp org-bracket-link-regexp)
- (org-in-regexp org-plain-link-re)
- (org-in-regexp "<<[^<>]+>>")))
- (setq link (match-string 0))
- (delete-region (match-beginning 0) (match-end 0))
- (save-match-data
- (cond
- ((org-find-exact-headline-in-buffer link (current-buffer))
- ;; Found in current buffer
- (insert (format "[[#%s][%s]]" link link)))
- ((eq org-wikinodes-scope 'file)
- ;; No match in file, and other files are not allowed
- (insert (format "%s" link)))
- ((setq file
- (and (org-string-nw-p org-current-export-file)
- (org-wikinodes-which-file
- link (file-name-directory org-current-export-file))))
- ;; Match in another file in the current directory
- (insert (format "[[file:%s::%s][%s]]" file link link)))
- (t ;; No match for this link
- (insert (format "%s" link))))))))))
+ (unless (save-match-data
+ (or (org-at-heading-p)
+ (org-in-regexp org-bracket-link-regexp)
+ (org-in-regexp org-plain-link-re)
+ (org-in-regexp "<<[^<>]+>>")))
+ (setq link (match-string 0))
+ (delete-region (match-beginning 0) (match-end 0))
+ (save-match-data
+ (cond
+ ((org-find-exact-headline-in-buffer link (current-buffer))
+ ;; Found in current buffer
+ (insert (format "[[#%s][%s]]" link link)))
+ ((eq org-wikinodes-scope 'file)
+ ;; No match in file, and other files are not allowed
+ (insert (format "%s" link)))
+ ((setq file
+ (and (org-string-nw-p org-current-export-file)
+ (org-wikinodes-which-file
+ link (file-name-directory org-current-export-file))))
+ ;; Match in another file in the current directory
+ (insert (format "[[file:%s::%s][%s]]" file link link)))
+ (t ;; No match for this link
+ (insert (format "%s" link)))))))))
;;; Hook the WikiNode mechanism into Org