GNU bug report logs - #60187
[PATCH] whitespace: Clear bob and eob markers in `whitespace-color-off'

Previous Next

Package: emacs;

Reported by: Richard Hansen <rhansen <at> rhansen.org>

Date: Mon, 19 Dec 2022 05:05:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 60187 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#60187; Package emacs. (Mon, 19 Dec 2022 05:05:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Richard Hansen <rhansen <at> rhansen.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 19 Dec 2022 05:05:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Richard Hansen <rhansen <at> rhansen.org>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] whitespace: Clear bob and eob markers in
 `whitespace-color-off'
Date: Mon, 19 Dec 2022 00:03:39 -0500
[Message part 1 (text/plain, inline)]
See attached.
[0001-whitespace-Clear-bob-and-eob-markers-in-whitespace-c.patch (text/x-patch, attachment)]
[OpenPGP_signature (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60187; Package emacs. (Wed, 10 Jan 2024 22:37:01 GMT) Full text and rfc822 format available.

Message #8 received at 60187 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Richard Hansen <rhansen <at> rhansen.org>
Cc: 60187 <at> debbugs.gnu.org
Subject: Re: bug#60187: [PATCH] whitespace: Clear bob and eob markers in
 `whitespace-color-off'
Date: Wed, 10 Jan 2024 14:36:16 -0800
Richard Hansen <rhansen <at> 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 <at> 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")




This bug report was last modified 1 year and 211 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.