unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50125: completion-in-region in shell.el
@ 2021-08-19 15:52 Madhu
  2021-08-19 16:03 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Madhu @ 2021-08-19 15:52 UTC (permalink / raw)
  To: 50125

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


In a *shell* buffer, if I position the cursor after typing "pass"
and invoke M-: (shell-dynamic-completion-command),

this should yield a completion "passwd" if /bin is in exec-path.
However it errors out with

error: (wrong-number-of-arguments (3 . 4) 5)
  completion-in-region(484 486 #f(compiled-function (string pred action) #<bytecode -0x6e453bfcd314ab>) :exit-function #f(compiled-function (string finished) #<bytecode -0x9a98b1a3de78800>))
  apply(completion-in-region (484 486 #f(compiled-function (string pred action) #<bytecode -0x6e453bfcd314ab>) :exit-function #f(compiled-function (string finished) #<bytecode -0x9a98b1a3de78800>)))
  shell-dynamic-complete-command()
  eval((shell-dynamic-complete-command) t)
  eval-expression((shell-dynamic-complete-command) nil nil 127)
  funcall-interactively(eval-expression (shell-dynamic-complete-command) nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

The completion data functions shell-environment-variable-completion and
shell-command-completion include an :exit-function keyword value pair in
the result. But this cannot be passed on to completion-in-region.  (How
is this exit-function to be used at all?)

Commit e71564921ec760638105c910fdfae8b648724130 fixed similar issues in
comint.el, and probably missed shell.el during that pass


* lisp/shell.el (shell-dynamic-complete-command)
(shell-dynamic-complete-environment-variable): Correctly call
completion-in-region.



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: shell-dynamic-complete-fix.patch --]
[-- Type: text/x-diff, Size: 1216 bytes --]

From 913b77f13b5d2a7cb3e91d0c057ea3321740f845 Mon Sep 17 00:00:00 2001
From: Madhu <enometh@net.meer>
Date: Thu, 19 Aug 2021 20:57:48 +0530
Subject: [PATCH] * lisp/shell.el (shell-dynamic-complete-command)
 (shell-dynamic-complete-environment-variable): Correctly call
 completion-in-region.

---
 lisp/shell.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/shell.el b/lisp/shell.el
index 292f267d2e..5cdc0385a6 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -1199,7 +1199,7 @@ shell-dynamic-complete-command
     (if data
 	(prog2 (unless (window-minibuffer-p)
 		 (message "Completing command name..."))
-	    (apply #'completion-in-region data)))))
+            (completion-in-region (nth 0 data) (nth 1 data) (nth 2 data))))))
 
 (defun shell-command-completion ()
   "Return the completion data for the command at point, if any."
@@ -1314,7 +1314,7 @@ shell-dynamic-complete-environment-variable
     (if data
 	(prog2 (unless (window-minibuffer-p)
 		 (message "Completing variable name..."))
-	    (apply #'completion-in-region data)))))
+	    (completion-in-region (nth 0 data) (nth 1 data) (nth 2 data))))))
 
 
 (defun shell-environment-variable-completion ()
-- 
2.31.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#50125: completion-in-region in shell.el
  2021-08-19 15:52 bug#50125: completion-in-region in shell.el Madhu
@ 2021-08-19 16:03 ` Lars Ingebrigtsen
  2021-08-20  1:14   ` Madhu
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-19 16:03 UTC (permalink / raw)
  To: Madhu; +Cc: 50125

Madhu <enometh@meer.net> writes:

> Subject: [PATCH] * lisp/shell.el (shell-dynamic-complete-command)
>  (shell-dynamic-complete-environment-variable): Correctly call
>  completion-in-region.

Thanks; applied to Emacs 28.

This change (including the previous one) was small enough to apply
without assigning copyright to the FSF.

I forget whether I've asked you before -- for future patches you want
to submit, it might make sense to get the paperwork started now, so that
subsequent patches can be applied speedily.  Would you be willing to sign
such paperwork?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#50125: completion-in-region in shell.el
  2021-08-19 16:03 ` Lars Ingebrigtsen
@ 2021-08-20  1:14   ` Madhu
  2021-08-20 12:07     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Madhu @ 2021-08-20  1:14 UTC (permalink / raw)
  To: larsi; +Cc: 50125

*  Lars Ingebrigtsen <larsi@gnus.org> <874kbl4e2a.fsf@gnus.org>
Wrote on Thu, 19 Aug 2021 18:03:25 +0200
> Thanks; applied to Emacs 28.

Thanks

> This change (including the previous one) was small enough to apply
> without assigning copyright to the FSF.
>
> I forget whether I've asked you before -- for future patches you
> want to submit, it might make sense to get the paperwork started
> now, so that subsequent patches can be applied speedily.  Would you
> be willing to sign such paperwork?

Yes of course. Although I don't have any substantial contribution
lined up right now, and I'd have to check the terms - (Gentoo wouln't
let me sign off on commits as "Madhu <enometh@meer.net>" but insisted
on a full name)





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#50125: completion-in-region in shell.el
  2021-08-20  1:14   ` Madhu
@ 2021-08-20 12:07     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-20 12:07 UTC (permalink / raw)
  To: Madhu; +Cc: 50125

Madhu <enometh@meer.net> writes:

> Yes of course. Although I don't have any substantial contribution
> lined up right now, and I'd have to check the terms - (Gentoo wouln't
> let me sign off on commits as "Madhu <enometh@meer.net>" but insisted
> on a full name)

Great; the form to get started is below.

(It is my understanding that the FSF needs to have your real name on
file, but it's fine to use an alias in the commit messages.  The
copyright clerk can answer any questions you may have in this area.)



Please email the following information to assign@gnu.org, and we
will send you the assignment form for your past and future changes.

Please use your full legal name (in ASCII characters) as the subject
line of the message.
----------------------------------------------------------------------
REQUEST: SEND FORM FOR PAST AND FUTURE CHANGES

[What is the name of the program or package you're contributing to?]
Emacs

[Did you copy any files or text written by someone else in these changes?
Even if that material is free software, we need to know about it.]

[Do you have an employer who might have a basis to claim to own
your changes?  Do you attend a school which might make such a claim?]

[For the copyright registration, what country are you a citizen of?]

[What year were you born?]

[Please write your email address here.]

[Please write your postal address here.]

[Which files have you changed so far, and which new files have you written
so far?]





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-20 12:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19 15:52 bug#50125: completion-in-region in shell.el Madhu
2021-08-19 16:03 ` Lars Ingebrigtsen
2021-08-20  1:14   ` Madhu
2021-08-20 12:07     ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).