all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How to avoid y-or-n-p in a program?
Date: Fri, 14 Mar 2014 15:26:43 +0100	[thread overview]
Message-ID: <87mwgsq2jg.fsf@gmail.com> (raw)
In-Reply-To: jwvr4672sl9.fsf-monnier+gmane.emacs.help@gnu.org

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> when in a program function A calls another (external) function B that
>> asks the user a y-or-n-p question, and you want to avoid that and
>> instead code in function A that the answer is always Y, so that the
>> prompt never shows up - how do you do that?
>
> The recommended way:
> - change B so that it doesn't call y-or-n-p unconditionally.
> - change A to adjust to the new behavior of B.

Is it generally considered a (kind of) bug when a COMMAND (not a
function) calls y-or-n-p unconditionally (or enforces user input in
other ways)?

Enforcing user interaction (and lack of function arguments) makes
(re)using such commands in programs quite difficult, but maybe they are
not intended for that anyway?

Would the "recommended way" be applied in this case too? Should one
rather patch the called command B instead of looking for a workaround on
the calling side?

-- 
cheers,
Thorsten




  parent reply	other threads:[~2014-03-14 14:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-12 15:37 How to avoid y-or-n-p in a program? Thorsten Jolitz
2014-03-12 16:14 ` Tassilo Horn
2014-03-12 16:50   ` Juanma Barranquero
2014-03-12 18:14 ` Stefan Monnier
2014-03-12 22:31   ` Thorsten Jolitz
2014-03-14 14:26   ` Thorsten Jolitz [this message]
2014-03-14 14:35     ` Stefan
2014-03-14 14:48       ` Thorsten Jolitz
2014-03-14 16:09         ` Stefan
2014-03-14 17:21           ` Thorsten Jolitz

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=87mwgsq2jg.fsf@gmail.com \
    --to=tjolitz@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.