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: Antero Mejr
Subject: bug#66551: [PATCH] Add completion for Unix 'doas' command.
Date: Sun, 15 Oct 2023 16:36:52 +0000

Visuwesh <visuweshm@gmail.com> writes:

> 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)))
>

Thanks, that is better. However the -C file completion doesn't work for
me unless I reorder the pcomplete-opt flags like this:

;;;###autoload
(defun pcomplete/doas ()
  "Completion for the `doas' command."
  (pcomplete-opt
   "C(pcomplete-entries nil #'file-regular-p)Lnsu(pcmpl-unix-user-names)")
  (funcall pcomplete-command-completion-function)
  (funcall (or (pcomplete-find-completion-function (pcomplete-arg 1))
               pcomplete-default-completion-function)))

The above also lets pcomplete-opt handle the '-' prefix. WDYT?





reply via email to

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