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

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

bug#66551: [PATCH] Add completion for Unix 'doas' command.


From: Visuwesh
Subject: bug#66551: [PATCH] Add completion for Unix 'doas' command.
Date: Sun, 15 Oct 2023 20:05:32 +0530
User-agent: Gnus/5.13 (Gnus v5.13)

[ஞாயிறு அக்டோபர் 15, 2023] Antero Mejr via "Bug reports for GNU Emacs, the 
Swiss army knife of text editors" wrote:

> Stefan Kangas <stefankangas@gmail.com> 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 <antero@mailbox.org>
> 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 not 
> completed by
>  Pcomplete.  Packages, like 'shell-mode', could set this in order to
>  suppress remote file name completion at all.
>  
> +---
> +*** Completions for the Unix 'doas' command are now provided.
> +Command completion for 'doas' in Eshell and Shell mode will now work.
> +
>  ** Shell Mode
>  
>  +++
> 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 
> colon."
>    (funcall (or (pcomplete-find-completion-function (pcomplete-arg 1))
>              pcomplete-default-completion-function)))
>  
> +;;;###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)
>  
>  ;;; pcmpl-unix.el ends here





reply via email to

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