[Emacs] treesit-auto copy hooks WIP
This commit is contained in:
parent
ad28f370c3
commit
a37287524c
@ -1576,15 +1576,26 @@ out how to detect that a buffer is a man mode buffer.
|
|||||||
(setq treesit-auto-install t)
|
(setq treesit-auto-install t)
|
||||||
(global-treesit-auto-mode +1)
|
(global-treesit-auto-mode +1)
|
||||||
|
|
||||||
(defun treesit-auto-for-each (fn)
|
(defun treesit-auto-for-each (fn)
|
||||||
(cl-loop for recipe in treesit-auto-recipe-list
|
(cl-loop for recipe in treesit-auto-recipe-list
|
||||||
do
|
do
|
||||||
(let ((from (treesit-auto-recipe-remap recipe))
|
(let ((from (treesit-auto-recipe-remap recipe))
|
||||||
(to (treesit-auto-recipe-ts-mode recipe)))
|
(to (treesit-auto-recipe-ts-mode recipe)))
|
||||||
(funcall fn from to))))
|
(funcall fn from to))))
|
||||||
|
|
||||||
(defun treesit-auto-get-mode-hook-symbol (mode)
|
;; (treesit-auto-for-each
|
||||||
(intern (concat (symbol-name mode) "-mode-hook")))
|
;; (lambda (from to)
|
||||||
|
;; (letrec ((to-hook (treesit-auto-get-mode-hook-symbol to))
|
||||||
|
;; (from-hook (treesit-auto-get-mode-hook-symbol from))
|
||||||
|
;; (set-exp (list 'setq to-hook from-hook)))
|
||||||
|
;; (message (format "%s" set-exp))
|
||||||
|
;; (when (boundp from-hook)
|
||||||
|
;; (eval result)))))
|
||||||
|
|
||||||
|
(defun treesit-auto-get-mode-hook-symbol (mode)
|
||||||
|
(intern (concat (symbol-name mode) "-hook")))
|
||||||
|
|
||||||
|
(treesit-auto-get-mode-hook-symbol 'python-mode)
|
||||||
|
|
||||||
(defun treesit-auto-copy-all-lsp-languages ()
|
(defun treesit-auto-copy-all-lsp-languages ()
|
||||||
(cl-loop for recipe in treesit-auto-recipe-list
|
(cl-loop for recipe in treesit-auto-recipe-list
|
||||||
@ -1603,10 +1614,10 @@ out how to detect that a buffer is a man mode buffer.
|
|||||||
(defun treesit-auto-copy-lsp-client-languages (from to)
|
(defun treesit-auto-copy-lsp-client-languages (from to)
|
||||||
(cl-loop for client in (hash-table-values lsp-clients)
|
(cl-loop for client in (hash-table-values lsp-clients)
|
||||||
do
|
do
|
||||||
(let ((major-modes (lsp--client-major-modes client)))
|
(let ((major-modes (lsp--client-major-modes client)))
|
||||||
(when (memq from major-modes)
|
(when (memq from major-modes)
|
||||||
(setf (lsp--client-major-modes client)
|
(setf (lsp--client-major-modes client)
|
||||||
(append major-modes (list to)))))))
|
(append major-modes (list to)))))))
|
||||||
|
|
||||||
(use-package lsp-mode
|
(use-package lsp-mode
|
||||||
:config
|
:config
|
||||||
|
Loading…
Reference in New Issue
Block a user