all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#44503: 27.1; image-scroll-up and image-scroll-down
@ 2020-11-07 15:16 Roland Winkler
  2020-11-07 15:26 ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Roland Winkler @ 2020-11-07 15:16 UTC (permalink / raw)
  To: 44503


My understanding of the doc strings of image-scroll-up and
image-scroll-down is that the argument N should be a number, nil, or
`-'."  However, these commands use (interactive "P") with
prefix-numeric-value inside the body of these commands.  I suggest
to document this behavior.  (I guess it is not very clean to use
prefix-numeric-value inside the body of these commands.  But
changing this behavior likely will break existing code that uses
these commands.)

I realized this when I looked at doc-view's scrolling commands
doc-view-scroll-up-or-next-page and
doc-view-scroll-down-or-previous-page
that likewise use (interactive "P"), contrary, to what the
docstrings of these commands say, and I was surprised that this
gives a meaningful behavior.  So these docstrings probably should be
updated, too.


In GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2020-08-31 built on regnitz
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description: Ubuntu 16.04.7 LTS






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

* bug#44503: 27.1; image-scroll-up and image-scroll-down
  2020-11-07 15:16 bug#44503: 27.1; image-scroll-up and image-scroll-down Roland Winkler
@ 2020-11-07 15:26 ` Eli Zaretskii
  2020-11-09 20:03   ` Roland Winkler
  0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2020-11-07 15:26 UTC (permalink / raw)
  To: Roland Winkler; +Cc: 44503

> Date: Sat, 7 Nov 2020 09:16:22 -0600
> From: "Roland Winkler" <winkler@gnu.org>
> 
> 
> My understanding of the doc strings of image-scroll-up and
> image-scroll-down is that the argument N should be a number, nil, or
> `-'."  However, these commands use (interactive "P") with
> prefix-numeric-value inside the body of these commands.  I suggest
> to document this behavior.  (I guess it is not very clean to use
> prefix-numeric-value inside the body of these commands.  But
> changing this behavior likely will break existing code that uses
> these commands.)
> 
> I realized this when I looked at doc-view's scrolling commands
> doc-view-scroll-up-or-next-page and
> doc-view-scroll-down-or-previous-page
> that likewise use (interactive "P"), contrary, to what the
> docstrings of these commands say, and I was surprised that this
> gives a meaningful behavior.  So these docstrings probably should be
> updated, too.

Thanks.  Can you suggest the changes to the relevant doc strings?





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

* bug#44503: 27.1; image-scroll-up and image-scroll-down
  2020-11-07 15:26 ` Eli Zaretskii
@ 2020-11-09 20:03   ` Roland Winkler
  2021-06-06 10:37     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 14+ messages in thread
From: Roland Winkler @ 2020-11-09 20:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 44503

On Sat Nov 7 2020 Eli Zaretskii wrote:
> Thanks.  Can you suggest the changes to the relevant doc strings?

Digging in the sources, I realized that using raw prefix args 
includes not only image-scroll-up and image-scroll-down but also the
built-in functions scroll-up and scroll-down.  I'll try to come up
with a patch that covers all relevant doc strings.





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

* bug#44503: 27.1; image-scroll-up and image-scroll-down
  2020-11-09 20:03   ` Roland Winkler
@ 2021-06-06 10:37     ` Lars Ingebrigtsen
  2021-06-08 15:34       ` Roland Winkler
  0 siblings, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-06 10:37 UTC (permalink / raw)
  To: Roland Winkler; +Cc: 44503

"Roland Winkler" <winkler@gnu.org> writes:

> On Sat Nov 7 2020 Eli Zaretskii wrote:
>> Thanks.  Can you suggest the changes to the relevant doc strings?
>
> Digging in the sources, I realized that using raw prefix args 
> includes not only image-scroll-up and image-scroll-down but also the
> built-in functions scroll-up and scroll-down.  I'll try to come up
> with a patch that covers all relevant doc strings.

Did you make any further progress here?

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





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

* bug#44503: 27.1; image-scroll-up and image-scroll-down
  2021-06-06 10:37     ` Lars Ingebrigtsen
@ 2021-06-08 15:34       ` Roland Winkler
  2021-06-09  9:56         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 14+ messages in thread
From: Roland Winkler @ 2021-06-08 15:34 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 44503

On Sun Jun 6 2021 Lars Ingebrigtsen wrote:
> "Roland Winkler" <winkler@gnu.org> writes:
> 
> > On Sat Nov 7 2020 Eli Zaretskii wrote:
> >> Thanks.  Can you suggest the changes to the relevant doc strings?
> >
> > Digging in the sources, I realized that using raw prefix args 
> > includes not only image-scroll-up and image-scroll-down but also the
> > built-in functions scroll-up and scroll-down.  I'll try to come up
> > with a patch that covers all relevant doc strings.
> 
> Did you make any further progress here?

I am sorry, I haven't had as much progress as I had wanted to.  I
realized that the discrepancy between documented behavior and actual
code exists in a larger number of commands than I had expected.  So
the question becomes: for how many commands do we want to include a
remark in the docstring saying that due to historical reasons they
call prefix-numeric-value not in their interactive specs, but
scroll_command calls prefix_numeric_value in its body, which defines
how these commands interpret the argument.  (The actual wording in the
docstrings should probably be different.)

I guess for the built-in functions scroll-up and scroll-down as well
as image-scroll-up and image-scroll-down it is most important to
mention this and we could leave the docstrings of other commands
untouched.  What do you think?





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

* bug#44503: 27.1; image-scroll-up and image-scroll-down
  2021-06-08 15:34       ` Roland Winkler
@ 2021-06-09  9:56         ` Lars Ingebrigtsen
  2021-06-09 11:51           ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-09  9:56 UTC (permalink / raw)
  To: Roland Winkler; +Cc: 44503

"Roland Winkler" <winkler@gnu.org> writes:

> I am sorry, I haven't had as much progress as I had wanted to.  I
> realized that the discrepancy between documented behavior and actual
> code exists in a larger number of commands than I had expected.  So
> the question becomes: for how many commands do we want to include a
> remark in the docstring saying that due to historical reasons they
> call prefix-numeric-value not in their interactive specs, but
> scroll_command calls prefix_numeric_value in its body, which defines
> how these commands interpret the argument.  (The actual wording in the
> docstrings should probably be different.)
>
> I guess for the built-in functions scroll-up and scroll-down as well
> as image-scroll-up and image-scroll-down it is most important to
> mention this and we could leave the docstrings of other commands
> untouched.  What do you think?

Well, the doc strings for these commands don't really describe
interactive usage at all, but I think most people would interpret what's
there as "it's like (interactive "p"), but with no prefix at all it
behaves differently".  (Which is what it does -- a full screen instead
of a line.)

Stating this explicitly in the doc strings of these four commands would
be nice.  So something like:

Interactively, giving this command a numerical prefix will scroll by
that many lines.  Without a prefix, scroll by a full screen.

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





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

* bug#44503: 27.1; image-scroll-up and image-scroll-down
  2021-06-09  9:56         ` Lars Ingebrigtsen
@ 2021-06-09 11:51           ` Eli Zaretskii
  2021-06-10  8:19             ` Lars Ingebrigtsen
  2022-05-07 13:06             ` Lars Ingebrigtsen
  0 siblings, 2 replies; 14+ messages in thread
From: Eli Zaretskii @ 2021-06-09 11:51 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 44503, winkler

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: 44503@debbugs.gnu.org,  Eli Zaretskii <eliz@gnu.org>
> Date: Wed, 09 Jun 2021 11:56:38 +0200
> 
> "Roland Winkler" <winkler@gnu.org> writes:
> 
> > I am sorry, I haven't had as much progress as I had wanted to.  I
> > realized that the discrepancy between documented behavior and actual
> > code exists in a larger number of commands than I had expected.  So
> > the question becomes: for how many commands do we want to include a
> > remark in the docstring saying that due to historical reasons they
> > call prefix-numeric-value not in their interactive specs, but
> > scroll_command calls prefix_numeric_value in its body, which defines
> > how these commands interpret the argument.  (The actual wording in the
> > docstrings should probably be different.)
> >
> > I guess for the built-in functions scroll-up and scroll-down as well
> > as image-scroll-up and image-scroll-down it is most important to
> > mention this and we could leave the docstrings of other commands
> > untouched.  What do you think?
> 
> Well, the doc strings for these commands don't really describe
> interactive usage at all, but I think most people would interpret what's
> there as "it's like (interactive "p"), but with no prefix at all it
> behaves differently".  (Which is what it does -- a full screen instead
> of a line.)

What about the value of '-' ?

> Stating this explicitly in the doc strings of these four commands would
> be nice.  So something like:
> 
> Interactively, giving this command a numerical prefix will scroll by
> that many lines.  Without a prefix, scroll by a full screen.

Btw, the doc strings also use both N and ARG, but should only use N.





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

* bug#44503: 27.1; image-scroll-up and image-scroll-down
  2021-06-09 11:51           ` Eli Zaretskii
@ 2021-06-10  8:19             ` Lars Ingebrigtsen
  2021-06-10 12:52               ` Lars Ingebrigtsen
  2022-05-07 13:06             ` Lars Ingebrigtsen
  1 sibling, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-10  8:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 44503, winkler

Eli Zaretskii <eliz@gnu.org> writes:

>> Well, the doc strings for these commands don't really describe
>> interactive usage at all, but I think most people would interpret what's
>> there as "it's like (interactive "p"), but with no prefix at all it
>> behaves differently".  (Which is what it does -- a full screen instead
>> of a line.)
>
> What about the value of '-' ?

Yes, `C-u -' here does the opposite of the non-prefixed action.  (While
it's indistinguishable from `C-u - 1' with normal "p" action.)

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





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

* bug#44503: 27.1; image-scroll-up and image-scroll-down
  2021-06-10  8:19             ` Lars Ingebrigtsen
@ 2021-06-10 12:52               ` Lars Ingebrigtsen
  2021-06-10 14:24                 ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-10 12:52 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 44503, winkler

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> Well, the doc strings for these commands don't really describe
>>> interactive usage at all, but I think most people would interpret what's
>>> there as "it's like (interactive "p"), but with no prefix at all it
>>> behaves differently".  (Which is what it does -- a full screen instead
>>> of a line.)
>>
>> What about the value of '-' ?
>
> Yes, `C-u -' here does the opposite of the non-prefixed action.  (While
> it's indistinguishable from `C-u - 1' with normal "p" action.)

Just a thought -- should we perhaps establish a convention for this that
we can say commands adhere to?  That is, `C-u NUM' means "the same as
'p'" while `C-u -' and no prefix means "some large (negative and
positive; depending on the command) amount"?  I'm not sure how many of
these commands we have...

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





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

* bug#44503: 27.1; image-scroll-up and image-scroll-down
  2021-06-10 12:52               ` Lars Ingebrigtsen
@ 2021-06-10 14:24                 ` Eli Zaretskii
  2021-06-10 15:09                   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2021-06-10 14:24 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 44503, winkler

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: 44503@debbugs.gnu.org,  winkler@gnu.org
> Date: Thu, 10 Jun 2021 14:52:45 +0200
> 
> Lars Ingebrigtsen <larsi@gnus.org> writes:
> 
> >> What about the value of '-' ?
> >
> > Yes, `C-u -' here does the opposite of the non-prefixed action.  (While
> > it's indistinguishable from `C-u - 1' with normal "p" action.)
> 
> Just a thought -- should we perhaps establish a convention for this that
> we can say commands adhere to?  That is, `C-u NUM' means "the same as
> 'p'" while `C-u -' and no prefix means "some large (negative and
> positive; depending on the command) amount"?  I'm not sure how many of
> these commands we have...

I'm not sure I follow: what are you trying to improve/fix/change by
that, apart of the doc strings?





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

* bug#44503: 27.1; image-scroll-up and image-scroll-down
  2021-06-10 14:24                 ` Eli Zaretskii
@ 2021-06-10 15:09                   ` Lars Ingebrigtsen
  2021-06-10 15:33                     ` Eli Zaretskii
  0 siblings, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-10 15:09 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 44503, winkler

Eli Zaretskii <eliz@gnu.org> writes:

> I'm not sure I follow: what are you trying to improve/fix/change by
> that, apart of the doc strings?

Doc strings mostly -- if we had a section in the lispref manual that
explains this, we could have the doc strings just refer to that.

But if it's a common pattern, perhaps there could be a new `interactive'
spec -- (interactive "p-but-not-quite") -- but I'm not sure how that
would look, and I wonder whether anybody has any ideas here.

If it's always "like 'p' but an entire page if the prefix isn't
numerical", then that would be a win (and the four commands discussed
here fit that pattern), but I'm not sure how prevalent this pattern is,
so it may not be worth it.

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





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

* bug#44503: 27.1; image-scroll-up and image-scroll-down
  2021-06-10 15:09                   ` Lars Ingebrigtsen
@ 2021-06-10 15:33                     ` Eli Zaretskii
  2021-06-12 12:11                       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2021-06-10 15:33 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 44503, winkler

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: 44503@debbugs.gnu.org,  winkler@gnu.org
> Date: Thu, 10 Jun 2021 17:09:19 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > I'm not sure I follow: what are you trying to improve/fix/change by
> > that, apart of the doc strings?
> 
> Doc strings mostly -- if we had a section in the lispref manual that
> explains this, we could have the doc strings just refer to that.

I'm not sure it's worth it.  Describing what "C-u -" does is usually
easy and doesn't take too many words.

> If it's always "like 'p' but an entire page if the prefix isn't
> numerical", then that would be a win (and the four commands discussed
> here fit that pattern), but I'm not sure how prevalent this pattern is,
> so it may not be worth it.

Not all the commands that react to "C-u -" work on stuff where "page"
is meaningful, I think.





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

* bug#44503: 27.1; image-scroll-up and image-scroll-down
  2021-06-10 15:33                     ` Eli Zaretskii
@ 2021-06-12 12:11                       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 14+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-12 12:11 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 44503, winkler

Eli Zaretskii <eliz@gnu.org> writes:

> I'm not sure it's worth it.  Describing what "C-u -" does is usually
> easy and doesn't take too many words.

Yeah, if it's just these four commands, it's not worth it.

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





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

* bug#44503: 27.1; image-scroll-up and image-scroll-down
  2021-06-09 11:51           ` Eli Zaretskii
  2021-06-10  8:19             ` Lars Ingebrigtsen
@ 2022-05-07 13:06             ` Lars Ingebrigtsen
  1 sibling, 0 replies; 14+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-07 13:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 44503, winkler

Eli Zaretskii <eliz@gnu.org> writes:

>> Well, the doc strings for these commands don't really describe
>> interactive usage at all, but I think most people would interpret what's
>> there as "it's like (interactive "p"), but with no prefix at all it
>> behaves differently".  (Which is what it does -- a full screen instead
>> of a line.)
>
> What about the value of '-' ?
>
>> Stating this explicitly in the doc strings of these four commands would
>> be nice.  So something like:
>> 
>> Interactively, giving this command a numerical prefix will scroll by
>> that many lines.  Without a prefix, scroll by a full screen.
>
> Btw, the doc strings also use both N and ARG, but should only use N.

I think I've now fixed all of this in the affected for doc strings in
Emacs 29.

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





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

end of thread, other threads:[~2022-05-07 13:06 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-07 15:16 bug#44503: 27.1; image-scroll-up and image-scroll-down Roland Winkler
2020-11-07 15:26 ` Eli Zaretskii
2020-11-09 20:03   ` Roland Winkler
2021-06-06 10:37     ` Lars Ingebrigtsen
2021-06-08 15:34       ` Roland Winkler
2021-06-09  9:56         ` Lars Ingebrigtsen
2021-06-09 11:51           ` Eli Zaretskii
2021-06-10  8:19             ` Lars Ingebrigtsen
2021-06-10 12:52               ` Lars Ingebrigtsen
2021-06-10 14:24                 ` Eli Zaretskii
2021-06-10 15:09                   ` Lars Ingebrigtsen
2021-06-10 15:33                     ` Eli Zaretskii
2021-06-12 12:11                       ` Lars Ingebrigtsen
2022-05-07 13:06             ` Lars Ingebrigtsen

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.