all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How automatically answer same 2 questions that always pop up for a certain Emacs command (python-mode's python-shell-send-region command)
@ 2014-12-10 17:00 Chris Seberino
  2014-12-10 21:17 ` John Mastro
       [not found] ` <mailman.15796.1418246283.1147.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Seberino @ 2014-12-10 17:00 UTC (permalink / raw)
  To: help-gnu-emacs

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


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

* Re: How automatically answer same 2 questions that always pop up for a certain Emacs command (python-mode's python-shell-send-region command)
  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>
  1 sibling, 0 replies; 3+ messages in thread
From: John Mastro @ 2014-12-10 21:17 UTC (permalink / raw)
  To: Chris Seberino; +Cc: help-gnu-emacs@gnu.org

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



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

* Re: How automatically answer same 2 questions that always pop up for a certain Emacs command (python-mode's python-shell-send-region command)
       [not found] ` <mailman.15796.1418246283.1147.help-gnu-emacs@gnu.org>
@ 2014-12-18 12:53   ` Chris Seberino
  0 siblings, 0 replies; 3+ messages in thread
From: Chris Seberino @ 2014-12-18 12:53 UTC (permalink / raw)
  To: help-gnu-emacs

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


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

end of thread, other threads:[~2014-12-18 12:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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.