1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

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
This commit is contained in:
Leo C. Stein 2025-09-13 10:45:34 -05:00 committed by Arash Esbati
parent 79b7c7b1d3
commit 23a8c06a23

View file

@ -1044,10 +1044,16 @@ out of NAME."
(exec-path (buffer-local-value 'exec-path curbuf))) (exec-path (buffer-local-value 'exec-path curbuf)))
(apply #'call-process "kpsewhich" nil t nil (apply #'call-process "kpsewhich" nil t nil
(mapcar (lambda (rule) (mapcar (lambda (rule)
(concat (car rule) name (cdr rule))) (concat (car rule) name (cdr rule)))
guess-rules))) guess-rules)))
(when (< (point-min) (point-max)) ;; Starting with TeXlive 2025, kpsewhich returns blank
(buffer-substring (goto-char (point-min)) (line-end-position)))))))) ;; 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) (defun ffap-tex (name)
(ffap-tex-init) (ffap-tex-init)