unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#29008: 26.0.90; two bugs in gnus-read-ephemeral-*
@ 2017-10-26  8:15 Katsumi Yamaoka
  2017-10-26 12:19 ` Noam Postavsky
  0 siblings, 1 reply; 5+ messages in thread
From: Katsumi Yamaoka @ 2017-10-26  8:15 UTC (permalink / raw)
  To: 29008

[-- Attachment #1: Type: text/plain, Size: 2433 bytes --]

Hi,

BUG-1:
If a group for a certain bug number is once read and its contents
are cached, the following error happens.  This is the case I do

M-x gnus-read-ephemeral-emacs-bug-group RET 26862 RET

for reading bug#26862.

Debugger entered--Lisp error: (file-error "https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26862;mboxmaint=yes;mboxstat=yes" "Not modified")
  signal(file-error ("https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26862;mboxmaint=yes;mboxstat=yes" "Not modified"))
  url-insert-file-contents("https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26862;mboxmaint=yes;mboxstat=yes")
  gnus-read-ephemeral-bug-group((26862) "https://debbugs.gnu.org/cgi/bugreport.cgi?bug=%s;mboxmaint=yes;mboxstat=yes" nil)
  gnus-read-ephemeral-emacs-bug-group(26862)

It's not intentional, is it?  Fixing it is easy by passing t as
the second argument to `url-insert-file-contents'.  However, it
causes another problem; the program prompts me for the yes-or-no
query when I redo `M-x gnus-read-ephemeral-emacs-bug-group' as:

Buffer  *temp file* modified; kill anyway? (yes or no)

This happens when finishing the (with-temp-file ...) form because
`url-insert-file-contents' sets `buffer-file-name' as the second
argument is set.  So, `buffer-file-name' has to be reset to nil.


BUG-2:
An example that (info "(gnus)Foreign Groups") introduces

   Here is an example:
     (require 'gnus-art)
     (add-to-list
      'gnus-button-alist
      '("#\\([0-9]+\\)\\>" 1
        (string-match "\\<emacs\\>" (or gnus-newsgroup-name ""))
        gnus-read-ephemeral-emacs-bug-group 1))

passes a bug number to `gnus-read-ephemeral-emacs-bug-group' as
a string.  Even if BUG-1 is fixed, this causes a bug as follows:

Debugger entered--Lisp error: (wrong-type-argument numberp "26862")
  number-to-string("26862")
  mapconcat(number-to-string ("26862") ",")
  gnus-read-ephemeral-bug-group(("26862") "https://debbugs.gnu.org/cgi/bugreport.cgi?bug=%s;mboxmaint=yes;mboxstat=yes" nil)
  gnus-read-ephemeral-emacs-bug-group("26862")

A patch for both the bugs is below.  Thanks.

In GNU Emacs 26.0.90 (build 1, i686-pc-cygwin, GTK+ Version 3.18.9)
 of 2017-10-26 built on localhost
Windowing system distributor 'The Cygwin/X Project', version 11.0.11900000


* lisp/gnus/gnus-group.el (gnus-read-ephemeral-gmane-group)
(gnus-read-ephemeral-bug-group): Make it work for any number of times.
(gnus-read-ephemeral-emacs-bug-group): Allow a string for bug#.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1628 bytes --]

--- gnus-group.el~	2017-10-25 22:06:10.154071900 +0000
+++ gnus-group.el	2017-10-26 08:08:28.510090200 +0000
@@ -2373,7 +2373,10 @@
     (with-temp-file tmpfile
       (url-insert-file-contents
        (format gnus-gmane-group-download-format
-	       group start (+ start range)))
+	       group start (+ start range))
+       t)
+      ;; `url-insert-file-contents' sets this because of the 2nd arg.
+      (setq buffer-file-name nil)
       (write-region (point-min) (point-max) tmpfile)
       (gnus-group-read-ephemeral-group
        (format "nndoc+ephemeral:%s.start-%s.range-%s" group start range)
@@ -2463,7 +2466,7 @@
 	    (if (and (not gnus-plugged)
 		     (file-exists-p file))
 		(insert-file-contents file)
-	      (url-insert-file-contents (format mbox-url id)))))
+	      (url-insert-file-contents (format mbox-url id) t))))
 	;; Add the debbugs address so that we can respond to reports easily.
 	(let ((address
 	       (format "%s@%s" (car ids)
@@ -2488,7 +2491,9 @@
 		    (insert ", " address))
 		(insert "To: " address "\n")))
 	    (goto-char (point-max))
-	    (widen)))))
+	    (widen)))
+	;; `url-insert-file-contents' sets this because of the 2nd arg.
+	(setq buffer-file-name nil)))
     (gnus-group-read-ephemeral-group
      (format "nndoc+ephemeral:bug#%s"
 	     (mapconcat 'number-to-string ids ","))
@@ -2512,6 +2517,8 @@
   (interactive (list (string-to-number
 		      (read-string "Enter bug number: "
 				   (thing-at-point 'word) nil))))
+  (when (stringp ids)
+    (setq ids (string-to-number ids)))
   (unless (listp ids)
     (setq ids (list ids)))
   (gnus-read-ephemeral-bug-group

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-10-27  0:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-26  8:15 bug#29008: 26.0.90; two bugs in gnus-read-ephemeral-* Katsumi Yamaoka
2017-10-26 12:19 ` Noam Postavsky
2017-10-26 23:34   ` Katsumi Yamaoka
2017-10-27  0:12     ` Noam Postavsky
2017-10-27  0:47       ` Katsumi Yamaoka

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).