From e32a45ed36d6000db4b39171149072d11b77af72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Delafond?= Date: Sun, 13 Jul 2014 13:35:27 +0200 Subject: Imported Upstream version 8.0.7 --- contrib/lisp/org-wikinodes.el | 53 +++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 27 deletions(-) (limited to 'contrib/lisp/org-wikinodes.el') 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 ;; 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 -- cgit v1.2.3