all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Kangas <stefankangas@gmail.com>, rhansen@rhansen.org
Cc: 59618@debbugs.gnu.org, yantar92@posteo.net, arsen@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	[thread overview]
Message-ID: <837czbib0k.fsf@gnu.org> (raw)
In-Reply-To: <CADwFkm=kpRZfEck_y_dDvuXdUJ_X0+D6UXC2bk_d86ouaC2O5Q@mail.gmail.com> (message from Stefan Kangas on Sat, 26 Nov 2022 22:54:25 -0800)

> From: Stefan Kangas <stefankangas@gmail.com>
> Date: Sat, 26 Nov 2022 22:54:25 -0800
> Cc: Eli Zaretskii <eliz@gnu.org>, 59618@debbugs.gnu.org, 
> 	Arsen Arsenović <arsen@aarsen.me>, 
> 	Richard Hansen <rhansen@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





  reply	other threads:[~2022-12-01 12:06 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-26 14:42 bug#59618: 29.0.50; global-whitespace-mode + org-capture: "Marker does not point anywhere" Arsen Arsenović via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-26 19:58 ` Eli Zaretskii
2022-11-26 20:11   ` Arsen Arsenović via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-27  0:27   ` Ihor Radchenko
2022-11-27  6:13     ` Stefan Kangas
2022-11-27  6:20       ` Ihor Radchenko
2022-11-27  6:54         ` Stefan Kangas
2022-12-01 12:06           ` Eli Zaretskii [this message]
2022-12-01 15:02             ` Stefan Kangas
2022-12-13  6:25             ` Richard Hansen
2022-12-13  6:34               ` Ihor Radchenko
2022-12-13  6:38                 ` Richard Hansen
2022-12-13  6:48                   ` Ihor Radchenko
2022-12-14  2:42                     ` Richard Hansen
2022-12-14 12:09                       ` Eli Zaretskii
2022-12-14 14:15                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-14 15:08                           ` Ihor Radchenko
2022-12-14 17:40                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-14 17:48                               ` Ihor Radchenko
2022-12-14 20:10                                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-18  9:24                                   ` bug#59618: [PATCH] " Richard Hansen
2022-12-20  0:41                                     ` bug#59618: [PATCH] " Richard Hansen
2022-12-20 13:52                                       ` Eli Zaretskii
2022-12-21 13:34                                         ` Ihor Radchenko
2022-12-21 14:03                                           ` Eli Zaretskii
2022-11-27  0:28   ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=837czbib0k.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=59618@debbugs.gnu.org \
    --cc=arsen@aarsen.me \
    --cc=rhansen@rhansen.org \
    --cc=stefankangas@gmail.com \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.