From 80e4121f8a74aec1e5638713ce7af8e041404e44 Mon Sep 17 00:00:00 2001 From: Emmanuel Charpentier Date: Tue, 19 Oct 2021 19:57:17 +0200 Subject: [PATCH] oc-csl : accept relative CSL filenames --- lisp/oc-csl.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/oc-csl.el b/lisp/oc-csl.el index 94de97e33..ab75db85b 100644 --- a/lisp/oc-csl.el +++ b/lisp/oc-csl.el @@ -364,15 +364,19 @@ corresponding to one of the output formats supported by Citeproc: `html', INFO is the export state, as a property list. -When file name is relative, expand it according to `org-cite-csl-styles-dir', +When file name is relative, expand it according to the buffer's default +directory, failing that according to `org-cite-csl-styles-dir', or raise an error if the variable is unset." (pcase (org-cite-bibliography-style info) ('nil org-cite-csl--fallback-style-file) ((and (pred file-name-absolute-p) file) file) + ((and (pred (lambda (x) + (let ((fn (expand-file-name x default-directory))) + (if (file-exists-p fn) fn nil)))) file) file) ((and (guard org-cite-csl-styles-dir) file) (expand-file-name file org-cite-csl-styles-dir)) (other - (user-error "Cannot handle relative style file name: %S" other)))) + (user-error "CSL style file not found: %S" other)))) (defun org-cite-csl--locale-getter () "Return a locale getter. -- 2.33.0