unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#49774: 27.1; if diff commands finds no differences then do not pop up a window
@ 2021-07-29 16:59 ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-07-30  1:18 ` Dmitry Gutov
  2021-07-30 18:28 ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 18+ messages in thread
From: ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-07-29 16:59 UTC (permalink / raw)
  To: 49774

[-- Attachment #1: Type: text/plain, Size: 311 bytes --]

When diff exit code is zero and there are no differences then a window pops up showing output like "Diff finished (no differences)" and the user has to dismiss this useless window.

If there are no differences then emacs should just show this in a message instead of popping up a window with not useful content.

[-- Attachment #2: Type: text/html, Size: 354 bytes --]

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

* bug#49774: 27.1; if diff commands finds no differences then do not pop up a window
  2021-07-29 16:59 bug#49774: 27.1; if diff commands finds no differences then do not pop up a window ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-07-30  1:18 ` Dmitry Gutov
  2021-07-30  4:18   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-07-30 18:28 ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 18+ messages in thread
From: Dmitry Gutov @ 2021-07-30  1:18 UTC (permalink / raw)
  To: ndame, 49774

On 29.07.2021 19:59, ndame via Bug reports for GNU Emacs, the Swiss army 
knife of text editors wrote:
> When diff exit code is zero and there are no differences then a window 
> pops up showing output like "Diff finished (no differences)" and the 
> user has to dismiss this useless window.
> 
> If there are no differences then emacs should just show this in a 
> message instead of popping up a window with not useful content.

That would require it to wait until Diff has finished running before 
showing the window. Currently 'M-x diff' works asynchronously, which has 
its benefits.





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

* bug#49774: 27.1; if diff commands finds no differences then do not pop up a window
  2021-07-30  1:18 ` Dmitry Gutov
@ 2021-07-30  4:18   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-07-30 10:03     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 18+ messages in thread
From: ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-07-30  4:18 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 49774

>
> That would require it to wait until Diff has finished running before
> showing the window. Currently 'M-x diff' works asynchronously, which has
> its benefits.

If exit status is zero then diff should restore  the previous window config
automatically and show the message.





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

* bug#49774: 27.1; if diff commands finds no differences then do not pop up a window
  2021-07-30  4:18   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-07-30 10:03     ` Lars Ingebrigtsen
  2021-07-30 11:19       ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 18+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-30 10:03 UTC (permalink / raw)
  To: ndame; +Cc: 49774, Dmitry Gutov

ndame <laszlomail@protonmail.com> writes:

>> That would require it to wait until Diff has finished running before
>> showing the window. Currently 'M-x diff' works asynchronously, which has
>> its benefits.
>
> If exit status is zero then diff should restore  the previous window config
> automatically and show the message.

This is what `M-x man' does (when it turns out that the manual page
doesn't exist), and people really dislike that, too (the "flickering"
has been reported as a bug multiple times).

So I don't think we want to extend that user experience in Emacs.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#49774: 27.1; if diff commands finds no differences then do not pop up a window
  2021-07-30 10:03     ` Lars Ingebrigtsen
@ 2021-07-30 11:19       ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-07-30 11:24         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 18+ messages in thread
From: ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-07-30 11:19 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 49774, Dmitry Gutov


>
> This is what `M-x man' does (when it turns out that the manual page
> doesn't exist), and people really dislike that, too (the "flickering"
> has been reported as a bug multiple times).
>
> So I don't think we want to extend that user experience in Emacs.
>

The other possibility is not popping up the diff window instantly, but
waiting for the first output to arrive. If there is no difference
then no output is coming and exit status 0 tells us we can print the
message.





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

* bug#49774: 27.1; if diff commands finds no differences then do not pop up a window
  2021-07-30 11:19       ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-07-30 11:24         ` Lars Ingebrigtsen
  2021-07-30 11:47           ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 18+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-30 11:24 UTC (permalink / raw)
  To: ndame; +Cc: 49774, Dmitry Gutov

ndame <laszlomail@protonmail.com> writes:

> The other possibility is not popping up the diff window instantly, but
> waiting for the first output to arrive.

That's also been discussed extensively during the M-x man wars, and it's
a horrible UX -- having windows popping up asynchronously at some later
point is disruptive and confusing, so we don't do that.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#49774: 27.1; if diff commands finds no differences then do not pop up a window
  2021-07-30 11:24         ` Lars Ingebrigtsen
@ 2021-07-30 11:47           ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-07-30 11:48             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 18+ messages in thread
From: ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-07-30 11:47 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 49774, Dmitry Gutov

>
> That's also been discussed extensively during the M-x man wars, and it's
> a horrible UX -- having windows popping up asynchronously at some later
> point is disruptive and confusing, so we don't do that.
>

Diff output arrives pretty much instantly, the user does not even lift his
fingers from executing the diff key binding when the beginning of the output is
already there.

And the user expects something to happen when invoking diff, either seeing the
diff or getting the message there is no diff, so waiting for a fraction of a second
before popping up a window is not a real problem, because the user is waiting for the
result anyway.





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

* bug#49774: 27.1; if diff commands finds no differences then do not pop up a window
  2021-07-30 11:47           ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-07-30 11:48             ` Lars Ingebrigtsen
  2021-07-30 11:58               ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 18+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-30 11:48 UTC (permalink / raw)
  To: ndame; +Cc: 49774, Dmitry Gutov

ndame <laszlomail@protonmail.com> writes:

> Diff output arrives pretty much instantly

Depends on many things -- the files may be on remote systems, for
instance.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#49774: 27.1; if diff commands finds no differences then do not pop up a window
  2021-07-30 11:48             ` Lars Ingebrigtsen
@ 2021-07-30 11:58               ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-07-30 12:44                 ` Dmitry Gutov
  0 siblings, 1 reply; 18+ messages in thread
From: ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-07-30 11:58 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 49774

>
> > Diff output arrives pretty much instantly
>
> Depends on many things -- the files may be on remote systems, for
> instance.

Okay, then how about adding a configurable delay before popping up the diff window?
E.g. if no results arrive within, say, 1 second then a timer pops up the
window, so the user knows the diff is in progress, but slow.

This takes care of the slow remote system problem and the timer would practically
never  fire on a local machine where the filesystem response is quick.





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

* bug#49774: 27.1; if diff commands finds no differences then do not pop up a window
  2021-07-30 11:58               ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-07-30 12:44                 ` Dmitry Gutov
  2021-07-30 13:19                   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-07-30 18:47                   ` Lars Ingebrigtsen
  0 siblings, 2 replies; 18+ messages in thread
From: Dmitry Gutov @ 2021-07-30 12:44 UTC (permalink / raw)
  To: ndame, Lars Ingebrigtsen; +Cc: 49774

On 30.07.2021 14:58, ndame via Bug reports for GNU Emacs, the Swiss army 
knife of text editors wrote:
> Okay, then how about adding a configurable delay before popping up the diff window?
> E.g. if no results arrive within, say, 1 second then a timer pops up the
> window, so the user knows the diff is in progress, but slow.

I was going to suggest a user option that switches to the synchronous 
mode of operation, but the above sounds probably even better.

As long as there is someone willing to implement this.





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

* bug#49774: 27.1; if diff commands finds no differences then do not pop up a window
  2021-07-30 12:44                 ` Dmitry Gutov
@ 2021-07-30 13:19                   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-07-30 18:47                   ` Lars Ingebrigtsen
  1 sibling, 0 replies; 18+ messages in thread
From: ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-07-30 13:19 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Lars Ingebrigtsen, 49774


>
> I was going to suggest a user option that switches to the synchronous
> mode of operation, but the above sounds probably even better.

Or there can be an option like  diff-show-window-only-if-difference-exists
which can be nil for the current behavior and t if the user wants to see
no window if there is no difference, just a message.

This may be the simplest solution, because then the user can simply set
it according his working conditions. If he works with remote files he
sets it to nil, if he works with files on his local machine then it can
be set to t.






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

* bug#49774: 27.1; if diff commands finds no differences then do not pop up a window
  2021-07-29 16:59 bug#49774: 27.1; if diff commands finds no differences then do not pop up a window ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-07-30  1:18 ` Dmitry Gutov
@ 2021-07-30 18:28 ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-08-16 18:29   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 18+ messages in thread
From: ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-07-30 18:28 UTC (permalink / raw)
  To: 49774

[-- Attachment #1: Type: text/plain, Size: 534 bytes --]

> If there are no differences then emacs should just show this in a message instead of popping up a window with not useful content.

Just a simple implementation with advices for the time being for those who prefer this:

(advice-add 'diff :around 'my-diff)

(defun my-diff (orig-fun &rest args)
(flet ((display-buffer (buf) buf))
(apply orig-fun args)))

(advice-add 'diff-sentinel :after 'my-diff-sentinel)

(defun my-diff-sentinel (code &rest args)
(if (equal code 0)
(message "No differences.")
(display-buffer (current-buffer))))

[-- Attachment #2: Type: text/html, Size: 1025 bytes --]

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

* bug#49774: 27.1; if diff commands finds no differences then do not pop up a window
  2021-07-30 12:44                 ` Dmitry Gutov
  2021-07-30 13:19                   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-07-30 18:47                   ` Lars Ingebrigtsen
  2021-07-31 21:06                     ` Juri Linkov
  2021-08-02  1:07                     ` Richard Stallman
  1 sibling, 2 replies; 18+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-30 18:47 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: ndame, 49774

Dmitry Gutov <dgutov@yandex.ru> writes:

> I was going to suggest a user option that switches to the synchronous
> mode of operation, but the above sounds probably even better.

A general thing for popping up asynchronous buffers that users can
control?  Yeah, that could be nice.  We could have a user option that
says whether to pop up immediately, later but only on success, always,
run the command synchronously...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#49774: 27.1; if diff commands finds no differences then do not pop up a window
  2021-07-30 18:47                   ` Lars Ingebrigtsen
@ 2021-07-31 21:06                     ` Juri Linkov
  2021-07-31 22:11                       ` Lars Ingebrigtsen
  2021-08-02  1:07                     ` Richard Stallman
  1 sibling, 1 reply; 18+ messages in thread
From: Juri Linkov @ 2021-07-31 21:06 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: ndame, 49774, Dmitry Gutov

>> I was going to suggest a user option that switches to the synchronous
>> mode of operation, but the above sounds probably even better.
>
> A general thing for popping up asynchronous buffers that users can
> control?  Yeah, that could be nice.  We could have a user option that
> says whether to pop up immediately, later but only on success, always,
> run the command synchronously...

Like async-shell-command-display-buffer.





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

* bug#49774: 27.1; if diff commands finds no differences then do not pop up a window
  2021-07-31 21:06                     ` Juri Linkov
@ 2021-07-31 22:11                       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 18+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-31 22:11 UTC (permalink / raw)
  To: Juri Linkov; +Cc: ndame, 49774, Dmitry Gutov

Juri Linkov <juri@linkov.net> writes:

>> A general thing for popping up asynchronous buffers that users can
>> control?  Yeah, that could be nice.  We could have a user option that
>> says whether to pop up immediately, later but only on success, always,
>> run the command synchronously...
>
> Like async-shell-command-display-buffer.

Right.  Only...  more.  :-)  (And more general.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#49774: 27.1; if diff commands finds no differences then do not pop up a window
  2021-07-30 18:47                   ` Lars Ingebrigtsen
  2021-07-31 21:06                     ` Juri Linkov
@ 2021-08-02  1:07                     ` Richard Stallman
  2022-08-22 10:30                       ` Lars Ingebrigtsen
  1 sibling, 1 reply; 18+ messages in thread
From: Richard Stallman @ 2021-08-02  1:07 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: laszlomail, 49774, dgutov

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > A general thing for popping up asynchronous buffers that users can
  > control?  Yeah, that could be nice.  We could have a user option that
  > says whether to pop up immediately, later but only on success, always,
  > run the command synchronously...

New options like this provide an unending opportunity for increased
featurism, and can make some operations more convenient for some users.
But they won't extend the actual jobs that Emacs can handle.

Those changes are the substantial improvements, so I ask people to
focus their efforts on changes of that kind.


-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







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

* bug#49774: 27.1; if diff commands finds no differences then do not pop up a window
  2021-07-30 18:28 ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-08-16 18:29   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 18+ messages in thread
From: ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-08-16 18:29 UTC (permalink / raw)
  To: 49774

[-- Attachment #1: Type: text/plain, Size: 1212 bytes --]

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, July 30th, 2021 at 8:28 PM, ndame <laszlomail@protonmail.com> wrote:

>> If there are no differences then emacs should just show this in a message instead of popping up a window with not useful content.
>
> Just a simple implementation with advices for the time being for those who prefer this:
>
> (advice-add 'diff :around 'my-diff)
>
> (defun my-diff (orig-fun &rest args)
> (flet ((display-buffer (buf) buf))
> (apply orig-fun args)))
>
> (advice-add 'diff-sentinel :after 'my-diff-sentinel)
>
> (defun my-diff-sentinel (code &rest args)
> (if (equal code 0)
> (message "No differences.")
> (display-buffer (current-buffer))))

The permanent sentinel advice affects non-interactive diffs too (diff-no-select), so a better solution is to add and remove that advice on demand:

(advice-add 'diff :around 'my-diff)

(defun my-diff (orig-fun &rest args)
(advice-add 'diff-sentinel :after 'my-diff-sentinel)
(flet ((display-buffer (buf) buf))
(apply orig-fun args)))

(defun my-diff-sentinel (code &rest args)
(advice-remove 'diff-sentinel 'my-diff-sentinel)
(if (equal code 0)
(message "No differences.")
(display-buffer (current-buffer))))

[-- Attachment #2: Type: text/html, Size: 2217 bytes --]

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

* bug#49774: 27.1; if diff commands finds no differences then do not pop up a window
  2021-08-02  1:07                     ` Richard Stallman
@ 2022-08-22 10:30                       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 18+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-22 10:30 UTC (permalink / raw)
  To: Richard Stallman; +Cc: laszlomail, 49774, dgutov

Richard Stallman <rms@gnu.org> writes:

> New options like this provide an unending opportunity for increased
> featurism, and can make some operations more convenient for some users.
> But they won't extend the actual jobs that Emacs can handle.

I agree.  This is working as we intend this to work, and people that
prefer Emacs to do something else here can do that with an advice.

So I'm closing this bug report.





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

end of thread, other threads:[~2022-08-22 10:30 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29 16:59 bug#49774: 27.1; if diff commands finds no differences then do not pop up a window ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-30  1:18 ` Dmitry Gutov
2021-07-30  4:18   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-30 10:03     ` Lars Ingebrigtsen
2021-07-30 11:19       ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-30 11:24         ` Lars Ingebrigtsen
2021-07-30 11:47           ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-30 11:48             ` Lars Ingebrigtsen
2021-07-30 11:58               ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-30 12:44                 ` Dmitry Gutov
2021-07-30 13:19                   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-30 18:47                   ` Lars Ingebrigtsen
2021-07-31 21:06                     ` Juri Linkov
2021-07-31 22:11                       ` Lars Ingebrigtsen
2021-08-02  1:07                     ` Richard Stallman
2022-08-22 10:30                       ` Lars Ingebrigtsen
2021-07-30 18:28 ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-16 18:29   ` ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors

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).