[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usa
From: |
Eli Zaretskii |
Subject: |
bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable |
Date: |
Mon, 09 Jan 2023 19:57:50 +0200 |
> From: Juri Linkov <juri@linkov.net>
> Cc: Eli Zaretskii <eliz@gnu.org>, sadiq@sadiqpk.org, 60176@debbugs.gnu.org
> Date: Mon, 09 Jan 2023 19:30:20 +0200
>
> Is it possible at least to make this forward-compatible to support
> such a predicate in future? To enable ts-modes only in some buffers
> currently requires first to enable non-ts-mode, then conditionally ts-mode:
>
> (add-hook 'find-file-hook
> (lambda ()
> (when (and (eq major-mode 'c-mode)
> ;; Unless in internal buffers:
> (not (string-prefix-p " " (buffer-name))))
> (c-ts-mode))))
>
> With a predicate in major-mode-remap-alist it would immediately
> enable the required mode:
>
> (setq major-mode-remap-alist
> '((c-mode . (lambda () (not (string-prefix-p " " (buffer-name))))
> c-ts-mode)))
Why do we need such hoops to jump through? I think we should simply
add
(add-to-list 'auto-mode-alist
'("\\.[ch]\\'" . c-ts-mode))
to c-ts-mode.el (and similarly for C++), and that's it.
- bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable, Juri Linkov, 2023/01/09
- bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable,
Eli Zaretskii <=
- bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable, Stefan Monnier, 2023/01/09
- bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable, Eli Zaretskii, 2023/01/10
- bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable, Stefan Monnier, 2023/01/10
- bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable, Juri Linkov, 2023/01/10
- bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable, Eli Zaretskii, 2023/01/10
- bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable, Juri Linkov, 2023/01/16
- bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable, Eli Zaretskii, 2023/01/16
- bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable, Juri Linkov, 2023/01/16
- bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable, Eli Zaretskii, 2023/01/16
- bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable, Juri Linkov, 2023/01/17