all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Phil Sainty <psainty@orcon.net.nz>
To: Eli Zaretskii <eliz@gnu.org>
Cc: rudalics@gmx.at, emacs-devel@gnu.org
Subject: Re: 27.0.50: How can I test a buffer-local window-configuration-change-hook in batch mode?
Date: Sun, 27 Oct 2019 02:09:30 +1300	[thread overview]
Message-ID: <86c669a1-8cd5-3819-1291-4eaaa389ef3d@orcon.net.nz> (raw)
In-Reply-To: <83d0ejvj91.fsf@gnu.org>

On 27/10/19 12:28 AM, Eli Zaretskii wrote:
> Looks like the problem was specifically with setting the buffer
> read-only?  Why does so-long do that?

The reasoning for this default was that *editing* a long line might
be slow, and in the sorts of files which I was expecting so-long to
trigger for, the user probably doesn't want to be manually editing
them; so this is to protect against the user accidentally modifying
the line (and probably then needing to undo it), all while Emacs is
responding more slowly than usual.

The particular issue raised was certainly with the read-only state,
but it did make me think that other issues might well be possible,
and that NOT messing with invisible buffers would be a much safer
(and much less surprising) default behaviour from the point of view
of other libraries doing automated things to files behind the scenes.

(It's configurable, so the original approach can be restored if users
choose to.)


>> I don't think long lines pose any performance problems in buffers
>> which are never displayed
> 
> You are wrong: it will cause problems in any function that uses the
> display code, even if nothing is displayed.  For example,
> vertical-motion, next-line, posn-at-point, etc. all use the display
> code internally.

I'll have to have a play.

My initial feeling is that the *potential* to break such background
processing (which is liable to be hidden from the user) by triggering
so-long is a more significant risk than the potential for background
processing to run slowly because of long lines; so I'm still leaning
towards using the "visible buffers only" approach as the preferable
compromise here.


>> I've not been able to spot any down-sides to the change, so I'm pretty
>> sure it's the right thing to do.
> 
> Well, one downside is that you now need to use a hook that was not
> really meant for that, or we'd need to introduce yet another hook.
> Which is perfectly OK, as long as we are sure there's no simpler
> solution, one that uses existing facilities.

I think it's quite a nice use of the hook, to be honest (even if it's
not a use-case that was originally envisaged).  I was very pleased
when I realised how very simple and efficient this approach was.  The
behaviour I wanted arises almost effortlessly from setting a single
buffer-local value.  I definitely didn't see that as a downside.


>> Running the hook explicitly in my test may not be the same thing as
>> redisplay running it; but then the thing I'm really testing is that
>> when the hook runs, so-long does its thing
> 
> And you cannot test that by calling the hook function directly?  Why
> not?

Do you mean, in the case where I have done this...

(add-hook 'window-configuration-change-hook #'so-long nil :local)

...that my test could just call `so-long' directly, rather than
running the hook?

If I did that, the test would really be redundant.  It certainly
wouldn't be testing any part of the new behaviour.  Other existing
tests already assert what happens when `so-long' is called directly.
The entire purpose of this test was to confirm that `so-long' gets
called *in*directly.


-Phil



  parent reply	other threads:[~2019-10-26 13:09 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24 10:50 27.0.50: How can I test a buffer-local window-configuration-change-hook in batch mode? Phil Sainty
2019-10-24 14:23 ` Eli Zaretskii
2019-10-24 23:53   ` Phil Sainty
2019-10-25  8:37     ` Eli Zaretskii
2019-10-25  9:20       ` martin rudalics
2019-10-25  9:34         ` Eli Zaretskii
2019-10-26  7:49           ` martin rudalics
2019-10-26  9:08             ` Eli Zaretskii
2019-10-25 10:31       ` Phil Sainty
2019-10-25 12:42         ` Eli Zaretskii
2019-10-25 12:53           ` Stefan Monnier
2019-10-25 13:57             ` Eli Zaretskii
2019-10-25 15:27               ` Stefan Monnier
2019-10-25 18:41                 ` Eli Zaretskii
2019-10-26 12:33               ` Lars Ingebrigtsen
2019-10-26 12:53                 ` Eli Zaretskii
2019-10-26 13:13                   ` Lars Ingebrigtsen
2019-10-26 13:33                     ` Eli Zaretskii
2019-10-26 13:50                       ` Lars Ingebrigtsen
2019-10-26 14:34                         ` Eli Zaretskii
2019-10-26 14:45                           ` Lars Ingebrigtsen
2019-10-26 15:07                             ` Eli Zaretskii
2019-10-25 13:16           ` Phil Sainty
2019-10-25 13:44             ` Eli Zaretskii
2019-10-25  8:51     ` martin rudalics
2019-10-25 10:54       ` Phil Sainty
2019-10-26  7:49         ` martin rudalics
2019-10-26  9:07           ` Eli Zaretskii
2019-10-26 10:57             ` Phil Sainty
2019-10-26 11:28               ` Eli Zaretskii
2019-10-26 12:11                 ` Stefan Monnier
2019-10-26 12:32                   ` Eli Zaretskii
2019-10-26 15:59                     ` Stefan Monnier
2019-10-26 16:28                       ` Eli Zaretskii
2019-10-26 17:14                         ` Stefan Monnier
2019-10-26 17:35                           ` Eli Zaretskii
2019-10-26 19:53                             ` Stefan Monnier
2019-10-26 20:18                               ` Eli Zaretskii
2019-10-26 13:09                 ` Phil Sainty [this message]
2019-10-26 13:31                   ` Eli Zaretskii
2019-10-26 12:05           ` Stefan Monnier
2019-10-27  7:49             ` martin rudalics
2019-10-27 17:40               ` Stefan Monnier
2019-10-28  9:39                 ` martin rudalics
2019-11-10  3:50                   ` so-long.el updates (was Re: 27.0.50: How can I test a buffer-local window-configuration-change-hook in batch mode?) Phil Sainty

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=86c669a1-8cd5-3819-1291-4eaaa389ef3d@orcon.net.nz \
    --to=psainty@orcon.net.nz \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=rudalics@gmx.at \
    /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.