all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Need assistance in figuring out what reformats my code on save
@ 2021-09-05 11:10 Steinar Bang
  2021-09-05 18:43 ` Tassilo Horn
  0 siblings, 1 reply; 3+ messages in thread
From: Steinar Bang @ 2021-09-05 11:10 UTC (permalink / raw)
  To: help-gnu-emacs

I am trying to remove the configuration that causes web-mode to reformat
my code when saving, because the formatting breaks in the eslint build
step (because eslint prettier and web-mode disagrees).

I have tried to remove the code which looked like it was doing the
formatting, ie.
  (add-hook 'before-save-hook 'tide-format-before-save)

But even after removing this, and with before-save-hook having the value
nil, reformatting takes place on save.

The reformatting I get are changes to indentation, and are the same
changes I get, when I press TAB on the changed lines.

Are there any other hooks that could be involved?
Is there reformatting on save that don't use hooks?
(I'm assuming it is something in my config but I haven't been able to
determine what)

Thanks!


- Steinar

More detail here: https://github.com/ananthakumaran/tide/discussions/434
Emacs version is 27.1 on mac OS/X.

The web-mode/tide configuration in my .emacs, is:
(when (locate-library "web-mode")
  (defun setup-tide-mode ()
    (interactive)
    (tide-setup)
    (flycheck-mode +1)
    (setq flycheck-check-syntax-automatically '(save mode-enabled))
    (eldoc-mode +1)
    (tide-hl-identifier-mode +1)
    (company-mode +1))

  (setq company-tooltip-align-annotations t)

  ;; formats the buffer before saving
  (add-hook 'before-save-hook 'tide-format-before-save)

  (add-hook 'typescript-mode-hook #'setup-tide-mode)

  (require 'web-mode)
  (add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode))
  (add-hook 'web-mode-hook
            (lambda ()
              (when (string-equal "tsx" (file-name-extension buffer-file-name))
                (setup-tide-mode))))
  (flycheck-add-mode 'typescript-tslint 'web-mode))



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-06 14:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-05 11:10 Need assistance in figuring out what reformats my code on save Steinar Bang
2021-09-05 18:43 ` Tassilo Horn
2021-09-06 14:26   ` Steinar Bang

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.