unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* pixel-point-and-height-at-unseen-line
@ 2021-11-27  6:51 Eli Zaretskii
  2021-11-27  6:57 ` pixel-point-and-height-at-unseen-line Po Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2021-11-27  6:51 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

This function has several problems that IMO would be good to clean up:

 . It's unnecessarily restricted to a very special use case: a single
   screen line above the one where window-start is.  It could be much
   more useful (and be moved to subr.el or simple.el) if it could at
   least accept an argument to control on which line or position to
   report.

 . It changes important state variables without protecting itself from
   errors and non-local exits, so a C-g at an opportune time will
   disrupt the buffer/window state.

 . It calls vertical-motion without checking its return value, which
   could tell you whether it actually moved at all, and where.  (One
   bonus of checking the return value is that you could perhaps drop
   the bobp test there.)  vertical-motion can do some surprising
   things around overlays and display properties, especially ones that
   include newlines in their strings.

Thanks.



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

* Re: pixel-point-and-height-at-unseen-line
  2021-11-27  6:51 pixel-point-and-height-at-unseen-line Eli Zaretskii
@ 2021-11-27  6:57 ` Po Lu
  2021-11-27  7:18   ` pixel-point-and-height-at-unseen-line Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Po Lu @ 2021-11-27  6:57 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> This function has several problems that IMO would be good to clean up:
>
>  . It's unnecessarily restricted to a very special use case: a single
>    screen line above the one where window-start is.  It could be much
>    more useful (and be moved to subr.el or simple.el) if it could at
>    least accept an argument to control on which line or position to
>    report.
>
>  . It changes important state variables without protecting itself from
>    errors and non-local exits, so a C-g at an opportune time will
>    disrupt the buffer/window state.
>
>  . It calls vertical-motion without checking its return value, which
>    could tell you whether it actually moved at all, and where.  (One
>    bonus of checking the return value is that you could perhaps drop
>    the bobp test there.)  vertical-motion can do some surprising
>    things around overlays and display properties, especially ones that
>    include newlines in their strings.
>
> Thanks.

I'll look into that.  I did not write that function, I only modified it
(and moved it) so I could reuse the code there in for precision pixel
scrolling.

Thanks.



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

* Re: pixel-point-and-height-at-unseen-line
  2021-11-27  6:57 ` pixel-point-and-height-at-unseen-line Po Lu
@ 2021-11-27  7:18   ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2021-11-27  7:18 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Sat, 27 Nov 2021 14:57:06 +0800
> 
> I did not write that function, I only modified it

Then I guess my mail is addressed to "whomever is interested" ;-)

Thanks.



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

end of thread, other threads:[~2021-11-27  7:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-27  6:51 pixel-point-and-height-at-unseen-line Eli Zaretskii
2021-11-27  6:57 ` pixel-point-and-height-at-unseen-line Po Lu
2021-11-27  7:18   ` pixel-point-and-height-at-unseen-line Eli Zaretskii

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