all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: How to avoid y-or-n-p in a program?
Date: Fri, 14 Mar 2014 12:09:27 -0400	[thread overview]
Message-ID: <jwvbnx8ahra.fsf-monnier+gmane.emacs.help@gnu.org> (raw)
In-Reply-To: 87fvmkq1jw.fsf@gmail.com

> So rather than adding additional function args to the command and using
> something like (when (called-interactively-p) ...) the canonical way
> would be to split the command into a function (probably with additional
> function args) and a command that calls this function (the interactive
> wrapper)?

Yes, when that can be done without too much gymnastics, it's the best option.

> This would be more directed towards Org-mode I think ...
> What if a command/function is overly verbose wrt to messages when used
> in a program? Is it reasonable to ask for including an optional switch
> like this

> (defun xyz (args &optional quiet)
>   (unless quiet
>     (message ...)))

> to be able to suppress all the messages in the function call?

The situation for messages is somewhat similar, although more subtle
because "too many messages" is not as clear cut as "hangs, waiting for
the user to respond".

I think that for messages, the right answer is a more serious redesign
of the messaging system, e.g. such that you can redirect messages
(rather than just silence them), and maybe also do it conditionally on
the "seriousness/urgency" of the message.


        Stefan




  reply	other threads:[~2014-03-14 16:09 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
2014-03-14 14:35     ` Stefan
2014-03-14 14:48       ` Thorsten Jolitz
2014-03-14 16:09         ` Stefan [this message]
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=jwvbnx8ahra.fsf-monnier+gmane.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --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.