Subject: Re: bug#18547: repeated C-s doesn't wrap back to the top if file is .gz

From: Juri Linkov <[email-masked]>
Date: Thu, 25 Sep 2014 01:20:31 +0300

>>> File not found and directory write-protected
> [...]
>> It fails because you are using a non-standard file name
>> "changelog", and not the default "ChangeLog".  You can customize
>> `change-log-default-name' to "changelog" then isearch will wrap
>> to the beginning instead of trying to wrap to a non-existent "ChangeLog".
>
> I think failing to switch to another file is fine, but it should
> still wrap around, and it should not burp at the user about some
> non-existing file.

Then if there are no files that fit the default naming scheme ChangeLog[.NN],
this patch will wrap around in the current buffer.  (I'm not sure whether
it should go into emacs-24 or trunk):

=== modified file 'lisp/vc/add-log.el'
--- lisp/vc/add-log.el	2014-02-10 01:34:22 +0000
+++ lisp/vc/add-log.el	2014-09-24 22:17:34 +0000
@@ -1097,12 +1097,14 @@ (defun change-log-next-buffer (&optional
                                    (ignore-errors
                                      (version< (substring b (length name))
                                                (substring a (length name))))))))
-	 (files (if isearch-forward files (reverse files))))
-    (find-file-noselect
-     (if wrap
-	 (car files)
-       (cadr (member (file-name-nondirectory (buffer-file-name buffer))
-		     files))))))
+	 (files (if isearch-forward files (reverse files)))
+	 (file (if wrap
+		   (car files)
+		 (cadr (member (file-name-nondirectory (buffer-file-name buffer))
+			       files)))))
+    (if (file-exists-p file)
+	(find-file-noselect file)
+      (current-buffer))))
 
 (defun change-log-fill-forward-paragraph (n)
   "Cut paragraphs so filling preserves open parentheses at beginning of lines."