[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to avoid y-or-n-p in a program?
From: |
Thorsten Jolitz |
Subject: |
Re: How to avoid y-or-n-p in a program? |
Date: |
Fri, 14 Mar 2014 18:21:21 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Stefan <monnier@iro.umontreal.ca> writes:
>> 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.
I remember that this was discussed not so long ago and seems to be
something that would really benefit Emacs as a whole.
PS
BTW, just recently I asked if there is a logging system for PicoLisp,
and someone implemented a quite useful one with only 45 lines of code or
so (http://beneroth.ch/pil/log.l).
--
cheers,
Thorsten