Subject: Re: bug#62239: 30.0.50; emacs 30.5.0 editing epub encoding system

From: Michael Heerdegen <[email-masked]>
Date: Sat, 18 Mar 2023 01:06:47 +0100

H.-J. Heitländer <[email-masked]> writes:

> 1) enter epub <C-x D> .../test.epub <ENTER>
>
> 2) switch to edit In DocView(?) <C-c C-c>
>
> 3) open file ...4.html <Enter>
>
> 4) change a line (for instance " " => " ")
>
> 5) save file <C-x C-f>
>
> 6) Symptom: minibuffer display "Wrong Type Argument: stringp, nil"

When this error happens, is the epub opened in archive-mode or
doc-view-mode?

When in doc-view-mode I get a different error:

| Debugger entered--Lisp error: (void-variable archive-nil-write-file-member)
|   (symbol-value archive-nil-write-file-member)
|   (archive-*-write-file-member archive archive-subfile-mode (symbol-value writer))
|   (if (fboundp writer) (funcall writer archive archive-subfile-mode) (archive-*-write-file-member archive archive-subfile-mode (symbol-value writer)))
|   (let ((writer (save-current-buffer (set-buffer archive-superior-buffer) (archive-name "write-file-member"))) (archive (save-current-buffer (set-buffer archive-superior-buffer) (archive-maybe-copy (buffer-file-name))))) (if (fboundp writer) (funcall writer archive archive-subfile-mode) (archive-*-write-file-member archive archive-subfile-mode (symbol-value writer))) (set-buffer-modified-p nil) (message "Updating archive...done"))
|   (save-restriction (message "Updating archive...") (widen) (let ((writer (save-current-buffer (set-buffer archive-superior-buffer) (archive-name "write-file-member"))) (archive (save-current-buffer (set-buffer archive-superior-buffer) (archive-maybe-copy (buffer-file-name))))) (if (fboundp writer) (funcall writer archive archive-subfile-mode) (archive-*-write-file-member archive archive-subfile-mode (symbol-value writer))) (set-buffer-modified-p nil) (message "Updating archive...done")) (set-buffer archive-superior-buffer) (if (not archive-remote) (revert-buffer) (archive-maybe-update nil)))
|   (save-excursion (save-restriction (message "Updating archive...") (widen) (let ((writer (save-current-buffer (set-buffer archive-superior-buffer) (archive-name "write-file-member"))) (archive (save-current-buffer (set-buffer archive-superior-buffer) (archive-maybe-copy (buffer-file-name))))) (if (fboundp writer) (funcall writer archive archive-subfile-mode) (archive-*-write-file-member archive archive-subfile-mode (symbol-value writer))) (set-buffer-modified-p nil) (message "Updating archive...done")) (set-buffer archive-superior-buffer) (if (not archive-remote) (revert-buffer) (archive-maybe-update nil))))
|   (archive-write-file-member)
|   (run-hook-with-args-until-success archive-write-file-member)
|   (basic-save-buffer nil)
|   (save-buffer)

When I hit C-c C-c to leave doc-view-mode and return to the archive view,
I get an error like you posted.

doc-view-mode doesn't remove its installed advice on
`buffer-revert-function' when hitting C-c C-c, and this simple fix seems
to help to avoid the error above (could you maybe try that please?):

diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index b14655fb274..00240ebf08d 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -2204,7 +2204,9 @@ doc-view-mode
     (add-hook 'change-major-mode-hook
 	      (lambda ()
 		(doc-view-kill-proc)
-		(remove-overlays (point-min) (point-max) 'doc-view t))
+		(remove-overlays (point-min) (point-max) 'doc-view t)
+                (remove-function (local 'revert-buffer-function)
+                                 #'doc-view--revert-buffer))
 	      nil t)
     (add-hook 'clone-indirect-buffer-hook #'doc-view-clone-buffer-hook nil t)
     (add-hook 'kill-buffer-hook #'doc-view-kill-proc nil t)

> 10 Directory buffer display in basic mode(?) (mode-line starts with "U:%%-
> emac...)

Is this the dired buffer or the buffer showing the archive contents?
Does the patch above help with this problem (assuming it is caused by
the error you got)?

TIA,

Michael.