help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to avoid y-or-n-p in a program?


From: Stefan
Subject: Re: How to avoid y-or-n-p in a program?
Date: Fri, 14 Mar 2014 12:09:27 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]