GNU bug report logs - #76478
30.0.92; doc-view--revert-buffer fails when saving OpenDocument spreadsheets

Previous Next

Package: emacs;

Reported by: Roland Winkler <winkler <at> gnu.org>

Date: Fri, 21 Feb 2025 19:55:01 UTC

Severity: normal

Merged with 75515

Found in version 30.0.92

Fixed in version 31.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 76478 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>, Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Roland Winkler <winkler <at> gnu.org>, 76478 <at> debbugs.gnu.org
Subject: Re: bug#76478: 30.0.92; doc-view--revert-buffer fails when saving
 OpenDocument spreadsheets
Date: Sun, 23 Feb 2025 10:08:38 +0100
[Message part 1 (text/plain, inline)]
Tassilo Horn <tsdh <at> gnu.org> writes:

>>> When I open an OpenDocument spreadsheet (file extension ods), by
>>> default this happens via doc-view.  Then, when I edit the file (say,
>>> content.xml) and try to save it, doc-view--revert-buffer bails out
>>> with the error (wrong-type-argument stringp nil).
>>> 
>>> If, instead, I open and edit the file as a zip archive without
>>> doc-view, I can save it without any problems.
>>
>> Thanks.
>>
>> Tassilo, could you please look into this?

You actually don't need an ODS document for that error to trigger.  A
PDF works, too.

  - Find foo.pdf
  - C-c C-c to switch to the editing mode
  - M-x revert-buffer RET ==> bang!

The difference with OpenDocuments is that after editing some file inside
the archive, the archive buffer will be reverted automatically.

The problem is that when switching to the editing mode, the buffer-local
value of doc-view--buffer-file-name is killed and so our
doc-view--revert-buffer advice function errors when trying to update the
cached copy of the document (which only exists if the document is remote
or inside some archive).

I've added a nil-check there.  I think that's ok.  Alternatively, we
could possibly remove the advice function when switching to the editing
mode.  Stefan, what do you think?

I've also found and fixed another related bug.  When switching to the
editing mode for an OpenDocument (archive-mode), then editing its
contents and saving (causing a revert), doc-view-minor-mode was
disabled, i.e., you couldn't C-c C-c back to doc-view-mode.  Here's
possibly also an alternative: the archive--mode-revert advice function
could bind revert-buffer-preserve-modes just as our
doc-view--revert-buffer does.  But I think my version is better because
otherwise we'd need to make all possible editing modes play to
doc-view's rules.

Stefan, do you think my patch is ok?

And Eli, in which version do you want the fix?  I think the issue is
quite old and as explained above, you will usually only trigger it when
editing OpenDocument contents which probably is quite uncommon.

Bye,
Tassilo

[0001-doc-view-Fix-error-during-revert-in-editing-mode.patch (text/x-patch, attachment)]

This bug report was last modified 123 days ago.

Previous Next


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