[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How automatically answer same 2 questions that always pop up for a c
From: |
Chris Seberino |
Subject: |
Re: How automatically answer same 2 questions that always pop up for a certain Emacs command (python-mode's python-shell-send-region command) |
Date: |
Thu, 18 Dec 2014 04:53:57 -0800 (PST) |
User-agent: |
G2/1.0 |
I tried to run the function below in Python mode after binding it to F2
as shown below...
(global-set-key [f2] (lambda () (interactive)
(python-shell-get-or-create-process-noask)
(switch-to-buffer "*Python*")))
When I tried it I got the following error...
Wrong number of arguments: (lambda (old &optional _cmd _dedicated show)
(funcall old (python-shell-parse-command) t show)), 0
On Wednesday, December 10, 2014 3:18:05 PM UTC-6, John Mastro wrote:
> Hi,
>
> Chris Seberino <cseberino@gmail.com> wrote:
> > How automatically answer same 2 questions that always pop up for
> > python-mode's python-shell-send-region command?
> >
> > python-shell-send-region asks for python interpreter to use and
> > question about separate processes. I don't want to always answer that.
> >
> > Thanks!
> >
> > cs
>
> If I understand correctly, I think this will do what you want.
>
> (defun python-shell-get-or-create-process-noask
> (old &optional _cmd _dedicated show)
> (funcall old (python-shell-parse-command) t show))
>
> (advice-add 'python-shell-get-or-create-process
> :around
> #'python-shell-get-or-create-process-noask)
>
> Hope that helps!
>
> --
> john