all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Jim Porter <jporterbugs@gmail.com>
Cc: John Wiegley <johnw@newartisans.com>,
	Gregory Heytings <gregory@heytings.org>,
	arstoffel@gmail.com, Eli Zaretskii <eliz@gnu.org>,
	59956@debbugs.gnu.org
Subject: bug#59956: 29.0.60: Failure when completing arguments in Eshell after variable interpolation
Date: Fri, 16 Dec 2022 09:13:09 -0500	[thread overview]
Message-ID: <jwvcz8j4ewb.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <765547c0-b2a5-b054-a29d-b27002b7442c@gmail.com> (Jim Porter's message of "Thu, 15 Dec 2022 22:09:10 -0800")

> Still, like Stefan and Augusto mentioned, there's probably a larger issue
> here: should Eshell be allowed to feed Pcomplete non-strings? Since
> Pcomplete was written for Eshell initially, there's some basis for why it
> *might* support non-string values, but actually requiring that is an awful
> lot to ask of every programmer who ever wants to write a pcomplete function.

A "general" solution might be the one below, tho it looks more like
a general workaround, I think.

John?


        Stefan


diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el
index 4e3a88bbda8..6a4d754b8c0 100644
--- a/lisp/pcomplete.el
+++ b/lisp/pcomplete.el
@@ -646,12 +646,14 @@ pcomplete-arg
 The OFFSET argument is added to/taken away from the index that will be
 used.  This is really only useful with `first' and `last', for
 accessing absolute argument positions."
-  (nth (+ (pcase index
-	   ('first 0)
-	   ('last  pcomplete-last)
-	   (_      (- pcomplete-index (or index 0))))
-	  (or offset 0))
-       pcomplete-args))
+  (let ((arg (nth (+ (pcase index
+	               ('first 0)
+	               ('last  pcomplete-last)
+	               (_      (- pcomplete-index (or index 0))))
+	             (or offset 0))
+	          pcomplete-args)))
+    (when arg
+      (if (stringp arg) arg (format "%S" arg)))))
 
 (defun pcomplete-begin (&optional index offset)
   "Return the beginning position of the INDEXth argument.






  reply	other threads:[~2022-12-16 14:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-11  1:25 bug#59956: 29.0.60: Failure when completing arguments in Eshell after variable interpolation Jim Porter
2022-12-11  7:44 ` Eli Zaretskii
2022-12-11  8:56   ` Augusto Stoffel
2022-12-11 15:27     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-12 22:21   ` Gregory Heytings
2022-12-12 22:37     ` Augusto Stoffel
2022-12-12 23:27       ` Gregory Heytings
2022-12-16 11:20         ` Augusto Stoffel
2022-12-16  6:09     ` Jim Porter
2022-12-16 14:13       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-12-16 14:28         ` Gregory Heytings
2022-12-19  0:54           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-19  1:19             ` Gregory Heytings
2022-12-19  2:15               ` Jim Porter
2022-12-19  3:07               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-19 15:00                 ` Gregory Heytings
2022-12-19 16:22                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-19 22:22                     ` Gregory Heytings
2022-12-21  6:32                       ` Jim Porter
2022-12-21  9:28                         ` Gregory Heytings
2022-12-29 22:02                           ` Gregory Heytings
2022-12-19 10:31             ` Augusto Stoffel
2022-12-19 16:21               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-19 18:04               ` Jim Porter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvcz8j4ewb.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=59956@debbugs.gnu.org \
    --cc=arstoffel@gmail.com \
    --cc=eliz@gnu.org \
    --cc=gregory@heytings.org \
    --cc=johnw@newartisans.com \
    --cc=jporterbugs@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.