Comments (11)
Don't have the time right now to make this conditional, add an option and a pull request. Until someone does, they can add this to their init file to remove all tab/space indent conversion.
(defun ws-butler-clean-region (beg end)
"Delete trailing blanks in region BEG END."
(interactive "*r")
(ws-butler-with-save
(narrow-to-region beg end)
;; _much slower would be: (replace-regexp "[ \t]+$" "")
(goto-char (point-min))
(while (not (eobp))
(end-of-line)
(delete-horizontal-space)
(forward-line 1)))
;; clean return code for hooks
nil)
from ws-butler.
I think this would be enough, yes, if it allows me to insert tabs (to follow the local conventions) and does not remove them.
Thanks in advance!
from ws-butler.
Thanks for this. I would personally consider not touching indentation as a sane default, as doing a covert conversion seems to conflict with the theme of the package (an unobtrusive way to trim spaces from end of line).
from ws-butler.
I used to work around this by overriding ws-butler-clean-region
with one where I locally set indent-tabs-mode
to t
to prevent it from touching indentation, but after #17 this instead causes spaces to be replaced with tabs, so that's unfortunately no longer an option.
from ws-butler.
Thanks for the follow-up. Hopefully, this will be fixed appropriately, at some point.
Right now, I've been forced to disable ws-butler, but I miss it a lot.
from ws-butler.
Would adding a ws-butler-fix-indentation
customization be enough?
Are there cases where you do want to fix indentation but want to be able to override indent-tabs-mode
with something ws-butler specific?
from ws-butler.
This behaviour also interferes with smart-tabs-mode (where indent-tabs-mode must be t). ws-butler dutifully replaces all of the non-indentation spaces smart-tabs-mode has inserted with tabs. So the option to disable it would make this case work correctly, I think.
from ws-butler.
@ian-kelling This works perfectly. Thanks!
from ws-butler.
Why not just add a .dir-locals.el file which sets indent-tabs-mode
appropriately?
from ws-butler.
@npostavs This wouldn't work with smart-tabs-mode at all. Ws-butler is currently completely incompatible with it. It used to work well.
from ws-butler.
This issue is fixed by my pull request #28. You can also fix it using my comment above in the meantime.
from ws-butler.
Related Issues (20)
- ws-butler does not work with Emacs daemon HOT 6
- Include ws-butler in Emacs HOT 1
- ws-butler with desktop-save-mode and emacs --daemon HOT 3
- Incompatible with Magit HOT 2
- ws-butler does trims whitespace on current line during deft auto-save HOT 2
- Sharp-quote all functions
- Please tag a new release HOT 1
- In a markdown file, the trailling two whitespaces is meaningful HOT 7
- Is there a way to not remove whitespace at the end of file? HOT 9
- ws-butler fails with fci-mode enabled HOT 1
- Use cl-lib, not cl
- Don't propertize minibuffer input HOT 8
- Undo data corrupted HOT 2
- Compilation warnings with ws-butler 0.6
- org-element-cache warning when saving with ws-butler-keep-whitespace-before-point HOT 2
- white space before point trimmed in non focused buffer
- Feature request: trim at line change HOT 2
- ws-butler-global-exempt-modes doesn't quite work HOT 2
- ws-butler adds a whole string of spaces at the end of file. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ws-butler.