[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: |
Lars Ingebrigtsen |
Subject: |
bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of the file |
Date: |
Tue, 27 Aug 2019 10:23:28 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> writes:
> These just restore a single marker: the point marker. That's a far
> cry from restoring all the markers. I don't think the latter is
> possible in all cases without violating the principle of least
> astonishment (by placing the markers at locations that have nothing in
> comm on with where they have been before the editing operation).
Hm. Doesn't the code below restore all markers (that it can restore)?
static void
restore_window_points (Lisp_Object window_markers, ptrdiff_t inserted,
ptrdiff_t same_at_start, ptrdiff_t same_at_end)
{
for (; CONSP (window_markers); window_markers = XCDR (window_markers))
if (CONSP (XCAR (window_markers)))
{
Lisp_Object car = XCAR (window_markers);
Lisp_Object marker = XCAR (car);
Lisp_Object oldpos = XCDR (car);
if (MARKERP (marker) && FIXNUMP (oldpos)
&& XFIXNUM (oldpos) > same_at_start
&& XFIXNUM (oldpos) < same_at_end)
{
ptrdiff_t oldsize = same_at_end - same_at_start;
ptrdiff_t newsize = inserted;
double growth = newsize / (double)oldsize;
ptrdiff_t newpos
= same_at_start + growth * (XFIXNUM (oldpos) - same_at_start);
Fset_marker (marker, make_fixnum (newpos), Qnil);
}
}
}
And I just tested with the test case in this bug report, which is
(progn
(setq test-marker (make-marker))
(move-marker test-marker (point)))
append to the file, and then `M-x revert-buffer': test-marker remains at
the same position.
So I think Finsert_file_contents really restores (for some value of
"restores") all the markers?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of the file, Lars Ingebrigtsen, 2019/08/26
- bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of the file, Eli Zaretskii, 2019/08/26
- bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of the file, Lars Ingebrigtsen, 2019/08/26
- bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of the file, Eli Zaretskii, 2019/08/26
- bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of the file, Lars Ingebrigtsen, 2019/08/27
- bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of the file, Eli Zaretskii, 2019/08/27
- bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of the file,
Lars Ingebrigtsen <=
- bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of the file, Eli Zaretskii, 2019/08/27
- bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of the file, Lars Ingebrigtsen, 2019/08/27
- bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of the file, Eli Zaretskii, 2019/08/27
- bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of the file, Lars Ingebrigtsen, 2019/08/27
- bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of the file, Eli Zaretskii, 2019/08/27
- bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of the file, Lars Ingebrigtsen, 2019/08/30
- bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of the file, Lars Ingebrigtsen, 2019/08/30
- bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of the file, Eli Zaretskii, 2019/08/30
- bug#34720: 26.1; Reverting a GPG buffer moves all markers to the end of the file, Lars Ingebrigtsen, 2019/08/27