Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: properly escape dot in directory-files regex, fixes false matches #731

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

valer-cara
Copy link

It appears that the original regex took \. as a single dot (any character) rather than a literal dot.

I assume it's because single backslashes are dropped in emacs strings if the character following needs no escape as part of a string. However that's desired in the regex.

See
https://www.gnu.org/software/emacs/manual/html_node/elisp/Syntax-for-Strings.html


In my case, it matched a ./beorg subdir causing a further error during the export process -- not a regular file.

@valer-cara
Copy link
Author

I misidentified the issue I had. Turns out it was coming from a misconfigured value for org-agenda-text-search-extra-files which included an empty string in the list, causing the returned file list to also include the current directory. I'll close this PR, apologies for the noise here 🙌

@valer-cara valer-cara closed this Oct 16, 2023
@kaushalmodi
Copy link
Owner

No worries! I'm glad you sorted it out.

@valer-cara
Copy link
Author

valer-cara commented Oct 17, 2023

I just switched to a new computer where I had not mangled the ox-hugo.el code. It had the same issue.

It can be tested by adding a non-regular file, eg. a dir ending in "org" in the current directory of the file to be exported. The code below should reproduce the problem, ran in the buffer to be exported.

(make-directory "foo-org")
(org-hugo-export-wim-to-md)

This should error with "not a regular file .../foo-org". I guess the changes in this PR are ok after all.

@valer-cara valer-cara reopened this Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants