Giter VIP home page Giter VIP logo

Comments (11)

ian-kelling avatar ian-kelling commented on July 23, 2024 4

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.

fniessen avatar fniessen commented on July 23, 2024 1

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.

arybczak avatar arybczak commented on July 23, 2024 1

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.

Deewiant avatar Deewiant commented on July 23, 2024

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.

fniessen avatar fniessen commented on July 23, 2024

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.

lewang avatar lewang commented on July 23, 2024

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.

ambihelical avatar ambihelical commented on July 23, 2024

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.

fniessen avatar fniessen commented on July 23, 2024

@ian-kelling This works perfectly. Thanks!

from ws-butler.

npostavs avatar npostavs commented on July 23, 2024

Why not just add a .dir-locals.el file which sets indent-tabs-mode appropriately?

from ws-butler.

ambihelical avatar ambihelical commented on July 23, 2024

@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.

ian-kelling avatar ian-kelling commented on July 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.