unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#9557: 24.0.50; "y-or-n-p" does not clear the echo area
@ 2011-09-20  9:19 Dani Moncayo
  2011-09-20  9:38 ` Andreas Schwab
  2011-09-20 10:00 ` Eli Zaretskii
  0 siblings, 2 replies; 9+ messages in thread
From: Dani Moncayo @ 2011-09-20  9:19 UTC (permalink / raw)
  To: 9557

Hi,

In my init file, I have `(fset 'yes-or-no-p 'y-or-n-p)' in order to
speed up the "yes/no" answers.  But I've just seen a minor problem
associated to it.

From "emacs -Q":
1. Eval: (fset 'yes-or-no-p 'y-or-n-p)
2. Visit some file.
3. M-x revert-buffer <RET> y
--> (Expected) The echo area ends up empty (as happens if you omit step #1).
--> (Observed) The echo area remains with a residual text "Revert
buffer from file <your-file>? (y or n)  y".


In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
 of 2011-09-12 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.5) --no-opt'

-- 
Dani Moncayo





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

* bug#9557: 24.0.50; "y-or-n-p" does not clear the echo area
  2011-09-20  9:19 bug#9557: 24.0.50; "y-or-n-p" does not clear the echo area Dani Moncayo
@ 2011-09-20  9:38 ` Andreas Schwab
  2011-09-20  9:43   ` Dani Moncayo
  2011-09-20 10:00 ` Eli Zaretskii
  1 sibling, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2011-09-20  9:38 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: 9557

Dani Moncayo <dmoncayo@gmail.com> writes:

> 1. Eval: (fset 'yes-or-no-p 'y-or-n-p)
> 2. Visit some file.
> 3. M-x revert-buffer <RET> y
> --> (Expected) The echo area ends up empty (as happens if you omit step #1).

Since yes-or-no-p doesn't use the echo area (it uses the minibuffer) you
cannot compare it with y-or-n-p.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





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

* bug#9557: 24.0.50; "y-or-n-p" does not clear the echo area
  2011-09-20  9:38 ` Andreas Schwab
@ 2011-09-20  9:43   ` Dani Moncayo
  2011-09-20 10:02     ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Dani Moncayo @ 2011-09-20  9:43 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 9557

> Since yes-or-no-p doesn't use the echo area (it uses the minibuffer) you
> cannot compare it with y-or-n-p.

The question is: from an user POV, is there a way to achieve the
behavior I want (short answers), without the "residual text" problem?

-- 
Dani Moncayo





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

* bug#9557: 24.0.50; "y-or-n-p" does not clear the echo area
  2011-09-20  9:19 bug#9557: 24.0.50; "y-or-n-p" does not clear the echo area Dani Moncayo
  2011-09-20  9:38 ` Andreas Schwab
@ 2011-09-20 10:00 ` Eli Zaretskii
  2011-09-20 10:27   ` Dani Moncayo
  1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2011-09-20 10:00 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: 9557

> Date: Tue, 20 Sep 2011 11:19:54 +0200
> From: Dani Moncayo <dmoncayo@gmail.com>
> 
> 1. Eval: (fset 'yes-or-no-p 'y-or-n-p)
> 2. Visit some file.
> 3. M-x revert-buffer <RET> y
> --> (Expected) The echo area ends up empty (as happens if you omit step #1).
> --> (Observed) The echo area remains with a residual text "Revert
> buffer from file <your-file>? (y or n)  y".

y-or-n-p deliberately displays the prompt with your response before it
returns to the caller, see the source.  It does that because
otherwise you would not have a chance of observing your response.





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

* bug#9557: 24.0.50; "y-or-n-p" does not clear the echo area
  2011-09-20  9:43   ` Dani Moncayo
@ 2011-09-20 10:02     ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2011-09-20 10:02 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: schwab, 9557

> Date: Tue, 20 Sep 2011 11:43:41 +0200
> From: Dani Moncayo <dmoncayo@gmail.com>
> Cc: 9557@debbugs.gnu.org
> 
> The question is: from an user POV, is there a way to achieve the
> behavior I want (short answers), without the "residual text" problem?

If you really don't want to see your response, write your own function
that calls y-or-n-p, clears the echo area (by displaying an empty
message), then returns the value returned by y-or-n-p.





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

* bug#9557: 24.0.50; "y-or-n-p" does not clear the echo area
  2011-09-20 10:00 ` Eli Zaretskii
@ 2011-09-20 10:27   ` Dani Moncayo
  2011-09-20 16:54     ` Juri Linkov
  0 siblings, 1 reply; 9+ messages in thread
From: Dani Moncayo @ 2011-09-20 10:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 9557

> y-or-n-p deliberately displays the prompt with your response before it
> returns to the caller, see the source.  It does that because
> otherwise you would not have a chance of observing your response.

Ah, ok.

In my case, I find that echo a bit unnecessary/disconcerting (hence
this bug report).

What about adding a variable to control that echo (with default value
"on", to keep the current behavior untouched)?

-- 
Dani Moncayo





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

* bug#9557: 24.0.50; "y-or-n-p" does not clear the echo area
  2011-09-20 10:27   ` Dani Moncayo
@ 2011-09-20 16:54     ` Juri Linkov
  2011-09-20 17:47       ` Dani Moncayo
  0 siblings, 1 reply; 9+ messages in thread
From: Juri Linkov @ 2011-09-20 16:54 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: 9557

>> y-or-n-p deliberately displays the prompt with your response before it
>> returns to the caller, see the source.  It does that because
>> otherwise you would not have a chance of observing your response.
>
> Ah, ok.
>
> In my case, I find that echo a bit unnecessary/disconcerting (hence
> this bug report).
>
> What about adding a variable to control that echo (with default value
> "on", to keep the current behavior untouched)?

You can put in your .emacs:

(defadvice y-or-n-p (around y-or-n-p act)
  (let ((answer ad-do-it))
    (message "")
    answer))





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

* bug#9557: 24.0.50; "y-or-n-p" does not clear the echo area
  2011-09-20 16:54     ` Juri Linkov
@ 2011-09-20 17:47       ` Dani Moncayo
  2011-09-20 18:16         ` Juri Linkov
  0 siblings, 1 reply; 9+ messages in thread
From: Dani Moncayo @ 2011-09-20 17:47 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 9557

>> In my case, I find that echo a bit unnecessary/disconcerting (hence
>> this bug report).
>>
>> What about adding a variable to control that echo (with default value
>> "on", to keep the current behavior untouched)?
>
> You can put in your .emacs:
>
> (defadvice y-or-n-p (around y-or-n-p act)
>  (let ((answer ad-do-it))
>    (message "")
>    answer))
>

Thanks, Juri.  It works fine.  I'll use it.

I was going to propose another (more flexible) alternative: Instead of
storing a boolean value in a variable (to switch echoing on/off),
store a time delay, after which the echoed text would be removed (if
was not already removed by another event).  A value of 0 would mean
"don't echo", and a value greater that some limit would mean "never
remove" (as now).

But if no one else thinks that this change is worthwhile, you can
close this bug report.

Thanks again.

-- 
Dani Moncayo





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

* bug#9557: 24.0.50; "y-or-n-p" does not clear the echo area
  2011-09-20 17:47       ` Dani Moncayo
@ 2011-09-20 18:16         ` Juri Linkov
  0 siblings, 0 replies; 9+ messages in thread
From: Juri Linkov @ 2011-09-20 18:16 UTC (permalink / raw)
  To: Dani Moncayo; +Cc: 9557-done

tags 9557 notabug wontfix
thanks

> But if no one else thinks that this change is worthwhile, you can
> close this bug report.

I doubt that anyone might want to miss information about the incorrect answer.
IOW, more information is better than less information.





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

end of thread, other threads:[~2011-09-20 18:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-20  9:19 bug#9557: 24.0.50; "y-or-n-p" does not clear the echo area Dani Moncayo
2011-09-20  9:38 ` Andreas Schwab
2011-09-20  9:43   ` Dani Moncayo
2011-09-20 10:02     ` Eli Zaretskii
2011-09-20 10:00 ` Eli Zaretskii
2011-09-20 10:27   ` Dani Moncayo
2011-09-20 16:54     ` Juri Linkov
2011-09-20 17:47       ` Dani Moncayo
2011-09-20 18:16         ` Juri Linkov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).