lewang / ws-butler

Unobtrusively trim extraneous white-space *ONLY* in lines edited.
248 stars 29 forks source link

How to use ws-butler-global-exempt-modes ? #50

Closed jman-schief closed 1 month ago

jman-schief commented 1 month ago

Hi,

I installed ws-butler from melpa (version 20201117.1528) and configured like this:

(use-package ws-butler
  :config (add-to-list 'ws-butler-global-exempt-modes 'org-mode)
  :hook ((text-mode . ws-butler-mode)
         (prog-mode . ws-butler-mode)))

The value of ws-butler-global-exempt-modes is now (org-mode markdown-mode).

Then I restart Emacs (currently using 29.4) and open a .org file. In the modeline I see "wb" which IIUC is indicating that ws-butler is enabled. after editing the file I see whitespace being removed. I don't have other major- or minor- modes interfering with whitespaces.

Is there anything I am missing on how to configure this package?

thanks

phil-s commented 1 month ago

ws-butler-global-exempt-modes is a user option for ws-butler-global-mode, which you are not using.

You're simply enabling ws-butler-mode in every text-mode derivative, which includes org-mode.

You can always define your own my-enable-ws-butler-mode-maybe function to (unless (derived-mode-p 'org-mode) (ws-butler-mode 1)) and add that function to the hooks instead.

jman-schief commented 1 month ago

understood, thanks :)