all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chris Seberino <cseberino@gmail.com>
To: help-gnu-emacs@gnu.org
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)	[thread overview]
Message-ID: <bd4e24ab-3328-4c6b-81c1-b80bcd478ac7@googlegroups.com> (raw)
In-Reply-To: <mailman.15796.1418246283.1147.help-gnu-emacs@gnu.org>

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


      parent reply	other threads:[~2014-12-18 12:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-10 17:00 How automatically answer same 2 questions that always pop up for a certain Emacs command (python-mode's python-shell-send-region command) Chris Seberino
2014-12-10 21:17 ` John Mastro
     [not found] ` <mailman.15796.1418246283.1147.help-gnu-emacs@gnu.org>
2014-12-18 12:53   ` Chris Seberino [this message]

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=bd4e24ab-3328-4c6b-81c1-b80bcd478ac7@googlegroups.com \
    --to=cseberino@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.