bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#52169: 28.0.60; "Args out of range" when completing shell command


From: Stefan Monnier
Subject: bug#52169: 28.0.60; "Args out of range" when completing shell command
Date: Sun, 05 Dec 2021 23:24:13 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Kévin Le Gouguec [2021-12-04 18:16:50] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> I pushed to `master` a fix for the immediate cause of the `Args out of
>> range` error, which seems to brings us back to Emacs-27's poor behavior.
> Can confirm, thanks!

Thanks.

>> Maybe it's good enough for `emacs-28` as well, but I have to think about
>> this problem a bit more.
> OK; leaving this open for the time being then.

Hmm, I can't think of a good way to make it work correctly without
significant changes to `pcomplete.el` and its API.

For `emacs-28`, I propose the patch below, which is a slightly improved
version of the patch currently on `master`.  As before, it won't fix the
real problem, but will avoid "Args out of range" and revert to the
behavior we had in Emacs-27 (which was/is broken, but tends
to be milder for the user).

Any objection?


        Stefan


diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index ca82b4a9e60..21d610fdf44 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -283,8 +283,9 @@ completion-table-subvert
          ((eq (car-safe action) 'boundaries)
           (let ((beg (or (and (eq (car-safe res) 'boundaries) (cadr res)) 0)))
             `(boundaries
-              ,(max (length s1)
-                    (+ beg (- (length s1) (length s2))))
+              ,(min (length string)
+                    (max (length s1)
+                         (+ beg (- (length s1) (length s2)))))
               . ,(and (eq (car-safe res) 'boundaries) (cddr res)))))
          ((stringp res)
           (if (string-prefix-p s2 res completion-ignore-case)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]