From: Lars Ingebrigtsen <larsi@gnus.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 34720@debbugs.gnu.org, dunni@gnu.org
Subject: bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of the file
Date: Tue, 27 Aug 2019 10:37:40 +0200 [thread overview]
Message-ID: <87blwb2ecr.fsf@gnus.org> (raw)
In-Reply-To: <83mufvdomu.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 27 Aug 2019 11:00:09 +0300")
Continuing to read the code in the massive Finsert_file_contents, even
with a way to get and restore the markers, replicating all that it does
seems like a rather hair-raising task. For instance:
/* If requested, replace the accessible part of the buffer
with the file contents. Avoid replacing text at the
beginning or end of the buffer that matches the file contents;
that preserves markers pointing to the unchanged parts.
Here we implement this feature in an optimized way
for the case where code conversion is NOT needed.
The following if-statement handles the case of conversion
in a less optimal way.
If the code conversion is "automatic" then we try using this
method and hope for the best.
But if we discover the need for conversion, we give up on this method
and let the following if-statement handle the replace job. */
Oh:
/* FIXME: insert-file-contents should be split with the top-level moved to
Elisp and only the core kept in C. */
Right.
Hm... Now what's this?
/* If the file name has special constructs in it,
call the corresponding file name handler. */
handler = Ffind_file_name_handler (filename, Qinsert_file_contents);
if (!NILP (handler))
{
val = call6 (handler, Qinsert_file_contents, filename,
visit, beg, end, replace);
if (CONSP (val) && CONSP (XCDR (val))
&& RANGED_FIXNUMP (0, XCAR (XCDR (val)), ZV - PT))
inserted = XFIXNUM (XCAR (XCDR (val)));
goto handled;
}
That's the code that calls out to `epa-file-insert-file-contents', isn't
it? Hm, yes it is. And handled: will restore the markers if inserted
is larger than zero.
But it seems to be larger than zero, so I think I need to do more
debugging.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
prev parent reply other threads:[~2019-08-27 8:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-03 15:28 bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of the file Ian Dunn
2019-07-09 16:33 ` Lars Ingebrigtsen
2019-08-26 7:20 ` Lars Ingebrigtsen
2019-08-26 7:59 ` Eli Zaretskii
2019-08-26 8:14 ` Lars Ingebrigtsen
2019-08-26 9:42 ` Eli Zaretskii
2019-08-27 7:14 ` Lars Ingebrigtsen
2019-08-27 8:00 ` Eli Zaretskii
2019-08-27 8:23 ` Lars Ingebrigtsen
2019-08-27 8:41 ` Eli Zaretskii
2019-08-27 9:05 ` Lars Ingebrigtsen
2019-08-27 9:17 ` Eli Zaretskii
2019-08-27 9:15 ` Lars Ingebrigtsen
2019-08-27 10:20 ` Eli Zaretskii
2019-08-30 9:48 ` Lars Ingebrigtsen
2019-08-30 10:21 ` Lars Ingebrigtsen
2019-08-30 12:19 ` Eli Zaretskii
2019-08-27 8:37 ` Lars Ingebrigtsen [this message]
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=87blwb2ecr.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=34720@debbugs.gnu.org \
--cc=dunni@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).