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

Fixup autoload regex for Emacs. #4810

Merged
merged 1 commit into from
Jul 15, 2021
Merged

Conversation

tmcgilchrist
Copy link
Contributor

Fix for #4222 the regex is not correct.

;; Original regex
;; NOTE 0 is true and nil is false (roughtly speaking)
(string-match "\\(?:\\`\\|/\\)dune\\(?:\\.inc\|-project\\)?\\'" "dune")
0
(string-match "\\(?:\\`\\|/\\)dune\\(?:\\.inc\|-project\\)?\\'" "dune.inc")
nil
(string-match "\\(?:\\`\\|/\\)dune\\(?:\\.inc\|-project\\)?\\'" "dune-project")
nil

;; New regex
(string-match "\\(?:\\`\\|/\\)dune\\(?:\\.inc\\|\\-project\\)?\\'" "dune")
0
(string-match "\\(?:\\`\\|/\\)dune\\(?:\\.inc\\|\\-project\\)?\\'" "dune.inc")
0
(string-match "\\(?:\\`\\|/\\)dune\\(?:\\.inc\\|\\-project\\)?\\'" "dune-project")
0
(string-match "\\(?:\\`\\|/\\)dune\\(?:\\.inc\\|\\-project\\)?\\'" "dune-project.inc")
nil
(string-match "\\(?:\\`\\|/\\)dune\\(?:\\.inc\\|\\-project\\)?\\'" "dune-projects")
nil

;; Potentially simplier regex from regexp-opt though I'm not sure if this covers 
;; all possible cases. I have only tested on OSX and Linux.
(regexp-opt '("dune" "dune-project" "dune.inc"))
"\\(?:dune\\(?:-project\\|\\.inc\\)?\\)"

Signed-off-by: Tim McGilchrist <timmcgil@gmail.com>
@rgrinberg rgrinberg merged commit 16cb826 into ocaml:main Jul 15, 2021
@rgrinberg
Copy link
Member

Thanks

@tmcgilchrist tmcgilchrist deleted the emacs-regex-dune branch July 15, 2021 06:22
@tmcgilchrist
Copy link
Contributor Author

Cheers @rgrinberg the new version is up on MELPA.

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