Skip to content

Python syntax highlighting #124

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

Open
johnjmolina opened this issue Aug 4, 2022 · 8 comments
Open

Python syntax highlighting #124

johnjmolina opened this issue Aug 4, 2022 · 8 comments

Comments

@johnjmolina
Copy link

Hello!

Thanks for the great emacs theme.

I've been using nano-emacs for most of my writing, but I can't seem to get the syntax highlighting to work on python files (lisp, c/c++ are OK). Whenever I open a python file (python-mode) only strings are highlighted, not any of the keywords.
Is this expected behavior?

python

@rougier
Copy link
Owner

rougier commented Aug 8, 2022

This is what I get using nano-theme that is available on ELPA:

Screenshot 2022-08-08 at 19 55 11

@johnjmolina
Copy link
Author

Thanks!
I installed it using straight.el, but other than that I'm not really sure where the difference might be.
I'll post the issue/fix if I manage to find and solve it.

@rougier
Copy link
Owner

rougier commented Aug 12, 2022

The nano-theme package has a lot of face definitions that are not present in nano-emacs.

@Judafa
Copy link

Judafa commented Mar 20, 2025

Thanks for this amazing package!

I just discovered it yesterday and really happy with it. I met the same issue as @johnjmolina, which becomes problematic for coding tasks.
Here is a python screenshot

Image

and a latex one

Image

The packages and environments are not highlighted.
You mentioned that the nano-theme package has adequate highlightings, but I could not make it work with nano. Do you know a way to have proper code highlighting in nano? that would make it complete for usage!

@rougier
Copy link
Owner

rougier commented Mar 21, 2025

@johnjmolina Thanks for the report. Is it with nano-emacs or nano-theme?

@Judafa
Copy link

Judafa commented Mar 21, 2025

Thanks for the quick response! the problem is with nano-emacs

@rougier
Copy link
Owner

rougier commented Mar 21, 2025

You should try with nano-theme that has a wider coverage of faces but the italic face is still not italic (design choice). But it should work if you modify it yourself.

@Judafa
Copy link

Judafa commented Mar 21, 2025

I could make it work with a call to nano-mode inside the nano-theme package.
There are import issues (emacs doesnt know what nano-mode is although I installed nano-theme), here is a quick dirty fix that just hard-code eval the required buffers, for future references (assuming the packages installed by straight or in /straight):

(use-package nano
  :straight (:type git :host github :repo "rougier/nano-emacs")
  :init
  (require 'nano)
  (nano-theme-set-light)

  (setq nano-font-size 13)
  (require 'nano)
  (require 'nano-base-colors)
  (require 'nano-faces)
  (with-current-buffer
      (find-file-noselect (concat user-emacs-directory "straight/repos/nano-emacs/nano-modeline.el"))
    (eval-buffer)
    )
  ;; (require 'nano-mu4e)
  (nano-refresh-theme)

  (setq pop-up-windows t)
  )

(use-package nano-theme
  :straight t
  )
(with-current-buffer
    (find-file-noselect (concat user-emacs-directory "straight/repos/nano-theme/nano-theme-support.el"))
  (eval-buffer)
    )
(nano-mode)

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

No branches or pull requests

3 participants