|
@@ -4,18 +4,20 @@
|
|
|
|
|
|
;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
|
|
|
|
|
|
-;; This program is free software; you can redistribute it and/or modify
|
|
|
+;; This file is part of GNU Emacs.
|
|
|
+
|
|
|
+;; GNU Emacs 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.
|
|
|
|
|
|
-;; This program is distributed in the hope that it will be useful,
|
|
|
+;; GNU Emacs 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.
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
-;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
+;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
@@ -123,7 +125,7 @@ If nil then only the fallback en-US locale will be available."
|
|
|
:group 'org-cite
|
|
|
:package-version '(Org . "9.5")
|
|
|
:type '(choice
|
|
|
- (dir :tag "Locales directory")
|
|
|
+ (directory :tag "Locales directory")
|
|
|
(const :tag "Use en-US locale only" nil))
|
|
|
:safe t)
|
|
|
|
|
@@ -134,7 +136,7 @@ directory. This variable is ignored when style file is absolute."
|
|
|
:group 'org-cite
|
|
|
:package-version '(Org . "9.5")
|
|
|
:type '(choice
|
|
|
- (dir :tag "Styles directory")
|
|
|
+ (directory :tag "Styles directory")
|
|
|
(const :tag "Use absolute file names" nil))
|
|
|
:safe t)
|
|
|
|
|
@@ -181,15 +183,21 @@ Used only when `second-field-align' is activated by the used CSL style."
|
|
|
|
|
|
;;; Internal variables
|
|
|
(defconst org-cite-csl--etc-dir
|
|
|
- (let* ((oc-root (file-name-directory (locate-library "oc")))
|
|
|
- (oc-etc-dir-1 (expand-file-name "../etc/csl/" oc-root)))
|
|
|
- ;; package.el and straight will put all of org-mode/lisp/ in org-mode/.
|
|
|
- ;; This will cause .. to resolve to the directory above Org.
|
|
|
- ;; To make life easier for people using package.el or straight, we can
|
|
|
- ;; check to see if ../etc/csl exists, and if it doesn't try ./etc/csl.
|
|
|
- (if (file-exists-p oc-etc-dir-1) oc-etc-dir-1
|
|
|
- (expand-file-name "etc/csl/" oc-root)))
|
|
|
- "Directory \"etc/\" from repository.")
|
|
|
+ (let ((oc-root (file-name-directory (locate-library "oc"))))
|
|
|
+ (cond
|
|
|
+ ;; First check whether it looks like we're running from the main
|
|
|
+ ;; Org repository.
|
|
|
+ ((let ((csl-org (expand-file-name "../etc/csl/" oc-root)))
|
|
|
+ (and (file-directory-p csl-org) csl-org)))
|
|
|
+ ;; Next look for the directory alongside oc.el because package.el
|
|
|
+ ;; and straight will put all of org-mode/lisp/ in org-mode/.
|
|
|
+ ((let ((csl-pkg (expand-file-name "etc/csl/" oc-root)))
|
|
|
+ (and (file-directory-p csl-pkg) csl-pkg)))
|
|
|
+ ;; Finally fall back the location used by shared system installs
|
|
|
+ ;; and when running directly from Emacs repository.
|
|
|
+ (t
|
|
|
+ (expand-file-name "org/csl/" data-directory))))
|
|
|
+ "Directory containing CSL-related data files.")
|
|
|
|
|
|
(defconst org-cite-csl--fallback-locales-dir org-cite-csl--etc-dir
|
|
|
"Fallback CSL locale files directory.")
|