emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] be more cautious when setting csl etc dir location
@ 2021-07-12 18:07 Timothy
  2021-07-12 18:24 ` Bruce D'Arcus
  2021-07-14 19:39 ` Timothy
  0 siblings, 2 replies; 3+ messages in thread
From: Timothy @ 2021-07-12 18:07 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 311 bytes --]

Hello,

It's come to my attention that the current value of
org-cite-ctl--etc-dir is problematic for anyone managing Org with
package.el or straight. This patch adds a check to see if the initial
location actually exists, if it doesn't we try the expected location
when using package.el/straight.

-- 
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-oc-csl-be-more-caution-about-the-csl-etc-location.patch --]
[-- Type: text/x-patch, Size: 1639 bytes --]

From 5e6700177f4ef59131c153d985b8eaeb3b303799 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Tue, 13 Jul 2021 02:00:38 +0800
Subject: [PATCH] oc-csl: be more caution about the csl etc location

* lisp/oc-csl.el (org-cite-ctl--etc-dir): The previous value of
`org-cite-ctl--etc-dir' is incorrect when using either package.el or
straight to manage Org. We can be a bit more considerate by just
checking if the initial location exists, and then trying the expected
location when using package.el/straight if it doesn't exist.
---
 lisp/oc-csl.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/oc-csl.el b/lisp/oc-csl.el
index a7a2a6042..5e0e27211 100644
--- a/lisp/oc-csl.el
+++ b/lisp/oc-csl.el
@@ -177,9 +177,14 @@ (defcustom org-cite-csl-latex-hanging-indent "1.5em"
 \f
 ;;; Internal variables
 (defconst org-cite-csl--etc-dir
-  (expand-file-name
-   (concat (file-name-directory (locate-library "oc"))
-           "../etc/csl/"))
+  (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.")
 
 (defconst org-cite-csl--fallback-locales-dir org-cite-csl--etc-dir
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] be more cautious when setting csl etc dir location
  2021-07-12 18:07 [PATCH] be more cautious when setting csl etc dir location Timothy
@ 2021-07-12 18:24 ` Bruce D'Arcus
  2021-07-14 19:39 ` Timothy
  1 sibling, 0 replies; 3+ messages in thread
From: Bruce D'Arcus @ 2021-07-12 18:24 UTC (permalink / raw)
  To: Timothy; +Cc: org-mode-email

FWIW, I ran into this issue.

After installing org, oc-csl looks in the wrong path for the etc files.

On Mon, Jul 12, 2021 at 2:07 PM Timothy <tecosaur@gmail.com> wrote:
>
> Hello,
>
> It's come to my attention that the current value of
> org-cite-ctl--etc-dir is problematic for anyone managing Org with
> package.el or straight. This patch adds a check to see if the initial
> location actually exists, if it doesn't we try the expected location
> when using package.el/straight.
>
> --
> Timothy
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] be more cautious when setting csl etc dir location
  2021-07-12 18:07 [PATCH] be more cautious when setting csl etc dir location Timothy
  2021-07-12 18:24 ` Bruce D'Arcus
@ 2021-07-14 19:39 ` Timothy
  1 sibling, 0 replies; 3+ messages in thread
From: Timothy @ 2021-07-14 19:39 UTC (permalink / raw)
  To: org-mode-email


Applied.

This seems quite simple, so I've taken the liberty of applying the
patch. Please don't hesitate to revert it if something seems off.

--
Timothy <tecosaur@gmail.com> writes:

> Hello,
>
> It's come to my attention that the current value of
> org-cite-ctl--etc-dir is problematic for anyone managing Org with
> package.el or straight. This patch adds a check to see if the initial
> location actually exists, if it doesn't we try the expected location
> when using package.el/straight.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-14 19:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-12 18:07 [PATCH] be more cautious when setting csl etc dir location Timothy
2021-07-12 18:24 ` Bruce D'Arcus
2021-07-14 19:39 ` Timothy

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).