From: Steinar Bang <sb@dod.no>
To: help-gnu-emacs@gnu.org
Subject: Need assistance in figuring out what reformats my code on save
Date: Sun, 05 Sep 2021 13:10:52 +0200 [thread overview]
Message-ID: <86wnnvl1kz.fsf@dod.no> (raw)
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))
next reply other threads:[~2021-09-05 11:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-05 11:10 Steinar Bang [this message]
2021-09-05 18:43 ` Need assistance in figuring out what reformats my code on save Tassilo Horn
2021-09-06 14:26 ` Steinar Bang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86wnnvl1kz.fsf@dod.no \
--to=sb@dod.no \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).