GNU bug report logs - #49603
pcomplete completion for xargs (pcomplete/xargs)

Previous Next

Package: emacs;

Reported by: Karthik Chikmagalur <karthikchikmagalur <at> gmail.com>

Date: Sat, 17 Jul 2021 10:07:01 UTC

Severity: normal

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 49603 in the body.
You can then email your comments to 49603 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#49603; Package emacs. (Sat, 17 Jul 2021 10:07:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Karthik Chikmagalur <karthikchikmagalur <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 17 Jul 2021 10:07:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Karthik Chikmagalur <karthikchikmagalur <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: pcomplete completion for xargs (pcomplete/xargs)
Date: Sat, 17 Jul 2021 00:53:18 -0700
[Message part 1 (text/plain, inline)]
Hello,

The function "pcomplete/xargs" (in lisp/pcmpl-unix.el) was set up to
treat xargs with the usage pattern

       xargs [command [initial-arguments]]

Whereas the usage of xargs is actually

       xargs [options] [command [initial-arguments]]

So options to xargs itself were not being completed (assuming
pcomplete-default-completion-function is capable of generating these
completions.)

I added this, treating any string that begins with a "-" following xargs
as an xargs argument and the first string that doesn't as the command
being run by xargs. For example,

       xargs -I{} -0 rm -r
       
-I and -0 will be completed as arguments to xargs (using
 pcomplete-default-completion-function) and rm as a command (using pcomplete-command-completion-function).
 
Commit log entry:

* lisp/pcmpl-unix.el (pcomplete/xargs): Add support for completing xargs
options, including the ability to distinguish them from the command
xargs runs.

Karthik Chikmagalur
[pcmpl-unix-pcomplete-xargs.diff (text/x-patch, inline)]
diff -u /home/karthik/.local/share/git/emacs-src/lisp/pcmpl-unix.el /home/karthik/.local/share/git/emacs-src/lisp/pcmpl-unix-new.el
--- emacs-src/lisp/pcmpl-unix.el	2021-07-02 18:50:29.556608640 -0700
+++ emacs-src/lisp/pcmpl-unix-new.el	2021-07-17 00:35:39.417290007 -0700
@@ -82,7 +82,8 @@
 ;;;###autoload
 (defun pcomplete/xargs ()
   "Completion for `xargs'."
-  ;; FIXME: Add completion of xargs-specific arguments.
+  (while (string-prefix-p "-" (pcomplete-arg 0))
+    (pcomplete-here (funcall pcomplete-default-completion-function)))
   (funcall pcomplete-command-completion-function)
   (funcall (or (pcomplete-find-completion-function (pcomplete-arg 1))
 	       pcomplete-default-completion-function)))



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49603; Package emacs. (Sat, 17 Jul 2021 14:31:01 GMT) Full text and rfc822 format available.

Message #8 received at 49603 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Karthik Chikmagalur <karthikchikmagalur <at> gmail.com>
Cc: 49603 <at> debbugs.gnu.org
Subject: Re: bug#49603: pcomplete completion for xargs (pcomplete/xargs)
Date: Sat, 17 Jul 2021 16:30:22 +0200
Karthik Chikmagalur <karthikchikmagalur <at> gmail.com> writes:

> I added this, treating any string that begins with a "-" following xargs
> as an xargs argument and the first string that doesn't as the command
> being run by xargs. For example,
>
>        xargs -I{} -0 rm -r

Thanks; applied to Emacs 28.

This change was small enough to apply without assigning copyright to the
FSF, but for future patches you want to submit, it might make sense to
get the paperwork started now, so that subsequent patches can be applied
speedily. Would you be willing to sign such paperwork?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 28.1, send any further explanations to 49603 <at> debbugs.gnu.org and Karthik Chikmagalur <karthikchikmagalur <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 17 Jul 2021 14:31:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49603; Package emacs. (Sat, 17 Jul 2021 22:33:02 GMT) Full text and rfc822 format available.

Message #13 received at 49603 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Karthik Chikmagalur <karthikchikmagalur <at> gmail.com>
Cc: 49603 <at> debbugs.gnu.org
Subject: Re: bug#49603: pcomplete completion for xargs (pcomplete/xargs)
Date: Sun, 18 Jul 2021 00:32:32 +0200
Karthik Chikmagalur <karthikchikmagalur <at> gmail.com> writes:

>> This change was small enough to apply without assigning copyright to the
>> FSF, but for future patches you want to submit, it might make sense to
>> get the paperwork started now, so that subsequent patches can be applied
>> speedily. Would you be willing to sign such paperwork?
>
> Certainly. I plan to submit a few more small patches of this nature, so
> I would like to sign the paperwork now. Please let me know what you need
> from me for this.

Great; here's the form to get started:


Please email the following information to assign <at> gnu.org, and we
will send you the assignment form for your past and future changes.

Please use your full legal name (in ASCII characters) as the subject
line of the message.
----------------------------------------------------------------------
REQUEST: SEND FORM FOR PAST AND FUTURE CHANGES

[What is the name of the program or package you're contributing to?]
Emacs

[Did you copy any files or text written by someone else in these changes?
Even if that material is free software, we need to know about it.]

[Do you have an employer who might have a basis to claim to own
your changes?  Do you attend a school which might make such a claim?]

[For the copyright registration, what country are you a citizen of?]

[What year were you born?]

[Please write your email address here.]

[Please write your postal address here.]

[Which files have you changed so far, and which new files have you written
so far?]




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49603; Package emacs. (Sun, 18 Jul 2021 02:33:02 GMT) Full text and rfc822 format available.

Message #16 received at 49603 <at> debbugs.gnu.org (full text, mbox):

From: Karthik Chikmagalur <karthikchikmagalur <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 49603 <at> debbugs.gnu.org
Subject: Re: bug#49603: pcomplete completion for xargs (pcomplete/xargs)
Date: Sat, 17 Jul 2021 14:56:02 -0700
> This change was small enough to apply without assigning copyright to the
> FSF, but for future patches you want to submit, it might make sense to
> get the paperwork started now, so that subsequent patches can be applied
> speedily. Would you be willing to sign such paperwork?

Certainly. I plan to submit a few more small patches of this nature, so
I would like to sign the paperwork now. Please let me know what you need
from me for this.

Karthik




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 15 Aug 2021 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 248 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.