summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-09-24 10:57:11 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-09-24 10:57:11 +0200
commitd40deb6967dd7d2369576319cd1c517e1c454b95 (patch)
treeb48b099c48186e11d96cf92c3557d3809f712e94
parent196ed7feffdb3da402924bfd8a71729b816cd804 (diff)
downloadorg-mode-d40deb6967dd7d2369576319cd1c517e1c454b95.tar.gz
ox-publish: Fix :base-extension any with :recursive t
* lisp/ox-publish.el (org-publish-get-base-files): Ensure MATCH regexp is always a string since `directory-files-recursively' requires it. * testing/lisp/test-ox-publish.el (test-org-publish/get-project-from-filename): Add test. Suggested-by: Jens Lechtenboerger <lechten@wi.uni-muenster.de> <http://lists.gnu.org/archive/html/emacs-orgmode/2017-09/msg00528.html>
-rw-r--r--lisp/ox-publish.el4
-rw-r--r--testing/lisp/test-ox-publish.el8
2 files changed, 10 insertions, 2 deletions
diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el
index a975abc..957b0da 100644
--- a/lisp/ox-publish.el
+++ b/lisp/ox-publish.el
@@ -435,8 +435,8 @@ This splices all the components into the list."
(let* ((base-dir (file-name-as-directory
(org-publish-property :base-directory project)))
(extension (or (org-publish-property :base-extension project) "org"))
- (match (and (not (eq extension 'any))
- (concat "^[^\\.].*\\.\\(" extension "\\)$")))
+ (match (if (eq extension 'any) ""
+ (format "^[^\\.].*\\.\\(%s\\)$" extension)))
(base-files
(cl-remove-if #'file-directory-p
(if (org-publish-property :recursive project)
diff --git a/testing/lisp/test-ox-publish.el b/testing/lisp/test-ox-publish.el
index cefddee..921e69e 100644
--- a/testing/lisp/test-ox-publish.el
+++ b/testing/lisp/test-ox-publish.el
@@ -394,6 +394,14 @@ Unless set otherwise in PROPERTIES, `:base-directory' is set to
(org-publish-project-alist
`(("p" :base-directory ,base :base-extension any))))
(org-publish-get-project-from-filename file)))
+ ;; Pathological case: Handle both :extension any and :recursive t.
+ (should
+ (let* ((base (expand-file-name "examples/pub/" org-test-dir))
+ (file (expand-file-name "sub/c.org" base))
+ (org-publish-project-alist
+ `(("p" :base-directory ,base :recursive t :base-extension any))))
+ (org-publish-get-base-files (org-publish-get-project-from-filename file))))
+
;; Check :exclude property.
(should-not
(let* ((base (expand-file-name "examples/pub/" org-test-dir))