GNU bug report logs - #59618
29.0.50; global-whitespace-mode + org-capture: "Marker does not point anywhere"

Previous Next

Package: emacs;

Reported by: Arsen Arsenović <arsen <at> aarsen.me>

Date: Sat, 26 Nov 2022 19:54:02 UTC

Severity: normal

Tags: patch

Found in version 29.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefankangas <at> gmail.com>, rhansen <at> rhansen.org
Cc: 59618 <at> debbugs.gnu.org, yantar92 <at> posteo.net, arsen <at> aarsen.me
Subject: bug#59618: 29.0.50; global-whitespace-mode + org-capture: "Marker does not point anywhere"
Date: Thu, 01 Dec 2022 14:06:19 +0200
> From: Stefan Kangas <stefankangas <at> gmail.com>
> Date: Sat, 26 Nov 2022 22:54:25 -0800
> Cc: Eli Zaretskii <eliz <at> gnu.org>, 59618 <at> debbugs.gnu.org, 
> 	Arsen Arsenović <arsen <at> aarsen.me>, 
> 	Richard Hansen <rhansen <at> rhansen.org>
> 
> Stepping through `whitespace--update-bob-eob' with edebug shows that the
> `goto-char' in this fragment fails, because `whitespace-bob-marker' is
> nil:

Is it really nil or is it a marker that "points nowhere"?

This part:

> Here is the backtrace again, for reference:
> 
> Debugger entered--Lisp error: (error "Marker does not point anywhere")
>   whitespace--update-bob-eob(37 37 29)

seems to indicate the latter.

Anyway, it sounds like the changes in f47a5324f44e caused the two markers,
whitespace-bob-marker and whitespace-eob-marker to sometimes "point
nowhere".  The band-aid patch below avoids the error reported in this bug,
but redisplay still complains in *Messsages*:

  Error during redisplay: (jit-lock-function 45) signaled (error "Marker does not point anywhere")

Richard, please chime in.

Here's the band-aid patch I promised:

diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 25ea07e..bed2a82 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -2315,7 +2315,11 @@ whitespace-post-command-hook
   (unless (and (eq whitespace-point (point))
                (not whitespace-buffer-changed))
     (when (and (not whitespace-buffer-changed)
-               (memq 'empty whitespace-active-style))
+               (memq 'empty whitespace-active-style)
+               (markerp whitespace-bob-marker)
+               (bufferp (marker-buffer whitespace-bob-marker))
+               (markerp whitespace-eob-marker)
+               (bufferp (marker-buffer whitespace-eob-marker)))
       ;; No need to handle the `whitespace-buffer-changed' case here
       ;; because that is taken care of by the `font-lock-multiline'
       ;; text property.
@@ -2422,6 +2426,8 @@ whitespace--update-bob-eob
         (widen)
         (let ((inhibit-read-only t))
           (when (or (null beg)
+                    (and (markerp whitespace-bob-marker)
+                         (bufferp (marker-buffer whitespace-bob-marker))
                     (<= beg (save-excursion
                               (goto-char whitespace-bob-marker)
                               ;; Any change in the first non-`empty'
@@ -2431,7 +2437,7 @@ whitespace--update-bob-eob
                               ;; classified as `empty' (e.g., delete the
                               ;; "x" from " x").
                               (forward-line 1)
-                              (point))))
+                              (point)))))
             (goto-char 1)
             (set-marker whitespace-bob-marker (point))
             (save-match-data
@@ -2440,11 +2446,13 @@ whitespace--update-bob-eob
                 (put-text-property (match-beginning 1) (match-end 1)
                                    'font-lock-multiline t))))
           (when (or (null end)
+                    (and (markerp whitespace-eob-marker)
+                         (bufferp (marker-buffer whitespace-eob-marker))
                     (>= end (save-excursion
                               (goto-char whitespace-eob-marker)
                               ;; See above comment for the BoB case.
                               (forward-line -1)
-                              (point))))
+                              (point)))))
             (goto-char (1+ (buffer-size)))
             (set-marker whitespace-eob-marker (point))
             (save-match-data




This bug report was last modified 2 years and 189 days ago.

Previous Next


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