unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19422: 25.0.50; `remove-overlays` needs one additional `point` at end of narrowed region.
@ 2014-12-21  8:39 Keith David Bershatsky
  2014-12-21 16:45 ` Eli Zaretskii
  2014-12-21 17:42 ` Keith David Bershatsky
  0 siblings, 2 replies; 5+ messages in thread
From: Keith David Bershatsky @ 2014-12-21  8:39 UTC (permalink / raw)
  To: 19422

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.  Here is something that I'm using for my own setup, which adds the missing `point`:

    (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
                  narrowed-p
                  end)
                (1+ end))
              ((and
                  narrowed-p
                  (null end))
                (1+ point-max))
              ((and
                  (not narrowed-p)
                  (null end))
                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))))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

In GNU Emacs 25.0.50.1 (x86_64-apple-darwin10.8.0, NS appkit-1038.36 Version 10.6.8 (Build 10K549))
 of 2014-10-01 on MP.local
Repository revision: 117996 dmantipov@yandex.ru-20141001132108-zdsxru2390mqyjlu
Windowing system distributor `Apple', version 10.3.1038
Configured using:
 `configure --with-ns'

Configured features:
ACL LIBXML2 ZLIB

Important settings:
  locale-coding-system: utf-8-unix

Major mode: ORG

Minor modes in effect:
  sd-mode: t
  vr-mode: t
  sb-mode: t
  vl-mode: t
  ln-mode: t
  hl-mode: t
  parens-mode: t
  ws-mode: t
  tb-mode: t
  shell-dirtrack-mode: t
  cm-mode: t
  frame-bufs-mode: t
  bc-mode: t
  ds-mode: t
  ml-mode: t
  font-lock-mode: t
  buffer-read-only: t

Recent input:
<escape> x r e p o r t - e m a c s - b u g <return>

Recent messages:
Loading /Users/HOME/.0.data/.0.emacs/.0.lisp/lawlist-test.el (source)...done
Loading /Users/HOME/.0.data/.0.emacs/.0.lisp/init.el (source)...done
Wrote /Users/HOME/.0.data/.0.emacs/.lock

Load-path shadows:
/Users/HOME/.0.data/.0.emacs/.0.wl/md4 hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/md4
/Users/HOME/.0.data/.0.emacs/.0.wl/hex-util hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/hex-util
/Users/HOME/.0.data/.0.emacs/.0.wl/sasl hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/sasl
/Users/HOME/.0.data/.0.emacs/.0.wl/sasl-ntlm hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/sasl-ntlm
/Users/HOME/.0.data/.0.emacs/.0.wl/sasl-digest hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/sasl-digest
/Users/HOME/.0.data/.0.emacs/.0.wl/sasl-cram hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/sasl-cram
/Users/HOME/.0.data/.0.emacs/.0.wl/ntlm hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/ntlm
/Users/HOME/.0.data/.0.emacs/.0.wl/hmac-md5 hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/hmac-md5
/Users/HOME/.0.data/.0.emacs/.0.wl/hmac-def hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/net/hmac-def
/Users/HOME/.0.data/.0.emacs/.0.wl/rfc2368 hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/mail/rfc2368
/Users/HOME/.0.data/.0.emacs/.0.wl/utf7 hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/gnus/utf7
/Users/HOME/.0.data/.0.emacs/.0.wl/smime hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/gnus/smime
/Users/HOME/.0.data/.0.emacs/.0.wl/pgg hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/obsolete/pgg
/Users/HOME/.0.data/.0.emacs/.0.wl/pgg-pgp5 hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/obsolete/pgg-pgp5
/Users/HOME/.0.data/.0.emacs/.0.wl/pgg-pgp hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/obsolete/pgg-pgp
/Users/HOME/.0.data/.0.emacs/.0.wl/pgg-parse hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/obsolete/pgg-parse
/Users/HOME/.0.data/.0.emacs/.0.wl/pgg-gpg hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/obsolete/pgg-gpg
/Users/HOME/.0.data/.0.emacs/.0.wl/pgg-def hides /Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/Resources/lisp/obsolete/pgg-def

Features:
(shadow mime-setup mail-mime-setup semi-setup mime-image modb-standard
elmo-imap4 emacsbug lawlist-desktop frameset lawlist-arc
lawlist-colors reporter load-theme-buffer-local lawlist-dv lawlist-mc
rect lawlist-ztree lawlist-wl w3m-load mime-w3m w3m browse-url
doc-view jka-compr image-mode w3m-hist w3m-fb bookmark-w3m w3m-ems
mule-util w3m-ccl w3m-favicon w3m-image w3m-proc w3m-util elmo-nntp
wl-demo rfc2368 wl-spam elmo-spam elsp-header elsp-generic wl-fldmgr
wl-score smtp sasl sasl-anonymous sasl-login sasl-plain wl-news
wl-address pldap wl-thread wl-action wl wl-e21 wl-draft wl-template
wl-summary wl-refile wl-message wl-mime pgg mime-pgp mime-play
filename mime-edit eword-encode pgg-parse pccl pccl-20 ccl pgg-def
signature sendmail elmo-mime mmelmo-buffer mmelmo-imap mime-view
mime-conf calist semi-def mmimap mime-parse mmbuffer wl-highlight
elmo-filter elmo-multi wl-folder wl-util crm pp elmo-pop3 elmo-net
elmo-cache elmo-map elmo-dop elmo-flag elmo-localdir wl-vars elmo
elmo-signal elmo-msgdb modb modb-generic modb-entity mime mmgeneric
elmo-util emu invisible inv-23 poem poem-e20 poem-e20_3 utf7
eword-decode mel mime-def alist std11 mcharset mcs-20 mcs-e20 pces
pces-e20 pces-20 broken pcustom elmo-date elmo-vars path-util poe pym
static product wl-version elmo-version apel-ver luna lawlist-dired
tramp-sh ls-lisp lawlist-vr-hr eldoc lawlist-ws disp-table
lawlist-calc lawlist-flyspell lawlist-yas lawlist-tex-mode skeleton
compare-w lawlist-txt-mode lawlist-tabbar lawlist-github ido view
vc-git vc vc-dispatcher tramp tramp-compat tramp-loaddefs trampver
shell thingatpt time-stamp log-view log-edit message mml mml-sec
mm-decode mm-bodies mm-encode gmm-utils mailheader pcvs-util add-log
help-mode grep compile find-lisp epa epg epg-config ediff-merg
ediff-wind ediff-diff ediff-mult ediff-help ediff-init ediff-util
ediff ert ewoc debug eieio-base diff-mode conf-mode autorevert
filenotify lorg-calendar org-element lorg-search org-agenda
context-menu dired-read-filename dired lawlist-toodledo url-http tls
url-auth url-gw url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util url-parse auth-source eieio
eieio-core password-cache url-vars mailcap json xml lawlist-org
lawlist-calendar org byte-opt bytecomp byte-compile cconv org-macro
org-footnote org-pcomplete pcomplete org-list org-faces org-entities
org-version ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob ob-table
ob-keys ob-exp ob-comint ob-core ob-eval org-compat org-macs
org-loaddefs cal-menu calendar cal-loaddefs noutline outline
format-spec lawlist-frame lawlist-cm lawlist-bbdb gnus gnus-ems
nnheader gnus-util mail-utils wid-edit mail-parse rfc2231 rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mailabbrev mail-extr rfc822 cl
timezone lawlist-grep lawlist-compile rx comint ansi-color ring
lawlist-frame-bufs advice derived lawlist-init pcase help-fns cl-macs
gv easy-mmode edmacro kmacro cl-loaddefs cl-lib savehist server
ps-print ps-def lpr find-func saveplace easymenu time-date tooltip
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel ns-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button
faces cus-face macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process cocoa ns multi-tty emacs)

Memory information:
((conses 16 1313688 99661)
 (symbols 48 62352 0)
 (miscs 40 1189 1177)
 (strings 32 145107 28245)
 (string-bytes 1 4641259)
 (vectors 16 34814)
 (vector-slots 8 728642 19777)
 (floats 8 1043 228)
 (intervals 56 5059 53)
 (buffers 976 12))





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#19422: 25.0.50; `remove-overlays` needs one additional `point` at end of narrowed region.
  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
  1 sibling, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2014-12-21 16:45 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: 19422

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#19422: 25.0.50; `remove-overlays` needs one additional `point` at end of narrowed region.
  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
  2014-12-22 16:32   ` Eli Zaretskii
  1 sibling, 1 reply; 5+ messages in thread
From: Keith David Bershatsky @ 2014-12-21 17:42 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 19422

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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#19422: 25.0.50; `remove-overlays` needs one additional `point` at end of narrowed region.
  2014-12-21 17:42 ` Keith David Bershatsky
@ 2014-12-22 16:32   ` Eli Zaretskii
  2021-08-16 13:41     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2014-12-22 16:32 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: 19422

> Date:  Sun, 21 Dec 2014 09:42:36 -0800
> From:  Keith David Bershatsky <esq@lawlist.com>
> Cc:  19422@debbugs.gnu.org
> 
> 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.

It looks like overlays-in treats EOB specially, and does not treat
(point-max) in the same way.  This is explicitly stated in the doc
string of overlays-in.

I don't know what are the reasons for such a special treatment, and
why a narrowed region doesn't get the same treatment.  I always
thought that Emacs treats both the same.  Perhaps all we need is to
give both the same treatment, and that's it.

Besides that, the doc string of remove-overlays is inaccurate and
misleading; I will take care of that.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#19422: 25.0.50; `remove-overlays` needs one additional `point` at end of narrowed region.
  2014-12-22 16:32   ` Eli Zaretskii
@ 2021-08-16 13:41     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-16 13:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 19422, Keith David Bershatsky

Eli Zaretskii <eliz@gnu.org> writes:

> I don't know what are the reasons for such a special treatment, and
> why a narrowed region doesn't get the same treatment.  I always
> thought that Emacs treats both the same.  Perhaps all we need is to
> give both the same treatment, and that's it.

I've now done this in Emacs 28.  It's a non-compatible change, so I've
called it out in NEWS.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-16 13:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2014-12-22 16:32   ` Eli Zaretskii
2021-08-16 13:41     ` Lars Ingebrigtsen

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