[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/eglot-inactive-regions 52d2f80ccb 28/66: Tentatively limit
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/eglot-inactive-regions 52d2f80ccb 28/66: Tentatively limit global fontification hook to classic c modes |
Date: |
Fri, 6 Dec 2024 06:59:54 -0500 (EST) |
branch: elpa/eglot-inactive-regions
commit 52d2f80ccb6c43598d21c6e2f80bb8014da2a853
Author: Filippo Argiolas <filippo.argiolas@gmail.com>
Commit: Filippo Argiolas <filippo.argiolas@gmail.com>
Tentatively limit global fontification hook to classic c modes
Advice default fontify-region hook only with c/c++ major modes, keep
it local otherwise. As far as I know only classic c modes extend
fontification region chaining the new region into the default
function.
Keep it buffer local for other modes (notably c/c++ ts modes).
Only disable the global advice if our minor mode is not active in any
classic c mode buffer.
Still way to hacky for my taste...
---
clangd-inactive-regions.el | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/clangd-inactive-regions.el b/clangd-inactive-regions.el
index 1a99ce010f..134caf7a38 100644
--- a/clangd-inactive-regions.el
+++ b/clangd-inactive-regions.el
@@ -241,8 +241,11 @@ foreground colors, if the face doesn't exist yet create
it."
(clangd-inactive-regions--disable))))
(defun clangd-inactive-regions--enable ()
- (add-function :after (default-value 'font-lock-fontify-region-function)
- #'clangd-inactive-regions--fontify)
+ (if (memq major-mode '(c-mode c++-mode))
+ (add-function :after (default-value 'font-lock-fontify-region-function)
+ #'clangd-inactive-regions--fontify)
+ (add-function :after (local 'font-lock-fontify-region-function)
+ #'clangd-inactive-regions--fontify))
(cl-defmethod eglot-client-capabilities :around (server)
(let ((base (cl-call-next-method)))
@@ -253,9 +256,22 @@ foreground colors, if the face doesn't exist yet create
it."
'(:inactiveRegions t)))
base)))
+(defun clangd-inactive-regions--enabled-anywhere ()
+ (let ((enabled nil))
+ (dolist (buffer (buffer-list))
+ (with-current-buffer buffer
+ (and (memq major-mode '(c-mode c++-mode))
+ (clangd-inactive-regions-mode)
+ (setq enabled t))))
+ enabled))
+
(defun clangd-inactive-regions--disable ()
- (remove-function (default-value 'font-lock-fontify-region-function)
- #'clangd-inactive-regions--fontify)
+ (if (memq major-mode '(c-mode c++-mode))
+ (unless (clangd-inactive-regions--enabled-anywhere)
+ (remove-function (default-value 'font-lock-fontify-region-function)
+ #'clangd-inactive-regions--fontify))
+ (remove-function (local 'font-lock-fontify-region-function)
+ #'clangd-inactive-regions--fontify))
(clangd-inactive-regions-cleanup)
(cl-defmethod eglot-client-capabilities :around (server)
(cl-call-next-method)))
- [nongnu] elpa/eglot-inactive-regions 4b01aba42f 29/66: Fix package-lint warnings, (continued)
- [nongnu] elpa/eglot-inactive-regions 4b01aba42f 29/66: Fix package-lint warnings, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 2346944d4b 05/66: Add clean up and refresh functions, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 3ba8e528f1 06/66: allow to change opacity on the fly, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 10f1772888 09/66: Drop eglot from the name, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 2736b46310 10/66: Update dependencies and some minor changes, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 15d6db2d6d 13/66: Add some helper methods to set UI options, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions ae67afac14 12/66: Use overlays instead of changing text properties, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 343abb100c 26/66: Update README.md, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions e25016ddb8 22/66: Do not flush all inactive regions, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions d021d96fef 25/66: Update screenshots, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 52d2f80ccb 28/66: Tentatively limit global fontification hook to classic c modes,
ELPA Syncer <=
- [nongnu] elpa/eglot-inactive-regions 4ae3491ae3 39/66: doc and function names cleanup, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 21c26bc4e2 40/66: use built-in color to hex converter, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 4b698aaeb8 42/66: always enable inactiveRegions caps, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 6ad3ce4337 47/66: experimental support for ccls skippedRanges, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions bdf568d9ff 63/66: suppress warnings for obsolete eglot functions, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 20cacf2b2d 16/66: Warn if shading method is unknown, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 879c5cf032 20/66: Advice default fontify region function instead of local one, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions a17388e4b4 30/66: Update docs and comments, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 8f341e9ad7 32/66: Minor cosmetics, ELPA Syncer, 2024/12/06
- [nongnu] elpa/eglot-inactive-regions 9f439654dc 27/66: Only run our fontification hook if our mode is enabled, ELPA Syncer, 2024/12/06