* bug#60187: [PATCH] whitespace: Clear bob and eob markers in `whitespace-color-off'
@ 2022-12-19 5:03 Richard Hansen
2024-01-10 22:36 ` Stefan Kangas
0 siblings, 1 reply; 2+ messages in thread
From: Richard Hansen @ 2022-12-19 5:03 UTC (permalink / raw)
To: 60187
[-- Attachment #1.1.1: Type: text/plain, Size: 15 bytes --]
See attached.
[-- Attachment #1.1.2: 0001-whitespace-Clear-bob-and-eob-markers-in-whitespace-c.patch --]
[-- Type: text/x-patch, Size: 1851 bytes --]
From 225dc1f32c865a3b36eb9c6d3881b298c871e3a3 Mon Sep 17 00:00:00 2001
From: Richard Hansen <rhansen@rhansen.org>
Date: Wed, 14 Dec 2022 01:57:17 -0500
Subject: [PATCH] whitespace: Clear bob and eob markers in
`whitespace-color-off'
* lisp/whitespace.el (whitespace-color-off): Clear markers when
turning off `whitespace-mode'.
* test/lisp/whitespace-tests.el (whitespace-tests--clear-markers): Add
a test.
---
lisp/whitespace.el | 4 +++-
test/lisp/whitespace-tests.el | 6 ++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 558be1841a..b747293eb4 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -2220,7 +2220,9 @@ whitespace-color-off
(remove-hook 'clone-buffer-hook #'whitespace--clone t)
(remove-hook 'clone-indirect-buffer-hook #'whitespace--clone t)
(font-lock-remove-keywords nil whitespace-font-lock-keywords)
- (font-lock-flush)))
+ (font-lock-flush)
+ (set-marker whitespace-bob-marker nil)
+ (set-marker whitespace-eob-marker nil)))
(defun whitespace-point--used (start end)
(let ((ostart (overlay-start whitespace-point--used)))
diff --git a/test/lisp/whitespace-tests.el b/test/lisp/whitespace-tests.el
index 7079c1ea5e..1780d6246d 100644
--- a/test/lisp/whitespace-tests.el
+++ b/test/lisp/whitespace-tests.el
@@ -64,6 +64,12 @@ whitespace-tests--cleanup-string
(whitespace-cleanup)
(buffer-string)))
+(ert-deftest whitespace-tests--clear-markers ()
+ (whitespace-tests--with-test-buffer '(face empty)
+ (whitespace-mode -1)
+ (should (null (marker-buffer whitespace-bob-marker)))
+ (should (null (marker-buffer whitespace-eob-marker)))))
+
(ert-deftest whitespace-cleanup-eob ()
(let ((whitespace-style '(empty)))
(should (equal (whitespace-tests--cleanup-string "a\n")
--
2.39.0
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#60187: [PATCH] whitespace: Clear bob and eob markers in `whitespace-color-off'
2022-12-19 5:03 bug#60187: [PATCH] whitespace: Clear bob and eob markers in `whitespace-color-off' Richard Hansen
@ 2024-01-10 22:36 ` Stefan Kangas
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Kangas @ 2024-01-10 22:36 UTC (permalink / raw)
To: Richard Hansen; +Cc: 60187
Richard Hansen <rhansen@rhansen.org> writes:
> See attached.
Thanks for the patch and apologies for taking so long to reply.
Does this fix any particular issue or is this just a cleanup?
> From 225dc1f32c865a3b36eb9c6d3881b298c871e3a3 Mon Sep 17 00:00:00 2001
> From: Richard Hansen <rhansen@rhansen.org>
> Date: Wed, 14 Dec 2022 01:57:17 -0500
> Subject: [PATCH] whitespace: Clear bob and eob markers in
> `whitespace-color-off'
>
> * lisp/whitespace.el (whitespace-color-off): Clear markers when
> turning off `whitespace-mode'.
> * test/lisp/whitespace-tests.el (whitespace-tests--clear-markers): Add
> a test.
> ---
> lisp/whitespace.el | 4 +++-
> test/lisp/whitespace-tests.el | 6 ++++++
> 2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/whitespace.el b/lisp/whitespace.el
> index 558be1841a..b747293eb4 100644
> --- a/lisp/whitespace.el
> +++ b/lisp/whitespace.el
> @@ -2220,7 +2220,9 @@ whitespace-color-off
> (remove-hook 'clone-buffer-hook #'whitespace--clone t)
> (remove-hook 'clone-indirect-buffer-hook #'whitespace--clone t)
> (font-lock-remove-keywords nil whitespace-font-lock-keywords)
> - (font-lock-flush)))
> + (font-lock-flush)
> + (set-marker whitespace-bob-marker nil)
> + (set-marker whitespace-eob-marker nil)))
>
> (defun whitespace-point--used (start end)
> (let ((ostart (overlay-start whitespace-point--used)))
> diff --git a/test/lisp/whitespace-tests.el b/test/lisp/whitespace-tests.el
> index 7079c1ea5e..1780d6246d 100644
> --- a/test/lisp/whitespace-tests.el
> +++ b/test/lisp/whitespace-tests.el
> @@ -64,6 +64,12 @@ whitespace-tests--cleanup-string
> (whitespace-cleanup)
> (buffer-string)))
>
> +(ert-deftest whitespace-tests--clear-markers ()
> + (whitespace-tests--with-test-buffer '(face empty)
> + (whitespace-mode -1)
> + (should (null (marker-buffer whitespace-bob-marker)))
> + (should (null (marker-buffer whitespace-eob-marker)))))
> +
> (ert-deftest whitespace-cleanup-eob ()
> (let ((whitespace-style '(empty)))
> (should (equal (whitespace-tests--cleanup-string "a\n")
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-10 22:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-19 5:03 bug#60187: [PATCH] whitespace: Clear bob and eob markers in `whitespace-color-off' Richard Hansen
2024-01-10 22:36 ` Stefan Kangas
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).