all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#58755: 29.0.50; Font locking not enabling for ts-mode
@ 2022-10-24  6:43 Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-10-24  7:15 ` Yuan Fu
  0 siblings, 1 reply; 4+ messages in thread
From: Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-10-24  6:43 UTC (permalink / raw)
  To: 58755

[-- Attachment #1: Type: text/plain, Size: 267 bytes --]

Hi Yuan!

It seems we cannot really enable font-lock without setting the
font-lock-defaults to some non-nil value.

I'm not really sure why the 'treesit-font-lock-enable' isn't sufficient,
but here's a patch that at least makes ts-mode usable again :)

Thanks,
Theo


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-in-check-for-font-lock-defaults.patch --]
[-- Type: text/x-diff, Size: 988 bytes --]

From 23d172e17330e5c5d3403fdfacddedfbc91f5b90 Mon Sep 17 00:00:00 2001
From: Theodor Thornhill <theo@thornhill.no>
Date: Mon, 24 Oct 2022 08:35:05 +0200
Subject: [PATCH] Add in check for font-lock-defaults

* lisp/progmodes/ts-mode.el (ts-mode): It seems font-lock-defaults has
to be set in order for font-locking to work.  Add in a guard so that
ts-mode can font-lock.
---
 lisp/progmodes/ts-mode.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/progmodes/ts-mode.el b/lisp/progmodes/ts-mode.el
index c23f2bec05..11e5677e28 100644
--- a/lisp/progmodes/ts-mode.el
+++ b/lisp/progmodes/ts-mode.el
@@ -276,6 +276,8 @@ ts-mode
                       "function_declaration"
                       "lexical_declaration")))
   ;; Font-lock.
+  (unless font-lock-defaults
+    (setq-local font-lock-defaults '(nil t)))
   (setq-local treesit-font-lock-settings ts-mode--font-lock-settings)
   (setq-local treesit-font-lock-feature-list '((minimal) (moderate) (full)))
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-24 20:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-24  6:43 bug#58755: 29.0.50; Font locking not enabling for ts-mode Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-24  7:15 ` Yuan Fu
2022-10-24  7:29   ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-24 20:16     ` Yuan Fu

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.