From 23a8c06a23a1280018b8f7d40781e5e7f030ce8c Mon Sep 17 00:00:00 2001 From: "Leo C. Stein" Date: Sat, 13 Sep 2025 10:45:34 -0500 Subject: [PATCH] Skip over possible blank lines returned by kpsewhich * lisp/ffap.el (ffap-latex-mode): Starting with TeXlive 2025, the kpsewhich utility may return blank lines before the first valid path for `ffap'. The old behavior of `ffap-latex-mode' was to simply return the first line of output from kpsewhich (if the output was nonempty). The fix simply skips all \r and \n chars. (Bug#79397) Copyright-paperwork-exempt: yes --- lisp/ffap.el | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lisp/ffap.el b/lisp/ffap.el index 4766b3f208a..4cf2dfebc0f 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el @@ -1044,10 +1044,16 @@ out of NAME." (exec-path (buffer-local-value 'exec-path curbuf))) (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)) (line-end-position)))))))) + (concat (car rule) name (cdr rule))) + guess-rules))) + ;; Starting with TeXlive 2025, kpsewhich returns blank + ;; lines when multiple filenames are given and a given file + ;; is not found, so we have to go to the first non-blank + ;; line in order to find a file-path (bug#79397): + (goto-char (point-min)) + (skip-chars-forward "\r\n") + (when (< (point) (line-end-position)) + (buffer-substring (point) (line-end-position)))))))) (defun ffap-tex (name) (ffap-tex-init)