From 3bb0cb9398404291b0ced5d14a2577b4a158432e Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 11 Oct 2021 11:18:40 +0200 Subject: [PATCH 1/2] =?UTF-8?q?oc:=20Fix=20=C2=A7=20locator=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lisp/oc-csl.el (org-cite-csl--label-regexp): § is not a word start, so adjust regexp accordingly. Also fix mistake introduced in c4a357f1926ff43545c9891425c94b2771ab4e84. (org-cite-csl--parse-reference): Ignore any space after locator name. --- lisp/oc-csl.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/oc-csl.el b/lisp/oc-csl.el index 07916cd0b..89719d38e 100644 --- a/lisp/oc-csl.el +++ b/lisp/oc-csl.el @@ -271,10 +271,10 @@ If nil then the Chicago author-date style is used as a fallback.") ;; Prior to Emacs-27.1 argument of `regexp' form must be a string literal. ;; It is the reason why `rx' is avoided here. (rx-to-string - `(seq word-start + `(seq (or line-start space) (regexp ,(regexp-opt (mapcar #'car org-cite-csl--label-alist) t)) (0+ digit) - (or word-start line-end space ? )) + (or word-end line-end space " ")) t) "Regexp matching a label in a citation reference suffix. Label is in match group 1.") @@ -426,7 +426,9 @@ The result is a association list. Keys are: `id', `prefix',`suffix', ((re-search-forward org-cite-csl--label-regexp nil t) (setq location-start (match-beginning 0)) (setq label (cdr (assoc (match-string 1) org-cite-csl--label-alist))) - (setq locator-start (match-end 1))) + (goto-char (match-end 1)) + (skip-chars-forward "[:space:] ") + (setq locator-start (point))) ((re-search-forward (rx digit) nil t) (setq location-start (match-beginning 0)) (setq label "page") From eb400919292d96f97f64ade6d6a7b2ced6c8db65 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 11 Oct 2021 11:21:00 +0200 Subject: [PATCH 2/2] oc-csl: Improve an error message * lisp/oc-csl.el (org-cite-csl--style-file): Add missing placeholder for format string. --- lisp/oc-csl.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/oc-csl.el b/lisp/oc-csl.el index 89719d38e..d01d21e4a 100644 --- a/lisp/oc-csl.el +++ b/lisp/oc-csl.el @@ -372,7 +372,7 @@ or raise an error if the variable is unset." ((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" other)))) + (user-error "Cannot handle relative style file name: %S" other)))) (defun org-cite-csl--locale-getter () "Return a locale getter.