unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Augusto Stoffel <arstoffel@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 57673@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#57673: [PATCH] Parse --help messages for pcomplete
Date: Wed, 14 Sep 2022 21:41:45 +0200	[thread overview]
Message-ID: <8735ctd9qe.fsf@gmail.com> (raw)
In-Reply-To: <87edwd3gpv.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 14 Sep 2022 21:21:00 +0200")

[-- Attachment #1: Type: text/plain, Size: 1512 bytes --]

On Wed, 14 Sep 2022 at 21:21, Lars Ingebrigtsen wrote:

> Augusto Stoffel <arstoffel@gmail.com> writes:
>
>> The patch includes completion for a variety of commands (in part to test
>> the flexibility of the parser), including most commands from coreutils,
>> so it has become a bit bulky.  Given the large number of new functions,
>> I hope the commit message is detailed enough.
>
> I've pushed the first (trivial) patch, but the second has two warnings:
>
> In pcomplete/systemctl:
> pcmpl-linux.el:154:12: Warning: Unused lexical variable `subcmd'

I've attached a patch to be applied (and squashed) on top of what I sent
previously.  Let me know if this is inconvenient and I'll send the whole
thing.

> In pcomplete-from-help:
> pcomplete.el:1344:2: Warning: docstring wider than 80 characters

Hum, I don't know how to fix this.  The long line is the function
signature, which is created mechanically by cl-defun and displays all
the default values of the keyword arguments.

The formatting is horrible:

    (pcomplete-from-help COMMAND &rest ARGS &key (MARGIN (rx bol (+ " ")))
    (ARGUMENT (rx "-" (+ (any "-" alnum)) (32 "="))) (METAVAR (rx (32 " ")
    (or (+ (any alnum "_-")) (seq "[" (+? nonl) "]") (seq "<" (+? nonl)
    ">") (seq "{" (+? nonl) "}")))) (SEPARATOR (rx ", " symbol-start))
    (DESCRIPTION (rx (* nonl) (* "\n" (>= 9 " ") (* nonl)))) NARROW-START
    NARROW-END)

But the information is good to have, because you need to know what these
regexps are in order to use the function.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-to-Warning-Unused-lexical-variable-subcmd.patch --]
[-- Type: text/x-patch, Size: 1090 bytes --]

From ef2ef880e2f29662c11a5422da11b293d1c1fe15 Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <arstoffel@gmail.com>
Date: Wed, 14 Sep 2022 21:35:00 +0200
Subject: [PATCH] Fix to Warning: Unused lexical variable `subcmd'

---
 lisp/pcmpl-linux.el | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lisp/pcmpl-linux.el b/lisp/pcmpl-linux.el
index a2195c1e88..023c655a2a 100644
--- a/lisp/pcmpl-linux.el
+++ b/lisp/pcmpl-linux.el
@@ -158,6 +158,12 @@ pcomplete/systemctl
                 (pcomplete-here
                  (pcomplete-from-help "systemctl --help")))
                ;; TODO: suggest only relevant units to each subcommand
+               ("start"
+                (pcomplete-here
+                 (pcmpl-linux--systemd-units context "--state" "inactive,failed")))
+               ((or "restart" "stop")
+                (pcomplete-here
+                 (pcmpl-linux--systemd-units context "--state" "active")))
                (_ (pcomplete-here
                    (completion-table-in-turn
                     (pcmpl-linux--systemd-units context "--all")
-- 
2.37.3


  reply	other threads:[~2022-09-14 19:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-08  9:34 bug#57673: [PATCH] Parse --help messages for pcomplete Augusto Stoffel
2022-09-08 12:39 ` Lars Ingebrigtsen
2022-09-08 13:05   ` Augusto Stoffel
2022-09-09 17:02     ` Lars Ingebrigtsen
2022-09-10  9:20       ` Augusto Stoffel
2022-09-08 20:49 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-08 21:53   ` Augusto Stoffel
2022-09-09  2:47     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-10  9:45       ` Augusto Stoffel
2022-09-10 14:32         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-10 16:12           ` Augusto Stoffel
2022-09-14 19:15           ` Augusto Stoffel
2022-09-14 19:21             ` Lars Ingebrigtsen
2022-09-14 19:41               ` Augusto Stoffel [this message]
2022-09-14 19:48                 ` Lars Ingebrigtsen
2022-09-14 19:57                   ` Augusto Stoffel
2022-09-14 19:59                     ` Lars Ingebrigtsen
2022-09-14 20:40                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-14 21:11                     ` Lars Ingebrigtsen
2022-09-14 21:23                     ` Augusto Stoffel
2022-09-14 21:45                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=8735ctd9qe.fsf@gmail.com \
    --to=arstoffel@gmail.com \
    --cc=57673@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).