all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 58755@debbugs.gnu.org
Subject: bug#58755: 29.0.50; Font locking not enabling for ts-mode
Date: Mon, 24 Oct 2022 08:43:29 +0200	[thread overview]
Message-ID: <87czah3eni.fsf@thornhill.no> (raw)

[-- 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


             reply	other threads:[~2022-10-24  6:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-24  6:43 Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-10-24  7:15 ` bug#58755: 29.0.50; Font locking not enabling for ts-mode 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87czah3eni.fsf@thornhill.no \
    --to=bug-gnu-emacs@gnu.org \
    --cc=58755@debbugs.gnu.org \
    --cc=theo@thornhill.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.