[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of

From: Eli Zaretskii
Subject: bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of the file
Date: Mon, 26 Aug 2019 10:59:18 +0300

> From: Lars Ingebrigtsen <address@hidden>
> Date: Mon, 26 Aug 2019 09:20:29 +0200
> Cc: address@hidden
> Lars Ingebrigtsen <address@hidden> writes:
> >> 1. Open a GnuPG encrypted file
> >> 2. Run the following:
> >>    (setq test-marker (make-marker))
> >>    (move-marker test-marker (point-marker))
> >>    ;; test-marker points to `point'
> >> 3. Revert the buffer
> >>    ;; test-marker now points to the end of the buffer

Markers cannot be preserved in every situation, there's no way around
this basic fact.

> The third is that the interface to the new replace-buffer-contents
> function is really awkward -- it only takes a buffer as its SOURCE,
> which means that if you want to feed it something, you have to skip
> around to temporary buffers instead of feeding it a string, which would
> be natural.  You have to be a with-temp-buffer/with-current-buffer/let
> contortionist to get it to be safe.

replace-buffer-contents is a primitive, so it can legitimately rely on
Lisp programs to set up whatever preconditions it needs for it to
work.  It MUST have a buffer to work with; if you want to replace with
a string, insert that string into a buffer and call the primitive.
Why is that a problem?

> Would anybody mind if I just write a `with-saved-markers' macro in
> subr-x, which would make all these problems to away and make the
> solution a two-liner in epa itself?

What would that macro do, exactly?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]