From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#66551: [PATCH] Add completion for Unix 'doas' command. Date: Sun, 15 Oct 2023 20:05:32 +0530 Message-ID: <87y1g454y3.fsf@gmail.com> References: <87sf6c90s5.fsf@mailbox.org> <87bkd0jf8m.fsf@mailbox.org> <877cnoc89o.fsf@mailbox.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17832"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 66551@debbugs.gnu.org, Stefan Kangas To: Antero Mejr Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 15 16:36:52 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qs2Ee-0004S5-9j for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 15 Oct 2023 16:36:52 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qs2EU-0007xJ-Dz; Sun, 15 Oct 2023 10:36:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qs2EQ-0007wW-9S for bug-gnu-emacs@gnu.org; Sun, 15 Oct 2023 10:36:39 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qs2EQ-0004YJ-1P for bug-gnu-emacs@gnu.org; Sun, 15 Oct 2023 10:36:38 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qs2En-0008J7-V5 for bug-gnu-emacs@gnu.org; Sun, 15 Oct 2023 10:37:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 15 Oct 2023 14:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66551 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 66551-submit@debbugs.gnu.org id=B66551.169738057131867 (code B ref 66551); Sun, 15 Oct 2023 14:37:01 +0000 Original-Received: (at 66551) by debbugs.gnu.org; 15 Oct 2023 14:36:11 +0000 Original-Received: from localhost ([127.0.0.1]:53898 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qs2Dy-0008Hv-HI for submit@debbugs.gnu.org; Sun, 15 Oct 2023 10:36:10 -0400 Original-Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:52622) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qs2Dt-0008HO-Pv for 66551@debbugs.gnu.org; Sun, 15 Oct 2023 10:36:08 -0400 Original-Received: by mail-pl1-x643.google.com with SMTP id d9443c01a7336-1c9d7a98abbso23926135ad.1 for <66551@debbugs.gnu.org>; Sun, 15 Oct 2023 07:35:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697380535; x=1697985335; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r63LwwFwSHY5K3Mui5Tw/+UsnKPvpHtKIPEwzO9jvmI=; b=kkRInEdgT1FkUj0lXKQfmi4oWk/RHZ1irs72Y1WQdEBTD6KNNk2/AgT9N5P8SmUuGO pnxF4s1J/qO440Wn+FPddgiAjGBWjX3Kek238eOKtsloysQ3FSMozaAamZ4eoCmSZ/Vm /keLhv5v6voIGSam66Tjw4GndUKOUssux5yLM5SX4ge9di0+s+skpmwLCuIrsgv02udu 7Ixe/sqaIcqcr8AWmjoxMQh3xaHFirWZTSyJV6/u7e56E8+BSdtTDek+uYg9yJPPlyCG DaNGfDh7j4ghtbZmljTz9yj+14EfcJlhPKWdXA32gzLYiPrVyeQywUM604JsehgJAgcu vh9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697380535; x=1697985335; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=r63LwwFwSHY5K3Mui5Tw/+UsnKPvpHtKIPEwzO9jvmI=; b=gputrM6DTo2C36/pyjkYIXMipyGqqepP/N+KZOmdzs0PNqYDZmb82yzeS34FsxE6Xs FYPRkozrxaddrFkqGGhOKyGZHpjAi4FeGlXOn8FxaAX8MSFnj3GVy5uMFAUmoZLk5n/l lJt2TiZRghmYXQhqV7MvkiLmdqQjO8a/0HTq1K9wP3RH1bShEbrUhWpJQWMoPJz/VLT0 hWywELvX4ZpY9fqdXrbSi5ofjYgM4LfGVOArxahzsjkbuNJ9o1qhZLUiNzz16N1w90Z4 HK+Tl7ugkUmtiTmgN9dpGTsYYYM8QIWnDXUwJZjODOICaf1PVgLZv0iARfvflK019Dyv hDDw== X-Gm-Message-State: AOJu0YyV3pcj5MnSWlSV+CaIairuFZPw8TiCtWHbDtrEYydy2KqVTDM1 F3dgYogoZv9WxfnU2O2XtH0= X-Google-Smtp-Source: AGHT+IFcMiI0s091PmH1wMpSvmdp5C0yBtCvh6rJhs3Kb49/AKrszeEYdxqEgaJjhS9eMlwyMy5HAw== X-Received: by 2002:a17:902:ec88:b0:1c9:e2ed:66fe with SMTP id x8-20020a170902ec8800b001c9e2ed66femr8964390plg.52.1697380535542; Sun, 15 Oct 2023 07:35:35 -0700 (PDT) Original-Received: from localhost ([115.240.90.130]) by smtp.gmail.com with ESMTPSA id 13-20020a170902c20d00b001ca4cc783b6sm1546975pll.36.2023.10.15.07.35.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Oct 2023 07:35:35 -0700 (PDT) In-Reply-To: <877cnoc89o.fsf@mailbox.org> (Antero Mejr via's message of "Sun, 15 Oct 2023 13:41:55 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:272518 Archived-At: [=E0=AE=9E=E0=AE=BE=E0=AE=AF=E0=AE=BF=E0=AE=B1=E0=AF=81 =E0=AE=85=E0=AE=95= =E0=AF=8D=E0=AE=9F=E0=AF=8B=E0=AE=AA=E0=AE=B0=E0=AF=8D 15, 2023] Antero Mej= r via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wro= te: > Stefan Kangas writes: > >> I believe it might be better to align with the flags available on >> GNU/Linux, then. Especially considering our larger GNU/Linux user base >> compared to BSD. >> >> It's less cumbersome for users to manually add a missing flag than for >> pcomplete to suggest an incorrect one. > > Sounds good, patch with Linux flags is below. > > From 2e54ecf8714088a1c5cf596edb7cf66bc3468dfe Mon Sep 17 00:00:00 2001 > From: Antero Mejr > Date: Sun, 15 Oct 2023 00:32:57 +0000 > Subject: [PATCH] Add completion for Unix 'doas' command. > > * lisp/pcmpl-unix.el (pcomplete/doas): New procedure. > * etc/NEWS: Announce. (Bug#66551) > --- > etc/NEWS | 4 ++++ > lisp/pcmpl-unix.el | 8 ++++++++ > 2 files changed, 12 insertions(+) > > diff --git a/etc/NEWS b/etc/NEWS > index 3bd47a0112b..d73ec031d85 100644 > --- a/etc/NEWS > +++ b/etc/NEWS > @@ -477,6 +477,10 @@ When this option is non-nil, remote file names are n= ot completed by > Pcomplete. Packages, like 'shell-mode', could set this in order to > suppress remote file name completion at all. >=20=20 > +--- > +*** Completions for the Unix 'doas' command are now provided. > +Command completion for 'doas' in Eshell and Shell mode will now work. > + > ** Shell Mode >=20=20 > +++ > diff --git a/lisp/pcmpl-unix.el b/lisp/pcmpl-unix.el > index e6b67256a4c..0626bc5a890 100644 > --- a/lisp/pcmpl-unix.el > +++ b/lisp/pcmpl-unix.el > @@ -685,6 +685,14 @@ Includes files as well as host names followed by a c= olon." > (funcall (or (pcomplete-find-completion-function (pcomplete-arg 1)) > pcomplete-default-completion-function))) >=20=20 > +;;;###autoload > +(defun pcomplete/doas () > + "Completion for the `doas' command." > + (pcomplete-opt "CLnsu") Could we not provide completion for -u and -C? I have the following function in my init.el: (defun pcomplete/doas () "Completion for the `doas' command." (when (string-prefix-p "-" (pcomplete-arg 0)) (pcomplete-opt "Lnsu(pcmpl-unix-user-names)C(pcomplete-entries nil = #'file-regular-p)")) (funcall pcomplete-command-completion-function) (funcall (or (pcomplete-find-completion-function (pcomplete-arg 1)) pcomplete-default-completion-function))) > + (funcall pcomplete-command-completion-function) > + (funcall (or (pcomplete-find-completion-function (pcomplete-arg 1)) > + pcomplete-default-completion-function))) > + > (provide 'pcmpl-unix) >=20=20 > ;;; pcmpl-unix.el ends here