[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#16197: 24.3.50; no completion on commands following "sudo" in shell
From: |
Thierry Volpiatto |
Subject: |
bug#16197: 24.3.50; no completion on commands following "sudo" in shell and eshell |
Date: |
Mon, 23 Dec 2013 11:21:59 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:
> With this I have completion on arguments of commands entered after
> "sudo" (only in eshell though, not shell for the moment) and emacs is
> not crashing when hitting TAB.
Now I have the completion in shell also, for this
`shell-command-completion' have to be redefined.
--8<---------------cut here---------------start------------->8---
(defun shell-command-completion ()
"Return the completion data for the command at point, if any."
(let ((filename (comint-match-partial-filename))
(args (split-string
(buffer-substring-no-properties
(point) (save-excursion (shell-backward-command 1) (point))))))
(if (and filename
(save-match-data (not (string-match "[~/]" filename)))
(and (string= (car args) "sudo")
(string= filename (cadr args))))
(shell--command-completion-data))))
--8<---------------cut here---------------end--------------->8---
HTH, though the crash happening above should not happen.
--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997