emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] c-csl : accept relative CSL filenames


From: Nicolas Goaziou
Subject: Re: [PATCH] c-csl : accept relative CSL filenames
Date: Thu, 04 Nov 2021 23:16:36 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hello,

Emmanuel Charpentier <emm.charpentier@free.fr> writes:

> IMHO, `org-cite-csl-styles-dir' is deemed to be a more-or-less
> permanent setting (possibly in `.emacs'), whereas allowing a relative
> filename doesn't need any initial setup.

But your patch blocks any use for `org-cite-csl-styles-dir' (relative
file names can always be expanded from `default-directory', the other
branches are thus ignored). So it is either, not both.

I think there are two ways forward when a relative file name is used:

1. First check `org-cite-csl-styles-dir' and, if it is nil, expand
   against `default-directory';

2. Drop `org-cite-csl-styles-dir' and always expand against
   `default-directory'.

 What do oc-csl users think about it?

>> > +    ((and (pred (lambda (x)
>> > +                 (let ((fn (expand-file-name x default-directory)))
>> > +                   (if (file-exists-p fn) fn nil)))) file) file)
>> 
>> This pattern returns the relative file name, not the expanded one. It
>> may not be what you want.
>
> From `expand-file-name' docstring :

I'm not commenting about `expand-file-name', but about your `pcase'
pattern:

  (pcase relative-file-name
    ((and (pred ...) file) file))

IIUC, the above will return `file', which matches `relative-file-name',
not the return value from the predicate.

Regards,
-- 
Nicolas Goaziou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]