[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/ws-butler 81143ac737 25/64: Add customization for virtual
From: |
Stefan Kangas |
Subject: |
[nongnu] elpa/ws-butler 81143ac737 25/64: Add customization for virtual space preservation. |
Date: |
Fri, 31 Dec 2021 11:09:29 -0500 (EST) |
branch: elpa/ws-butler
commit 81143ac7370ff14efd8e7dafa4cfc71094312cbc
Author: Le Wang <le.wang@agworld.com.au>
Commit: Le Wang <le.wang@agworld.com.au>
Add customization for virtual space preservation.
- #9
---
ws-butler.el | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/ws-butler.el b/ws-butler.el
index 5f0298c73f..76752970ba 100644
--- a/ws-butler.el
+++ b/ws-butler.el
@@ -55,6 +55,17 @@
(eval-when-compile (require 'cl))
+(defcustom ws-butler-keep-whitespace-before-point
+ "Keep whitespace at current point after save.
+
+This is particularly to preserve indentation.
+
+N.B. The spaces are removed in the file on disk. So in a sense
+only the \"virtual\" space is preserved in the buffer.
+"
+ t)
+
+
(defvar ws-butler-saved)
(defmacro ws-butler-with-save (&rest forms)
@@ -159,15 +170,16 @@ replaced by spaces.
(defun ws-butler-before-save ()
"Trim white space before save.
-This will also ensure point doesn't jump due to white space
-trimming. (i.e. keep whitespace after EOL text but before
-point."
+Setting `ws-butler-keep-whitespace-before-point' will also
+ensure point doesn't jump due to white space trimming.
+"
;; save data to restore later
- (ws-butler-with-save
- (widen)
- (setq ws-butler-presave-coord (list
- (line-number-at-pos (point))
- (current-column))))
+ (when ws-butler-keep-whitespace-before-point
+ (ws-butler-with-save
+ (widen)
+ (setq ws-butler-presave-coord (list
+ (line-number-at-pos (point))
+ (current-column)))))
(let (last-end)
(ws-butler-map-changes
(lambda (_prop beg end)
- [nongnu] elpa/ws-butler 7553d6392a 36/64: Handle adding back text during undo correctly., (continued)
- [nongnu] elpa/ws-butler 7553d6392a 36/64: Handle adding back text during undo correctly., Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler aa1935f150 37/64: update documentation re: highlight-changes-mode, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 11311538f6 50/64: fix up tests, simplify predicate code a bit., Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler a998a23ee8 41/64: Clarify ws-butler-keep-whitespace-before-point docs., Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 9b40da8428 46/64: add exemptions to ws-butler-global-mode, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler e5fc878904 54/64: disable changing leading whitespace by default, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 52321b99be 59/64: Merge pull request #29 from alevy03/master, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 323b651dd7 55/64: bump version, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler a02607ef63 33/64: Some minor grammatical fixes, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler f6ac856b82 13/64: clean up newlines at EOB when appropriate, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 81143ac737 25/64: Add customization for virtual space preservation.,
Stefan Kangas <=
- [nongnu] elpa/ws-butler 93409c1ca7 51/64: polyfill for setq-local, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler a5add4ea85 39/64: Merge branch 'remove-highlight-changes-mode', Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 7e2f32dcfc 45/64: Merge pull request #22 from spwhitton/apt-get, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 9e7449445b 48/64: Merge branch 'global-mode-exemptions', Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 8ccf6a0b74 61/64: Merge pull request #31 from hlissner/patch-1, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler c907dde343 58/64: Change example config to use prog-mode-hook., Stefan Kangas, 2021/12/31