From 0a354d65784e5cd25da408c4b102fb1c15fa7a73 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 31 May 2023 17:50:53 +0300 Subject: [PATCH] Fix infloop in info-look.el * lisp/info-look.el (info-lookup-guess-gdb-script-symbol): Fix infloop when there are no completions. (Bug#63808) --- lisp/info-look.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/info-look.el b/lisp/info-look.el index 7858ed58774..da45e30cd36 100644 --- a/lisp/info-look.el +++ b/lisp/info-look.el @@ -733,7 +733,11 @@ Return nil if there is nothing appropriate in the buffer near point." (let ((str (string-join str-list " "))) (when (assoc str completions) (throw 'result str)) - (nbutlast str-list))))))) + ;; 'nbutlast' will not destructively set its argument + ;; to nil when the argument is a list of 1 element. + (if (= (length str-list) 1) + (setq str-list nil) + (nbutlast str-list)))))))) (error nil))) ;;;###autoload -- 2.39.2