]> code.delx.au - gnu-emacs/blobdiff - lisp/ffap.el
Merge from origin/emacs-25
[gnu-emacs] / lisp / ffap.el
index 037b978b6fb42e634cd28c40736ac2f7040a56b4..7013e6e8ba4e106e7e0058207a02710d48314087 100644 (file)
@@ -1,6 +1,6 @@
 ;;; ffap.el --- find file (or url) at point
 
-;; Copyright (C) 1995-1997, 2000-2015 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1997, 2000-2016 Free Software Foundation, Inc.
 
 ;; Author: Michelangelo Grigni <mic@mathcs.emory.edu>
 ;; Maintainer: emacs-devel@gnu.org
@@ -974,14 +974,14 @@ out of NAME."
              (push (cons "" (cdr (assoc (match-string 0) ; i.e. "(TeX-current-macro)"
                                         preferred-suffix-rules)))
                    guess-rules))
-           (setq kpsewhich-args (mapcar (lambda (rule)
-                                          (concat (car rule) name (cdr rule)))
-                                        guess-rules))
            (with-temp-buffer
              (let ((process-environment (buffer-local-value
                                          'process-environment curbuf))
                    (exec-path (buffer-local-value 'exec-path curbuf)))
-               (apply #'call-process "kpsewhich"  nil  t  nil kpsewhich-args))
+               (apply #'call-process "kpsewhich" nil t nil
+                      (mapcar (lambda (rule)
+                                          (concat (car rule) name (cdr rule)))
+                                        guess-rules)))
              (when (< (point-min) (point-max))
                (buffer-substring (goto-char (point-min)) (point-at-eol))))))))
 
@@ -1966,7 +1966,9 @@ 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)))
+  ;; ffap-guesser can signal an error, and we don't want that when,
+  ;; e.g., the user types M-n at the "C-x C-f" prompt.
+  (let ((guess (ignore-errors (ffap-guesser))))
     (when (stringp guess)
       (let ((url (ffap-url-p guess)))
        (or url