[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] scratch/editorconfig-cc 642ff1b62f 215/351: Use ws-butler when
From: |
Stefan Monnier |
Subject: |
[nongnu] scratch/editorconfig-cc 642ff1b62f 215/351: Use ws-butler when enabled and available. |
Date: |
Thu, 13 Jun 2024 18:38:54 -0400 (EDT) |
branch: scratch/editorconfig-cc
commit 642ff1b62f5ad4cbf78cdf7dcd5759149882dd21
Author: Terje Larsen <terlar@gmail.com>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
Use ws-butler when enabled and available.
When having auto-save on and you edit text the cleaning up of
white-space is a bit intrusive and removes the space at the end of the
line where you are writing. `ws-butler-mode` is an alternative that does
take this into account.
---
editorconfig.el | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/editorconfig.el b/editorconfig.el
index 857e34e92a..a9af423aa4 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -248,6 +248,11 @@ properties."
:type '(repeat string)
:group 'editorconfig)
+(defcustom editorconfig-use-ws-butler nil
+ "Use command `ws-butler-mode' for trimming trailing whitespace."
+ :type 'boolean
+ :group 'editorconfig)
+
(defvar editorconfig-properties-hash nil
"Hash object of EditorConfig properties for current buffer.
Set by `editorconfig-apply' and nil if that is not invoked in
@@ -273,6 +278,11 @@ number - `lisp-indent-offset' is not set only if
indent_size is
(and (stringp string)
(string-match-p "\\`[0-9]+\\'" string)))
+(defun editorconfig-use-ws-butler-p ()
+ "Return non-nil if `editorconfig-use-ws-butler' is enabled and
+`ws-butler' is available."
+ (and editorconfig-use-ws-butler (fboundp 'ws-butler-mode)))
+
(defun editorconfig-set-indentation/python-mode (size)
"Set `python-mode' indent size to SIZE."
)
@@ -322,6 +332,14 @@ number - `lisp-indent-offset' is not set only if
indent_size is
eol)
nil t))))
+(defun editorconfig-set-trailing-ws (trim-trailing-ws)
+ (if (editorconfig-use-ws-butler-p)
+ (ws-butler-mode 1)
+ ...)
+ (if (editorconfig-use-ws-butler-p)
+ (ws-butler-mode 0)
+ ...))
+
(defun editorconfig-set-line-length (length)
"Set the max line length (`fill-column') to LENGTH."
(when (and (editorconfig-string-integer-p length)
- [nongnu] scratch/editorconfig-cc 508e854392 107/351: Trivial commentary fix, (continued)
- [nongnu] scratch/editorconfig-cc 508e854392 107/351: Trivial commentary fix, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 49421bc1a4 123/351: Add one space to editorconfig-mode lighter text, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc f0abc53ff0 157/351: Fix fnmatch for new cases, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc e867da296c 124/351: Reindent using Emacs-lisp style., Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc d8742edc38 168/351: Fix make doc command, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc ccfd1910f4 171/351: Remove unused variable, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc efffe74bbf 166/351: Remove doc/.gitignore, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 706ac40ec2 193/351: Make `fixtures' a constant (#176), Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 4b3784445a 180/351: Add trim-trailing-ws tests, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc b6d0bb7757 201/351: Do not call major-mode when already enabled (#178), Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 642ff1b62f 215/351: Use ws-butler when enabled and available.,
Stefan Monnier <=
- [nongnu] scratch/editorconfig-cc 9fdc9cc689 218/351: Add variable editorconfig-trim-whitespaces-mode, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 96123213ed 229/351: Add support for Emacs24.5, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc de83e09632 243/351: Update docstring, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 4beeb9c830 253/351: Make editorconfig-properties-hash permanetn-local, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc ee5b70f1e2 068/351: editorocnfig-core: Throw error when parsing .editorconfig failed, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 3bdd68d5af 069/351: Add tcl-mode indentation support, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 32fb0d6b9c 056/351: Use `require` instead of `load` in usage example, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 903e483a70 052/351: Make `editorconfig-apply' an interactive command, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 4fd932bb7c 060/351: Check package metadata using ert framework, Stefan Monnier, 2024/06/13
- [nongnu] scratch/editorconfig-cc 56722d34df 019/351: Add sh-indentation to the list of indent variable., Stefan Monnier, 2024/06/13