lewang / ws-butler

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

ws-butler adds a whole string of spaces at the end of file. #49

Open artelse opened 1 year ago

artelse commented 1 year ago

When I save a file ws-butler adds a string of spaces at the end of the file. In the screenshot one can see 65 spaces were added. (Note that whitespace-mode disrupts the table layout.) Is there a way to prevent this from happening? I see it is not saved as it is added after, but still is a bit inconvenient on continued editing.

Screenshot-2023-05-07-11:36:11

phil-s commented 1 year ago

I suggest providing a recipe with example text (not a screenshot) to reproduce the issue.

artelse commented 1 year ago

Here is my configuration and following my test file. Please note the series of spaces just above T=Top. Now put the point at the end of the file and save. A series of spaces are added at the end. Hope this is clear and reproducible.

#+begin_src emacs-lisp
  (use-package ws-butler
    :hook ((text-mode . ws-butler-mode)
           (prog-mode . ws-butler-mode)))
#+end_src
:PROPERTIES:
:ID:       20230507T013227
:END:
#+date: [2023-05-07 Sun 01:32]
#+title: seven-segment-neon
#+filetags: :electronic:project:

Seven-segment neon display as found at radio market in Ermelo.

| # | a   | b   | c   | d   | e   | f   | g   | h    | DOT | R   |
|---+-----+-----+-----+-----+-----+-----+-----+------+-----+-----|
| 1 | T16 | B11 | T4  | T9  | T10 | B7  | T3  |      | B20 |     |
| 2 | T15 | T23 | B27 | B25 | B24 | T22 | B28 |      | B21 | 30K |
| 3 | T16 | B11 | T4  | T9  | T10 | B7  | T3  |      | T18 |     |
| 4 | T15 | T23 | B27 | B25 | B24 | T22 | B28 |      | T17 | 30k |
| 5 | T16 | B11 | T4  | T9  | T10 | B7  | T3  |      | T8  |     |
| 6 | T15 | T23 | B27 | B25 | B24 | T22 | B28 | T5-6 | B14 | 30K |
| 7 | T16 | B11 | T4  | T9  | T10 | B7  | T3  |      |     |     |
| 8 | T15 | T23 | B27 | B25 | B24 | T22 | B28 |      |     |     |

T=Top
B=Bottom  
phil-s commented 1 year ago

I can't reproduce that. I am using Emacs 28.2. I copied your text from :PROPERTIES: down to B=Bottom into a file named foo.org (complete with the trailing whitespace above T=Top), visited the file in org-mode, enabled ws-butler (manually at first, but also tested using the hook), moved point to the end, and saved the file (I made a change and deleted it again so that I could save). No spaces were added at the end of the buffer.

GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw scroll bars) of 2023-04-28 org-version: 9.5.5 ws-butler.el version 0.6