GNU bug report logs -
#19422
25.0.50; `remove-overlays` needs one additional `point` at end of narrowed region.
Previous Next
Reported by: Keith David Bershatsky <esq <at> lawlist.com>
Date: Sun, 21 Dec 2014 08:41:02 UTC
Severity: normal
Found in version 25.0.50
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
In my particular use case, I am narrowing to a region and then inserting an `after-string` overlay at `point-max`:
(overlay-put (make-overlay (point-max) (point-max)) 'after-string "|")
I have a minor mode that draws a vertical line that tracks the cursor position and I extend that to window-end or point-max. The end of the buffer has a different color and a different character overlay depending upon where `point` is --- a leading cushion is used if the vertical column extends beyond the point at the end of the line.
And here is the slightly revised function that I am using to remove it. It differs a little bit from the version in my initial bug report number 19422:
(defun lawlist-remove-overlays (beg end name val)
"Remove the overlays."
;; DEBUGGING
;; (unless (and beg end name val)
;; (message "ERROR -- beg: %s | end: %s | name: %s | val: %s" beg end name val))
(let* (
(point-max (point-max))
(point-min (point-min))
(narrowed-p (not (equal (- point-max point-min) (buffer-size))))
(beg (if beg beg point-min))
(end
(cond
((and
(not narrowed-p)
end)
end)
((and
(not narrowed-p)
(null end))
point-max)
((and
narrowed-p
end
(< end point-max))
end)
((and
narrowed-p
end
(= end point-max))
(1+ end))
((and
narrowed-p
(null end))
(1+ point-max)) )))
(when (and beg end name val)
(overlay-recenter end)
(dolist (o (overlays-in beg end))
(when (eq (overlay-get o name) val)
(delete-overlay o))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
At Sun, 21 Dec 2014 18:45:06 +0200,
Eli Zaretskii wrote:
>
> > Date: Sun, 21 Dec 2014 00:39:44 -0800
> > From: Keith David Bershatsky <esq <at> lawlist.com>
> >
> > The function `remove-overlays`, when used without any arguments, needs one additional `point` at the end of a narrowed region to effectively remove an overlay at the very end of said region.
>
> Maybe I'm confused, but what do you mean by "overlay at the very end
> of region"? Overlay that starts at END is not part of the region,
> AFAIU.
This bug report was last modified 3 years and 280 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.