unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jens Schmidt via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 64117@debbugs.gnu.org
Subject: bug#64117: 28.2; "gnus-request-set-mark: Buffer is read-only" when exiting agentized, unplugged summary buffer
Date: Fri, 16 Jun 2023 20:58:05 +0200	[thread overview]
Message-ID: <b2eabcfd-1b46-6d5d-9014-8afba7bbb451@vodafonemail.de> (raw)

This issue should be also present in Emacs master, judging by the
code.  However I have reproduced this issue only in my
"production Emacs" on 28.2 and, in particular, *not* in an "emacs
-Q" environment.  Gnus setup complete with IMAP and all is
finicky, so probably you accept this bug report without all that.

Here are the steps to reproduce the issue:

- Ensure you have an agentized nnimap group G with some unread
   articles.

- Ensure Gnus is unplugged.

- Enter group G from the *Group* buffer by pressing "RET" on it.

- Mark some unread articles in the summary buffer of G as "read"
   by positioning point on them and pressing "d".

- Exit group G from the summary buffer by pressing "q".

The last step results in an error

   gnus-request-set-mark: Buffer is read-only: #<buffer *Summary 
nnimap+<host>:INBOX*>

for me.

Expected result is that the agent writes the information on the
marks that have changed while unplugged to a separate file which
it later, when Gnus gets plugged again, replays.

The reason for the bug us most likely commit

 
https://git.savannah.gnu.org/cgit/emacs.git/commit/src?id=cb12a84f2c519a48dd87453c925e3bc36d9944db

and here the change

   * lisp/gnus/nnagent.el: Don't use a unibyte buffer.

The author has removed a macro call to `mm-with-unibyte-buffer'
in function `nnagent-request-set-mark' without replacing it by,
for example, a call to `with-temp-buffer'.  Accordingly, function
`nnagent-request-set-mark' tries to operate on the current
buffer, which happens to be the read-only summary buffer.

Adding a `with-temp-buffer' around the inserts and the call to
`write-region' fixes this issue (showing 28.2-based code):

(deffoo nnagent-request-set-mark (group action server)
   (with-temp-buffer
     (insert "(gnus-agent-synchronize-group-flags \""
	    group
	    "\" '")
     (gnus-pp action)
     (insert " \""
	    (gnus-method-to-server gnus-command-method)
	    "\"")
     (insert ")\n")
     (let ((coding-system-for-write nnheader-file-coding-system))
       (write-region (point-min) (point-max) (gnus-agent-lib-file "flags")
		    t 'silent)))
   ;; Also set the marks for the original back end that keeps marks in
   ;; the local system.
   (let ((gnus-agent nil))
     (when (and (memq (car gnus-command-method) '(nntp))
	       (gnus-check-backend-function 'request-set-mark
					    (car gnus-command-method)))
       (funcall (gnus-get-function gnus-command-method 'request-set-mark)
	       group action server)))
   nil)

I could provide a patch on emacs-29 but only without actually
testing it...





             reply	other threads:[~2023-06-16 18:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-16 18:58 Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-06-21 13:13 ` bug#64117: 28.2; "gnus-request-set-mark: Buffer is read-only" when exiting agentized, unplugged summary buffer Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-21 13:52   ` Andrew Cohen
2023-06-21 14:14     ` Eli Zaretskii
2023-06-21 14:22       ` Andrew Cohen
2023-06-21 14:34         ` Eli Zaretskii
2023-07-01 21:05           ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-01 22:52             ` Andrew Cohen
2023-07-01 23:54               ` Eric Abrahamsen
2023-07-02  7:14                 ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=b2eabcfd-1b46-6d5d-9014-8afba7bbb451@vodafonemail.de \
    --to=bug-gnu-emacs@gnu.org \
    --cc=64117@debbugs.gnu.org \
    --cc=jschmidt4gnu@vodafonemail.de \
    /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).