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

Rewrite flycheck-parse-xml-region (use xml-parse-region if libxml fails) #1349

Merged
merged 1 commit into from Nov 7, 2017

Conversation

cpitclaudel
Copy link
Member

Closes GH-1298, GH-1330.

fmdkdd
fmdkdd approved these changes Oct 26, 2017
Copy link
Member

@fmdkdd fmdkdd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Although, I wonder if we shouldn't make a new function instead of modifying flycheck-xml-parse-region. Currently, for all the people who have set flycheck-xml-parser to flycheck-parse-xml-region, we might be running libxml first. This may be surprising (but will silently fail).

That being said, if it helps unearth errors in non-XML compliant linters, all the better.

flycheck.el Outdated
from the node list."
(car (xml-parse-region beg end)))
of the node list."
;; FIXME use `libxml-available-p' when it gets implemented.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't be before, at least, Emacs 26, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct

flycheck.el Outdated
;; FIXME use `libxml-available-p' when it gets implemented.
(or (and (fboundp 'libxml-parse-xml-region)
(libxml-parse-xml-region beg end))
(ignore-errors (car (xml-parse-region beg end)))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this wise to silence errors here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean here vs somewhere else, or silencing vs not silencing? If the latter, I don't think we have much of a choice: that's how libxml behaves (it just returns nil when it fails to parse), which we then complain about (unexpected output …). Otherwise we'd throw an error, and we don't currently do that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, so now at least it's coherent with libxml.

@cpitclaudel
Copy link
Member Author

Although, I wonder if we shouldn't make a new function instead of modifying flycheck-xml-parse-region.

Indeed, absolutely.

fmdkdd
fmdkdd approved these changes Oct 26, 2017
Copy link
Member

@fmdkdd fmdkdd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. This probably warrants a line in CHANGES, since it's a user-facing variable.

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.

None yet

2 participants