GNU bug report logs - #34720
26.1; Reverting a GPG buffer moves all markers to the end of the file

Previous Next

Package: emacs;

Reported by: Ian Dunn <dunni <at> gnu.org>

Date: Sun, 3 Mar 2019 15:29:01 UTC

Severity: normal

Tags: confirmed, fixed

Found in version 26.1

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 34720 <at> debbugs.gnu.org, dunni <at> 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 11:05:33 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> Must be sheer luck.  Or maybe I'm missing something, but you will have
> to show me the code that moves this test marker to convince me.  (I
> don't have the necessary software installed to repeat the recipe myself.)

(progn
  (find-file "/tmp/foo.txt")
  (kill-buffer (current-buffer))
  (when (file-exists-p "/tmp/foo.txt")
    (delete-file "/tmp/foo.txt"))
  (find-file "/tmp/foo.txt")
  (insert "Test line.")
  (setq test-marker1 (make-marker))
  (move-marker test-marker1 4)
  (setq test-marker2 (make-marker))
  (move-marker test-marker2 5)
  (save-buffer t)
  (shell-command "echo new >> /tmp/foo.txt")
  (revert-buffer nil t)
  (list test-marker1 test-marker2))

=> (#<marker at 4 in foo.txt> #<marker at 5 in foo.txt>)

So the markers seem to be restored on `revert-buffer'?

The reason this doesn't happen in the epa case seems to be a bug in
Finsert_file_contents: When there's an external handler, it skips
directly to handled: and neglects to do the same_at_start computation,
which leaves that at point-min and restore_window_points ignores all
markers that have values that are larger than same_at_start.

If I'm reading the code right.

If the new text doesn't match the old text, the markers are not
restored:

(progn
  (find-file "/tmp/foo.txt")
  (kill-buffer (current-buffer))
  (when (file-exists-p "/tmp/foo.txt")
    (delete-file "/tmp/foo.txt"))
  (find-file "/tmp/foo.txt")
  (insert "Test line.")
  (setq test-marker1 (make-marker))
  (move-marker test-marker1 4)
  (setq test-marker2 (make-marker))
  (move-marker test-marker2 5)
  (save-buffer t)
  (shell-command "echo Here is a new text > /tmp/foo.txt")
  (revert-buffer nil t)
  (list test-marker1 test-marker2))

(#<marker at 1 in foo.txt> #<marker at 1 in foo.txt>)

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




This bug report was last modified 5 years and 262 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.