Subject: bug#23218: 25.1.50; find-file is noisy

From: Eli Zaretskii <[email-masked]>
Date: Tue, 05 Apr 2016 17:29:58 +0300

> From: Lars Magne Ingebrigtsen <[email-masked]>
> Date: Mon, 04 Apr 2016 21:16:10 +0200
> 
> >From -Q, open "/tmp/foo.txt", put the string "quimby.gnus.org" into the
> buffer, save it, and then type `C-x C-f M-n' (which is what you'd
> usually do to revert the buffer).
> 
> The following error is signalled:
> 
> Debugger entered--Lisp error: (file-error "make client process failed" "Connection refused" :name "ffap-machine-p" :buffer nil :host "quimby.gnus.org" :service "discard" :nowait nil :tls-parameters nil)
>   signal(file-error ("make client process failed" "Connection refused" :name "ffap-machine-p" :buffer nil :host "quimby.gnus.org" :service "discard" :nowait nil :tls-parameters nil))
>   ffap-machine-p("quimby.gnus.org")
>   ffap-machine-at-point()
>   ffap-guesser()
>   ffap-guess-file-name-at-point()
>   run-hook-with-args-until-success(ffap-guess-file-name-at-point)
>   read-file-name--defaults("/tmp/" nil)

The patch below seems to fix the problem.  (Does anyone see a reason
to run hooks in this case without blocking errors?)

If no one objects or comes up with a better idea, I will commit this
to the emacs-25 branch in a few days.

Thanks.

diff --git a/lisp/ffap.el b/lisp/ffap.el
index 36727b3..2ff2588 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -1966,7 +1966,7 @@ Only intended for interactive use."
 (defun ffap-guess-file-name-at-point ()
   "Try to get a file name at point.
 This hook is intended to be put in `file-name-at-point-functions'."
-  (let ((guess (ffap-guesser)))
+  (let ((guess (ignore-errors (ffap-guesser))))
     (when (stringp guess)
       (let ((url (ffap-url-p guess)))
 	(or url