diff --git a/emacs/init.org b/emacs/init.org index c6c725f..df9f9a8 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -1527,8 +1527,11 @@ A command to format JS via prettier: (defun prettier () (interactive) (let ((start (if (use-region-p) (region-beginning) (point-min))) - (end (if (use-region-p) (region-end) (point-max)))) - (shell-command-on-region start end "prettier --parser babel" nil t))) + (end (if (use-region-p) (region-end) (point-max))) + (parser (cond + ((eq major-mode 'graphql-mode) "graphql") + (t "babel")))) + (shell-command-on-region start end (concat "prettier --parser " parser) nil t))) #+END_SRC * LSP Mode