unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Keith David Bershatsky <esq@lawlist.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 19422@debbugs.gnu.org
Subject: bug#19422: 25.0.50; `remove-overlays` needs one additional `point` at end of narrowed	region.
Date: Sun, 21 Dec 2014 09:42:36 -0800	[thread overview]
Message-ID: <m2y4q0vr03.wl%esq@lawlist.com> (raw)
In-Reply-To: <m2k31lqtv3.wl%esq@lawlist.com>

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@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.





  parent reply	other threads:[~2014-12-21 17:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-21  8:39 bug#19422: 25.0.50; `remove-overlays` needs one additional `point` at end of narrowed region Keith David Bershatsky
2014-12-21 16:45 ` Eli Zaretskii
2014-12-21 17:42 ` Keith David Bershatsky [this message]
2014-12-22 16:32   ` Eli Zaretskii
2021-08-16 13:41     ` Lars Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=m2y4q0vr03.wl%esq@lawlist.com \
    --to=esq@lawlist.com \
    --cc=19422@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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 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).