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

Implement highlighting of Emacs Lisp keywords #43

Closed
kaushalmodi opened this issue Sep 26, 2017 · 10 comments
Closed

Implement highlighting of Emacs Lisp keywords #43

kaushalmodi opened this issue Sep 26, 2017 · 10 comments

Comments

@kaushalmodi
Copy link
Contributor

Hello,

Can the emacs-lisp keywords also be ported from Pygments lexers/lisp.py?

Live example: https://scripter.co/building-org-development-version/#set-the-correct-paths-in-your-emacs-config

image

Here we see that keywords like defvar, with-eval-after-load, unless, .. do not get highlighted at all.

@kaushalmodi
Copy link
Contributor Author

kaushalmodi commented Sep 26, 2017

Here's a screenshot of how the syntax highlighting looks from within Emacs:

image

Also note the special highlighting of symbol in `..' within the docstrings and comments .. like `lispdir', `infodir'.

@alecthomas
Copy link
Owner

You'll need to use the same theme to compare.

@kaushalmodi
Copy link
Contributor Author

kaushalmodi commented Sep 26, 2017

Sorry, the two screenshots were not for theme comparison.. they were to show that:

  • The keywords like defvar, with-eval-after-load, etc. should be highlighted.
  • special highlighting of symbol in `..' within the docstrings and comments .. like `lispdir', `infodir'

Comparing emacs.go with lisp.py, I see that the whole section of keywords/identifiers/macros/builtins is not ported over.

@kaushalmodi
Copy link
Contributor Author

kaushalmodi commented Sep 26, 2017

From the site HTML, I see that the keywords, variable names, etc., all get classified as <span class="n"> .. </span>.

image

@alecthomas
Copy link
Owner

Okay. The converter script can only convert RegexLexers. It's likely that the lispish ones are slightly different and will need some manual intervention. I will get to this, but probably not for a few days. If you'd like to send a PR I'll happily merge it.

@alecthomas
Copy link
Owner

Yes, this is happening because of this function in Pygments. It will need to be ported.

alecthomas added a commit that referenced this issue Sep 27, 2017
This pattern is used heavily in Pygments for certain lexers,
particularly Lisp variants. See #43.
@alecthomas
Copy link
Owner

Okay, this seems to have worked. Here's your example code highlighted. Note that whether a particular element is highlighted also depends on the style used.

@alecthomas
Copy link
Owner

Note that I only converted EmacsLisp. The other lisps will need similar treatment.

@kaushalmodi
Copy link
Contributor Author

kaushalmodi commented Sep 27, 2017

Wow! Thank you for implementing this so quick, especially when you apparently don't use emacs-lisp. I'll rebuild Hugo with latest Chroma as soon as I get to my computer.

Apologies for not providing the raw emacs-lisp code for testing. So thank you for going the extra mile to parse the raw code out of that HTML, or finding out the markdown source. I'll make sure to link the source too, next time.

For now, emacs-lisp is the only Lisp I use. So I am content :)

Many thanks again! I'll try it out as soon as I can today, and report back.


Final nitpick: Can the emacs.go be renamed to emacs-lisp.go? If not that, then emacs_lisp.go or emacslisp.go? Thanks!

@kaushalmodi
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants