all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Antero Mejr via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: 66551@debbugs.gnu.org, Visuwesh <visuweshm@gmail.com>
Subject: bug#66551: [PATCH] Add completion for Unix 'doas' command.
Date: Sat, 21 Oct 2023 18:47:09 +0000	[thread overview]
Message-ID: <87r0lnrexe.fsf@mailbox.org> (raw)
In-Reply-To: <CADwFkmkQTJyx6UsUBwfzqNGEmn+vs9Q3bnjJ4OVw+G+=Bb2x+g@mail.gmail.com> (Stefan Kangas's message of "Sat, 21 Oct 2023 03:08:02 -0700")

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

Stefan Kangas <stefankangas@gmail.com> writes:

> Could you send an updated patch based on the above?

Patch is attached.

After some more testing I replaced:
(pcomplete-entries nil #'file-regular-p)
with:
(pcomplete-entries)

because the former makes it difficult to traverse directories to get to
the config file, and I've never seen pcomplete work like that anywhere
else.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-completion-for-Unix-doas-command.patch --]
[-- Type: text/x-patch, Size: 1657 bytes --]

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

Co-authored-by: Visuwesh <visuweshm@gmail.com>
---
 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..7af5f2bce74 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 "C(pcomplete-entries)Lnsu(pcmpl-unix-user-names)")
+  (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
-- 
2.41.0


  reply	other threads:[~2023-10-21 18:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-15  0:39 bug#66551: [PATCH] Add completion for Unix 'doas' command Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-15  7:58 ` Stefan Kangas
2023-10-15 11:29   ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-15 12:55     ` Stefan Kangas
2023-10-15 13:41       ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-15 14:09         ` Stefan Kangas
2023-10-15 14:35         ` Visuwesh
2023-10-15 16:36           ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-21 10:08             ` Stefan Kangas
2023-10-21 18:47               ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-10-22 22:44                 ` Stefan Kangas

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

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

  git send-email \
    --in-reply-to=87r0lnrexe.fsf@mailbox.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=66551@debbugs.gnu.org \
    --cc=antero@mailbox.org \
    --cc=stefankangas@gmail.com \
    --cc=visuweshm@gmail.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.