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

Add Email (eml) language #4201

Merged
merged 14 commits into from Oct 5, 2018
Merged

Add Email (eml) language #4201

merged 14 commits into from Oct 5, 2018

Conversation

wesinator
Copy link
Contributor

@wesinator wesinator commented Jul 19, 2018

Description

Adds email header language support

Checklist:

Copy link
Contributor

@pchaigno pchaigno left a comment

Choose a reason for hiding this comment

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

Thanks for the pull request!

I left a few comments below we'll need to address before merging.

- ".eml"
- ".email"
- ".mail"
- ".mime"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I understand what this extension has to do with this...?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pchaigno Those were the extensions in the textmate grammar. I'll remove the last three

type: data
extensions:
- ".eml"
- ".email"
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like a lot of the .email files are not EML. There's few benefit to add support for data languages anyway, so I think it'd be better to remove that file extension from the pull request.

extensions:
- ".eml"
- ".email"
- ".mail"
Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -1244,6 +1244,16 @@ Emacs Lisp:
codemirror_mode: commonlisp
codemirror_mime_type: text/x-common-lisp
language_id: 102
Email:
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't EML be a better name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"Email" is more human readable and won't be confused/conflict with other potential languages (https://github.com/NCEAS/eml, http://xml.coverpages.org/eml.html), but it may not matter.

@wesinator
Copy link
Contributor Author

Done. I actually tried changing the grammar to https://github.com/mariozaizar/language-eml, but it has the following error:

$ script/grammar-compiler add vendor/grammars/language-eml

  > latest: Pulling from linguist/grammar-compiler
  > Digest: sha256:b019869fcf736922e21dd44d2982a0f78ce31b9d24f73f4f758ef1a071c8b4a7
  > Status: Image is up to date for linguist/grammar-compiler:latest
  > The new grammar repository `vendor/grammars/language-eml` (from https://github.com/mariozaizar/language-eml) contains 1 errors:
  >     - Missing include in grammar: `text.eml.basic` (in `grammars/language-eml.cson`) attempts to include `text.html.basic` but the scope cannot be found
  > 
  > failed to compile the given grammar
Command failed. Aborting.

@pchaigno
Copy link
Contributor

@wesinator Why did you need to change it? Did you remove the other one before?

@wesinator
Copy link
Contributor Author

@pchaigno I don't need to change it, language-eml just looks more active and has other file extensions

@pchaigno
Copy link
Contributor

@wesinator
Copy link
Contributor Author

@pchaigno Yes, I did that and got the error in #4201 (comment)

@pchaigno
Copy link
Contributor

@wesinator It works for me on your pull request. Are you sure you used the right command (./script/add-grammar --replace eml-tmLanguage https://github.com/mariozaizar/language-eml)?

@wesinator
Copy link
Contributor Author

wesinator commented Jul 19, 2018

Yes, the grammar has the same error

Edit: interesting, it outputs Command failed. Aborting. but I see it did update the grammar.

@pchaigno
Copy link
Contributor

Hm. Maybe I don't have the same error because I pulled the submodules. Could you either download the submodules (git submodules update --init --recursive, it takes a while) or add '-f' to https://github.com/github/linguist/blob/5db20d64a2db4339e88ed729954eb8e849092e41/script/add-grammar#L108 and run the command again (it should ignore compilation errors)?

@wesinator
Copy link
Contributor Author

wesinator commented Jul 20, 2018

It works when I run with submodules, but it also removes some unrelated grammars from grammars.yml and vendor/README.md, breaking the build.
https://github.com/github/linguist/pull/4201/files#diff-a17c4358d2937044f2b1438211b3a8f2

Why would it be messing with other grammars ?

EDIT: manually removing and adding the new grammar without --replace works correctly.

- ".eml"
- ".mbox"
- ".mbx"
- ".msg"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a search query to your original post for each new extension. We need to check that they are popular enough as EML extensions on GitHub and that we won't risk miss-classifying other languages that use those extensions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pchaigno done.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like .msg and .mbx have a lot of non-EML files that would be mis-classified:

Where did you find these extensions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again they're defined in the grammar.

@pchaigno
Copy link
Contributor

This pull request is on hold right now because of a serious-enough issue with the grammar (cf. mariozaizar/language-eml#15). @wesinator Do you know another grammar we could use?

@wesinator
Copy link
Contributor Author

@pchaigno could revert back to https://github.com/mariozaizar/eml-tmLanguage (8c539e9), but that might have the same issue.

@pchaigno
Copy link
Contributor

@wesinator Did you test it with Lightshow?

@wesinator
Copy link
Contributor Author

@pchaigno I just did - it does not have issue mariozaizar/language-eml#15, but it also does not have the HTML highlighting feature that language-eml does.

@pchaigno
Copy link
Contributor

You might want to post that information in mariozaizar/language-eml#15 to help others debug the issue.

@Alhadis
Copy link
Collaborator

Alhadis commented Sep 25, 2018

The issue with the include has been fixed in mariozaizar/language-eml#16, along with an arseload of other improvements. The HTML grammar we're using will either need fixing upstream, or being replaced with Atom's grammar.

See my response in @pchaigno's issue for details.

@pchaigno
Copy link
Contributor

pchaigno commented Oct 1, 2018

@wesinator Could you update your branch with the latest version of the grammar?

@pchaigno
Copy link
Contributor

pchaigno commented Oct 1, 2018

@lildude Do you know how to fix the following error?

cached license data out of date

@wesinator
Copy link
Contributor Author

@pchaigno I ran ./script/licensed cache

@pchaigno
Copy link
Contributor

pchaigno commented Oct 1, 2018

@wesinator Looks like you know more about Linguist than I do 😄

All good then!

pchaigno
pchaigno previously approved these changes Oct 1, 2018
@wesinator
Copy link
Contributor Author

I had to look at https://github.com/github/licensed#usage

It did seem to duplicate the license text

@pchaigno pchaigno dismissed their stale review October 1, 2018 16:36

Missed an error

@pchaigno
Copy link
Contributor

pchaigno commented Oct 1, 2018

Oh right, I missed that.
@lildude Should we just remove the second license text manually?

@lildude
Copy link
Member

lildude commented Oct 1, 2018

@lildude Should we just remove the second license text manually?

I believe this is caused by running an old version of Licensed or Licensee. Running bundle update, deleting the license file and then script/licensed again should sort it out.

@lildude
Copy link
Member

lildude commented Oct 1, 2018

(you might need to merge master into your fork too)

@pchaigno pchaigno requested a review from lildude October 4, 2018 16:49
@lildude lildude merged commit 878b30f into github-linguist:master Oct 5, 2018
@wesinator wesinator deleted the eml branch December 27, 2018 20:06
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

4 participants