From a65b7177113497fced71eb3abb84fc2ce9066070 Mon Sep 17 00:00:00 2001 From: Tim McCarthy Date: Wed, 11 Sep 2024 12:15:18 -0700 Subject: [PATCH] Don't apply whitespace cleanup to .tsv files --- thoom-emacs/modules/thoom-tweaks.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/thoom-emacs/modules/thoom-tweaks.el b/thoom-emacs/modules/thoom-tweaks.el index 9c63444..174fa5e 100644 --- a/thoom-emacs/modules/thoom-tweaks.el +++ b/thoom-emacs/modules/thoom-tweaks.el @@ -62,7 +62,13 @@ (setq-default tab-width 4) (setq-default sentence-end-double-space nil) ;; automatically cleanup whitespace on save -(add-hook 'before-save-hook 'whitespace-cleanup) +(defun my-whitespace-cleanup () + "Run `whitespace-cleanup' except for TSV files." + (unless (or (derived-mode-p 'text-mode) ; Adjust this check if necessary + (string-match "\\.tsv\\'" buffer-file-name)) + (whitespace-cleanup))) + +(add-hook 'before-save-hook 'my-whitespace-cleanup) ;; clean up backup file spam (setq backup-directory-alist `(("." . "~/.saves"))