unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Is there any particular reason `scroll-other-window' is written in C and not in ELisp?
@ 2015-12-29  9:32 Marcin Borkowski
  2015-12-29 16:02 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Marcin Borkowski @ 2015-12-29  9:32 UTC (permalink / raw)
  To: Emacs Development

The reason I'm asking is that C-M-v (and C-M-S-v, for that matter) do
the wrong thing if the other window shows a pdf file using pdf-tools.
If those commands were written in Elisp, I could not only advise them
(which I can, and probably will), but also propose a patch or
something.

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



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

* Re: Is there any particular reason `scroll-other-window' is written in C and not in ELisp?
  2015-12-29  9:32 Is there any particular reason `scroll-other-window' is written in C and not in ELisp? Marcin Borkowski
@ 2015-12-29 16:02 ` Eli Zaretskii
  2015-12-29 17:37   ` Marcin Borkowski
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2015-12-29 16:02 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Emacs-devel

> From: Marcin Borkowski <mbork@mbork.pl>
> Date: Tue, 29 Dec 2015 10:32:00 +0100

Because it needs to determine the new window-start which is a
window-full above or below the current one, without assuming that all
the lines have the same height in pixels.  How do you do that in Lisp?
(The current implementation simulates display.)

> The reason I'm asking is that C-M-v (and C-M-S-v, for that matter) do
> the wrong thing if the other window shows a pdf file using pdf-tools.
> If those commands were written in Elisp, I could not only advise them
> (which I can, and probably will), but also propose a patch or
> something.

Sounds like a bug that should be reported.  Not sure if it's in core
Emacs or not, but please do report it with all the necessary details
to whatever the guilty parties are.

Thanks.



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

* Re: Is there any particular reason `scroll-other-window' is written in C and not in ELisp?
  2015-12-29 16:02 ` Eli Zaretskii
@ 2015-12-29 17:37   ` Marcin Borkowski
  2015-12-29 18:23     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Marcin Borkowski @ 2015-12-29 17:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Emacs-devel



On 2015-12-29, at 17:02, Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Marcin Borkowski <mbork@mbork.pl>
>> Date: Tue, 29 Dec 2015 10:32:00 +0100
>
> Because it needs to determine the new window-start which is a
> window-full above or below the current one, without assuming that all
> the lines have the same height in pixels.  How do you do that in Lisp?
> (The current implementation simulates display.)

Interesting, though I know too little about Emacs internals to fully
understand your answer.  I thought it just does something like

(save-excursion
  (other-buffer)
  (scroll-up))

Why my (probably naïve) implementation won't work?

>> The reason I'm asking is that C-M-v (and C-M-S-v, for that matter) do
>> the wrong thing if the other window shows a pdf file using pdf-tools.
>> If those commands were written in Elisp, I could not only advise them
>> (which I can, and probably will), but also propose a patch or
>> something.
>
> Sounds like a bug that should be reported.  Not sure if it's in core
> Emacs or not, but please do report it with all the necessary details
> to whatever the guilty parties are.

Not Emacs core, you're right.  I'll file a bug report.

> Thanks.

Thanks

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



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

* Re: Is there any particular reason `scroll-other-window' is written in C and not in ELisp?
  2015-12-29 17:37   ` Marcin Borkowski
@ 2015-12-29 18:23     ` Eli Zaretskii
  2015-12-29 18:44       ` Marcin Borkowski
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2015-12-29 18:23 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Emacs-devel

> From: Marcin Borkowski <mbork@mbork.pl>
> Cc: Emacs-devel@gnu.org
> Date: Tue, 29 Dec 2015 18:37:40 +0100
> 
> > Because it needs to determine the new window-start which is a
> > window-full above or below the current one, without assuming that all
> > the lines have the same height in pixels.  How do you do that in Lisp?
> > (The current implementation simulates display.)
> 
> Interesting, though I know too little about Emacs internals to fully
> understand your answer.  I thought it just does something like
> 
> (save-excursion
>   (other-buffer)
>   (scroll-up))
> 
> Why my (probably naïve) implementation won't work?

(You forget other-window-for-scrolling, but that's beside the point.)

How would that help?  The guts are in scroll-up, which is in C (as all
the scrolling commands).

Or are you saying that the bug is in the other-buffer part, rather
than in the scrolling part?

> > Sounds like a bug that should be reported.  Not sure if it's in core
> > Emacs or not, but please do report it with all the necessary details
> > to whatever the guilty parties are.
> 
> Not Emacs core, you're right.  I'll file a bug report.

Thanks.



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

* Re: Is there any particular reason `scroll-other-window' is written in C and not in ELisp?
  2015-12-29 18:23     ` Eli Zaretskii
@ 2015-12-29 18:44       ` Marcin Borkowski
  2015-12-29 19:01         ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Marcin Borkowski @ 2015-12-29 18:44 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Emacs-devel



On 2015-12-29, at 19:23, Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Marcin Borkowski <mbork@mbork.pl>
>> Cc: Emacs-devel@gnu.org
>> Date: Tue, 29 Dec 2015 18:37:40 +0100
>> 
>> > Because it needs to determine the new window-start which is a
>> > window-full above or below the current one, without assuming that all
>> > the lines have the same height in pixels.  How do you do that in Lisp?
>> > (The current implementation simulates display.)
>> 
>> Interesting, though I know too little about Emacs internals to fully
>> understand your answer.  I thought it just does something like
>> 
>> (save-excursion
>>   (other-buffer)
>>   (scroll-up))
>> 
>> Why my (probably naïve) implementation won't work?
>
> (You forget other-window-for-scrolling, but that's beside the point.)

Yes.

> How would that help?  The guts are in scroll-up, which is in C (as all
> the scrolling commands).

Well, I should have written explicitly what's wrong with the current
implementation.

When I view a pdf (in pdf-tools as well as in doc-view-mode), I'd like
C-M-v / C-M-S-v to change page when they reach the bottom/top of the
page.  Currently, they don't do it, which is a Very Bad Thing™.

Now that I think of it, I guess rewriting scroll-other-window in Elisp
wouldn't help a lot - I'd probably still have to advise them, or else
C-M-v should check what is bound to <next> and <prior> in the buffer to
be scrolled.  Does anyone have a better idea how to be able to scroll
a pdf in other window using C-M-v and C-M-S-v?

TIA,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



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

* Re: Is there any particular reason `scroll-other-window' is written in C and not in ELisp?
  2015-12-29 18:44       ` Marcin Borkowski
@ 2015-12-29 19:01         ` Eli Zaretskii
  2015-12-29 19:41           ` Marcin Borkowski
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2015-12-29 19:01 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Emacs-devel

> From: Marcin Borkowski <mbork@mbork.pl>
> Cc: Emacs-devel@gnu.org
> Date: Tue, 29 Dec 2015 19:44:21 +0100
> 
> Now that I think of it, I guess rewriting scroll-other-window in Elisp
> wouldn't help a lot - I'd probably still have to advise them, or else
> C-M-v should check what is bound to <next> and <prior> in the buffer to
> be scrolled.  Does anyone have a better idea how to be able to scroll
> a pdf in other window using C-M-v and C-M-S-v?

It sounds like there has to be some entirely different command bound
to C-M-v for what you want to happen.  The stock scrolling commands
know nothing about the significance of the "next PDF page", so they
cannot possibly do that for you.  They just bring more stuff from the
buffer into view.



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

* Re: Is there any particular reason `scroll-other-window' is written in C and not in ELisp?
  2015-12-29 19:01         ` Eli Zaretskii
@ 2015-12-29 19:41           ` Marcin Borkowski
  0 siblings, 0 replies; 7+ messages in thread
From: Marcin Borkowski @ 2015-12-29 19:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Emacs-devel



On 2015-12-29, at 20:01, Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Marcin Borkowski <mbork@mbork.pl>
>> Cc: Emacs-devel@gnu.org
>> Date: Tue, 29 Dec 2015 19:44:21 +0100
>> 
>> Now that I think of it, I guess rewriting scroll-other-window in Elisp
>> wouldn't help a lot - I'd probably still have to advise them, or else
>> C-M-v should check what is bound to <next> and <prior> in the buffer to
>> be scrolled.  Does anyone have a better idea how to be able to scroll
>> a pdf in other window using C-M-v and C-M-S-v?
>
> It sounds like there has to be some entirely different command bound
> to C-M-v for what you want to happen.  The stock scrolling commands
> know nothing about the significance of the "next PDF page", so they
> cannot possibly do that for you.  They just bring more stuff from the
> buffer into view.

This made me think that it /might/ be a good idea to introduce
a (buffer-local) variable (or a pair of variables) which would point to
function(s) taking the role of scroll-up/scroll-down in "unusual"
buffers.  This might make sense with pdfs, but also (possibly) images
(and maybe something else, too - I imagine EMMS's buffer /might/ point
those to emms-next/emms-previous, for instance).

WDYT?

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



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

end of thread, other threads:[~2015-12-29 19:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-29  9:32 Is there any particular reason `scroll-other-window' is written in C and not in ELisp? Marcin Borkowski
2015-12-29 16:02 ` Eli Zaretskii
2015-12-29 17:37   ` Marcin Borkowski
2015-12-29 18:23     ` Eli Zaretskii
2015-12-29 18:44       ` Marcin Borkowski
2015-12-29 19:01         ` Eli Zaretskii
2015-12-29 19:41           ` Marcin Borkowski

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