From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Steinar Bang Newsgroups: gmane.emacs.help Subject: Need assistance in figuring out what reformats my code on save Date: Sun, 05 Sep 2021 13:10:52 +0200 Message-ID: <86wnnvl1kz.fsf@dod.no> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4638"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (windows-nt) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 05 13:11:59 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mMq44-00010a-2t for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 05 Sep 2021 13:11:56 +0200 Original-Received: from localhost ([::1]:46680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMq43-0004iy-10 for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 05 Sep 2021 07:11:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54524) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMq3N-0004f0-6u for help-gnu-emacs@gnu.org; Sun, 05 Sep 2021 07:11:14 -0400 Original-Received: from cadalora.default.sbang.uk0.bigv.io ([2001:41c9:1:424::90]:39908) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMq3L-0002Ei-8q for help-gnu-emacs@gnu.org; Sun, 05 Sep 2021 07:11:12 -0400 Original-Received: from mccoy (unknown [84.210.87.211]) by cadalora.default.sbang.uk0.bigv.io (Postfix) with ESMTPSA id 02D74CD3BD for ; Sun, 5 Sep 2021 12:10:53 +0100 (BST) Received-SPF: none client-ip=2001:41c9:1:424::90; envelope-from=sb@dod.no; helo=cadalora.default.sbang.uk0.bigv.io X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:132894 Archived-At: 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))