From: Stefan <monnier@IRO.UMontreal.CA>
To: Barry OReilly <gundaetiapo@gmail.com>
Cc: 16818@debbugs.gnu.org
Subject: bug#16818: Acknowledgement (Undo in region after markers in undo history relocated)
Date: Mon, 24 Mar 2014 09:03:50 -0400 [thread overview]
Message-ID: <jwv4n2nhirv.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <CAFM41H3fhb+adrtWfcSrimAcO+79tDqJbJFOA=HtLbAaX183cQ@mail.gmail.com> (Barry OReilly's message of "Sun, 23 Mar 2014 18:49:32 -0400")
> Attached is the new patch to solve this, implementing option 2 and
> incorporating your feedback.
Looks good, thank you very much. Feel free to install into emacs-24,
but please see my comments below.
Stefan
> +2014-03-13 Barry O'Reilly <gundaetiapo@gmail.com>
> + * markers.texi (Moving Marker Positions): The 2014-03-02 doc
Missing empty line between the two.
> + (while (and (consp (car list))
> + (markerp (caar list))
(markerp (car-safe (car list)))
> + (and (eq (marker-buffer (caar list))
> + (current-buffer))
> + (integerp (marker-position (caar list)))
I think this `integerp' test is redundant (marker-position can only
return nil or an integer and if it returns nil, then marker-buffer also
returns nil).
> ;; (MARKER . OFFSET) means a marker MARKER was adjusted by OFFSET.
> (`(,(and marker (pred markerp)) . ,(and offset (pred integerp)))
> - (when (marker-buffer marker)
> - (set-marker marker
> - (- marker offset)
> - (marker-buffer marker))))
> + (warn "Encountered %S entry in undo list with no matching (TEXT . POS) entry"
> + next))
I think I'd add the warning without removing the `set-marker', just to
be conservative.
> + (when (and (consp undo-elt)
> + (stringp (car undo-elt))
(stringp (car-safe undo-elt))
> + (integerp (cdr undo-elt)))
> + (let ((list-i (cdr undo-list-copy)))
> + (while (markerp (caar list-i))
I think you need (markerp (car-safe (car list-i))) because (car list-i)
may be an integer.
Also, I'd try to avoid repeatedly calling (car list-i) in the body of
the `while' loop(s) by let-binding it. I'd probably do it via `pop', as
in
(while (...)
(let ((elem (pop undo-list)))
...))
> ((and (consp undo-elt) (markerp (car undo-elt)))
> - ;; This is a marker-adjustment element (MARKER . ADJUSTMENT).
> - ;; See if MARKER is inside the region.
> - (let ((alist-elt (assq (car undo-elt) undo-adjusted-markers)))
> - (unless alist-elt
> - (setq alist-elt (cons (car undo-elt)
> - (marker-position (car undo-elt))))
> - (setq undo-adjusted-markers
> - (cons alist-elt undo-adjusted-markers)))
> - (and (cdr alist-elt)
> - (>= (cdr alist-elt) start)
> - (<= (cdr alist-elt) end))))
> + ;; (MARKER . ADJUSTMENT)
> + nil)
It would also be more conservative to keep this unchanged, but I think
I agree with you here that we don't need to be *that* conservative.
> - record_delete (beg, make_buffer_string (beg, beg + length, 1));
> + record_delete (beg, make_buffer_string (beg, beg + length, 1), false);
Begs the question: why didn't (don't) we record marker adjustments here
(and other similar places)?
Stefan
next prev parent reply other threads:[~2014-03-24 13:03 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-19 22:15 bug#16818: Undo in region after markers in undo history relocated Barry OReilly
[not found] ` <handler.16818.B.13928481719895.ack@debbugs.gnu.org>
2014-02-19 23:07 ` bug#16818: Acknowledgement (Undo in region after markers in undo history relocated) Barry OReilly
2014-02-20 4:53 ` Stefan Monnier
2014-02-20 14:38 ` Barry OReilly
2014-02-24 22:46 ` Barry OReilly
2014-02-25 21:43 ` Stefan Monnier
2014-02-26 15:18 ` Barry OReilly
2014-03-11 21:24 ` Barry OReilly
2014-03-12 23:24 ` Stefan Monnier
2014-03-13 1:59 ` Barry OReilly
2014-03-13 13:24 ` Stefan Monnier
2014-03-13 14:35 ` Stefan Monnier
2014-03-13 16:55 ` Barry OReilly
2014-03-17 23:05 ` Barry OReilly
2014-03-18 0:02 ` Stefan
2014-03-19 13:36 ` Barry OReilly
2014-03-19 18:52 ` Stefan
2014-03-19 13:45 ` Barry OReilly
2014-03-19 18:56 ` Stefan
2014-03-23 22:49 ` Barry OReilly
2014-03-24 13:03 ` Stefan [this message]
2014-03-24 22:10 ` Barry OReilly
2014-03-25 1:28 ` Stefan
2014-03-25 2:32 ` Barry OReilly
2020-09-09 12:25 ` Lars Ingebrigtsen
2020-12-06 15:57 ` bug#16818: Undo in region after markers in undo history relocated 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=jwv4n2nhirv.fsf-monnier+emacsbugs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=16818@debbugs.gnu.org \
--cc=gundaetiapo@gmail.com \
/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).