Compare commits

..

No commits in common. "a28f84ae1e34475898fd2f34e871b6483a7437f3" and "2c7518fa760d6b1f2d7345a699ec427e193f29e1" have entirely different histories.

3 changed files with 34 additions and 46 deletions

View File

@ -36,13 +36,7 @@
(goto-char mb) (goto-char mb)
(sp--looking-back-p "=" 1)))) (sp--looking-back-p "=" 1))))
(defun sp-web-mode-is-code-context (id action context)
(and (eq action 'insert)
(not (or (get-text-property (point) 'part-side)
(get-text-property (point) 'block-side)))))
(sp-local-pair '(web-mode) "<" nil (sp-local-pair '(web-mode) "<" nil
:when '(sp-web-mode-is-code-context)
:unless '(:add sp-after-equals-p) :unless '(:add sp-after-equals-p)
:skip-match 'sp-after-equals-skip-p) :skip-match 'sp-after-equals-skip-p)
:hook :hook

View File

@ -8,22 +8,6 @@
(defvar-local run-command-project-local-commands nil) (defvar-local run-command-project-local-commands nil)
(put 'run-command-project-local-commands 'safe-local-variable (lambda (_) t)) (put 'run-command-project-local-commands 'safe-local-variable (lambda (_) t))
:config :config
;; Add ability to edit command line with prefix arg
(defvar run-command-edit? nil)
(defun run-command-core-run-advice (orig-fun command-spec &rest args)
(let ((spec (if run-command-edit?
(plist-put command-spec :command-line (read-string "Command: " (plist-get command-spec :command-line)))
command-spec)))
(apply orig-fun spec args)))
(defun run-command-advice (orig-fun &rest args)
(let ((run-command-edit? (not (null current-prefix-arg))))
(apply orig-fun args)))
(advice-add 'run-command :around #'run-command-advice)
(advice-add 'run-command-core-run :around #'run-command-core-run-advice)
(defun run-command-recipe-terraform () (defun run-command-recipe-terraform ()
(when (directory-files default-directory (when (directory-files default-directory
nil nil
@ -401,8 +385,7 @@
(defun run-command-recipe-rspec () (defun run-command-recipe-rspec ()
(when (when
(and (or (derived-mode-p 'ruby-mode) (and (derived-mode-p 'ruby-mode)
(derived-mode-p 'ruby-ts-mode))
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))
(re-search-forward "RSpec" nil t))) (re-search-forward "RSpec" nil t)))

View File

@ -26,31 +26,42 @@
(dolist (lang (mapcar #'car treesit-language-source-alist)) (dolist (lang (mapcar #'car treesit-language-source-alist))
(treesit-install-language-grammar lang))) (treesit-install-language-grammar lang)))
(defvar treesit-langs-mode-overrides '((sh-mode . bash) (defvar treesit-langs-by-mode '((sh-mode . bash)
(sh-ts-mode . bash) (sh-ts-mode . bash)
(css-mode . css) (cmake-mode . cmake)
(emacs-lisp-mode . elisp) (cmake-ts-mode . cmake)
(emacs-lisp-ts-mode . elisp) (css-mode . css)
(js-mode . javascript) (css-ts-mode . css)
(js-ts-mode . javascript) (emacs-lisp-mode . elisp)
(json-mode . json) (emacs-lisp-ts-mode . elisp)
(makefile-mode . make) (go-mode . go)
(makefile-ts-mode . make))) (go-ts-mode . go)
(html-mode . html)
(html-ts-mode . html)
(js-mode . javascript)
(js-ts-mode . javascript)
(json-mode . json)
(json-ts-mode . json)
(makefile-mode . make)
(makefile-ts-mode . make)
(markdown-mode . markdown)
(markdown-ts-mode . markdown)
(python-mode . python)
(python-ts-mode . python)
(ruby-mode . ruby)
(ruby-ts-mode . ruby)
(toml-mode . toml)
(toml-ts-mode . toml)
(typescript-mode . typescript)
(typescript-ts-mode . typescript)
(yaml-mode . yaml)
(yaml-ts-mode . yaml)
(astro-mode . astro)
(astro-ts-mode . astro)))
(defun treesit-parse-lang-from-mode (mode)
(let* ((mode (if (symbolp mode) (symbol-name mode) mode))
(lang (save-match-data
(string-match "\\(.*?\\)\\(-ts\\)?-mode" mode)
(match-string 1 mode))))
(intern lang)))
(defun treesit-lang-for-mode (mode)
(or (cdr (assoc mode treesit-langs-mode-overrides))
(treesit-parse-lang-from-mode mode)
(error "Unable to determine tree-sitter parser for %s" mode)))
(defun treesit-parser () (defun treesit-parser ()
(if-let ((lang (treesit-lang-for-mode major-mode))) (if-let ((lang (cdr (assoc major-mode treesit-langs-by-mode))))
(treesit-parser-create lang (current-buffer)) (treesit-parser-create lang (current-buffer))
(user-error "No tree-sitter parser for %s" major-mode))) (user-error "No tree-sitter parser for %s" major-mode)))