dwcoates / pygn-mode

An Emacs major-mode for chess PGN files, powered by Python
BSD 2-Clause "Simplified" License
10 stars 3 forks source link

Syntax highlighting does not work #211

Closed gszasz closed 1 year ago

gszasz commented 1 year ago

The pygn-mode works in my setup but does not provide any syntax highlighting when I edit PGN files. This is not a regression, I have been using pygn-mode for three years, and the syntax highlighting has never worked for me.

Emacs version:

Package versions (MELPA):

The configuration provided by ~/.emacs.d/init.el

;; PyGN mode
(use-package pygn-mode
  :ensure t
  :bind (:map pygn-mode-map
              ("C-c C-n" . pygn-mode-next-game)
              ("C-c C-p" . pygn-mode-previous-game)
              ("M-f" . pygn-mode-next-move-follow-board)
              ("M-b" . pygn-mode-previous-move-follow-board)
              ("C-c SPC". pygn-mode-display-gui-board-at-pos)
              ("C-h $" . pygn-mode-describe-annotation-at-pos))
  :hook (pygn-mode . visual-line-mode)
  :custom
  ;; pygn-mode-pythonpath is not automatically updated after pygn-mode
  ;; package update.  To workaround this issue I set the variable
  ;; here.
  (pygn-mode-pythonpath
   (concat (getenv "HOME")
           "/.emacs.d/elpa/pygn-mode-"
           (mapconcat 'number-to-string
                      (pkg-info-package-version 'pygn-mode) ".")
           "/lib/python/site-packages/")))

Output of the pygn-mode-run-diagnostic command:

[x] Good. We can execute the pygn-mode-python-executable at 'python'

[x] Good. The pygn-mode-python-executable at 'python' is a Python 3 interpreter.

[x] Good. The pygn-mode-python-executable at 'python' is better than or equal to Python version 3.7.

[x] Good. The pygn-mode-python-executable at 'python' can import the Python chess library.

[x] Good. The pygn-mode-script-directory ('/home/gszasz/.emacs.d/elpa/pygn-mode-20230606.42/') is found and the server script is callable.

[x] Good.  The `uci-mode' library is available.

[x] Good.  The `nav-flash' library is available.

[x] Good.  The `ivy' library is available.

------------------------------------

All pygn-mode required diagnostics completed successfully.
dekrueger commented 1 year ago

You can try adding font-lock-fontify-buffer to your pygn-mode hook.

I can't locate the source of this suggestion, but it works for me.

gszasz commented 1 year ago

@dekrueger Thanks a lot. Your suggestion worked for me.