all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Distinguishing:  Temporary v. Semi-Permanent -- Horizontal Scrolling
@ 2018-06-24  3:49 Keith David Bershatsky
  2018-06-24 14:26 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Keith David Bershatsky @ 2018-06-24  3:49 UTC (permalink / raw)
  To: Emacs Devel

I am working on feature requests 17684 (crosshairs) and 22873 (multiple fake cursors).

Temporary horizontal scrolling is achieved by interactively calling:  (scroll-left 1)

Semi-permanent horizontal scrolling is achieved by typing:  C-u C-x <

To determine whether _only_ the current line is _temporarily_ horizontally scrolled, I have been using:

  bool hscl = (!it->w->suspend_auto_hscroll
               && EQ (Fbuffer_local_value (Qauto_hscroll_mode, buf), Qcurrent_line)
               && it->w->hscroll > 0);

I am now moving on to deal with a situation where horizontal scrolling is semi-permanent.  In this situation (C-u C-x <), hscl is true.  So that test is insufficient here.

What test, please, would be appropriate to determine whether semi-permanent (c-u C-x <) is in effect?

And, is it correct to assume that the current line will never be horizontally scrolled differently when semi-permanent (C-u X-x <) is in effect?

Thanks,

Keith



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

* Re: Distinguishing: Temporary v. Semi-Permanent -- Horizontal Scrolling
  2018-06-24  3:49 Keith David Bershatsky
@ 2018-06-24 14:26 ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2018-06-24 14:26 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: emacs-devel

> Date: Sat, 23 Jun 2018 20:49:26 -0700
> From: Keith David Bershatsky <esq@lawlist.com>
> 
>   bool hscl = (!it->w->suspend_auto_hscroll
>                && EQ (Fbuffer_local_value (Qauto_hscroll_mode, buf), Qcurrent_line)
>                && it->w->hscroll > 0);
> 
> I am now moving on to deal with a situation where horizontal scrolling is semi-permanent.  In this situation (C-u C-x <), hscl is true.  So that test is insufficient here.
> 
> What test, please, would be appropriate to determine whether semi-permanent (c-u C-x <) is in effect?

"C-x <" sets the window's min_hscroll field to a positive value.
That's how its effect is made more "permanent".

> And, is it correct to assume that the current line will never be horizontally scrolled differently when semi-permanent (C-u X-x <) is in effect?

I don't understand the question.  Differently from what?



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

* Re: Distinguishing: Temporary v. Semi-Permanent -- Horizontal Scrolling
@ 2018-06-24 16:16 Keith David Bershatsky
  2018-06-24 16:40 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Keith David Bershatsky @ 2018-06-24 16:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Thank you, Eli, for the min_hscroll test.  Greatly appreciated!

When testing my code in conjunction with horizontal scrolling of just the current line, I use (setq-local auto-hscroll-mode 'current-line), and then I interactively call (scroll-left 1), and then I move the arrow key left or right.

I have not seen an example where horizontal scrolling is semi-permanent (C-u C-x <) and the current line is scrolled differently from the rest.  For example, if w->min_hscroll is 4, shall I assume that the current line will always have the same amount of horizontal scrolling as all other lines in the visible window?

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

DATE:  [06-24-2018 07:26:10] <24 Jun 2018 17:26:10 +0300>
FROM:  Eli Zaretskii <eliz@gnu.org>
> 
> * * *
> 
> > And, is it correct to assume that the current line will never be horizontally scrolled differently when semi-permanent (C-u X-x <) is in effect?
> 
> I don't understand the question.  Differently from what?



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

* Re: Distinguishing: Temporary v. Semi-Permanent -- Horizontal Scrolling
  2018-06-24 16:16 Keith David Bershatsky
@ 2018-06-24 16:40 ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2018-06-24 16:40 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: emacs-devel

> Date: Sun, 24 Jun 2018 09:16:01 -0700
> From: Keith David Bershatsky <esq@lawlist.com>
> Cc: emacs-devel@gnu.org
> 
> I have not seen an example where horizontal scrolling is semi-permanent (C-u C-x <) and the current line is scrolled differently from the rest.  For example, if w->min_hscroll is 4, shall I assume that the current line will always have the same amount of horizontal scrolling as all other lines in the visible window?

No, of course not.  Only the minimum amount of hscroll will be the
same for all the lines.

If auto-hscroll-mode is set to current-line, then typing "C-u 5 C-x <"
will hscroll all lines by 5 columns.  If you then move cursor so that
it gets too close to the right margin of the window, the current line,
and only that line, will be hscrolled by more than 5 columns, in order
to bring point into view.  The other lines will remain at their
5-column hscroll.

IOW, in this mode "C-x <" affects all lines, but only the current line
is scrolled more than that when needed.



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

* Re: Distinguishing: Temporary v. Semi-Permanent -- Horizontal Scrolling
@ 2018-06-24 17:31 Keith David Bershatsky
  0 siblings, 0 replies; 10+ messages in thread
From: Keith David Bershatsky @ 2018-06-24 17:31 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Thank you, Eli, for the example.  I added a long line to my test file and will include your example when testing in the future.

As always, your help is greatly appreciated.

Keith

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

DATE:  [06-24-2018 09:40:58] <24 Jun 2018 19:40:58 +0300>
FROM:  Eli Zaretskii <eliz@gnu.org>
> 
>  Scrolling
> 
> > Date: Sun, 24 Jun 2018 09:16:01 -0700
> > From: Keith David Bershatsky <esq@lawlist.com>
> > Cc: emacs-devel@gnu.org
> >
> > I have not seen an example where horizontal scrolling is semi-permanent (C-u C-x <) and the current line is scrolled differently from the rest.  For example, if w->min_hscroll is 4, shall I assume that the current line will always have the same amount of horizontal scrolling as all other lines in the visible window?
> 
> No, of course not.  Only the minimum amount of hscroll will be the
> same for all the lines.
> 
> If auto-hscroll-mode is set to current-line, then typing "C-u 5 C-x <"
> will hscroll all lines by 5 columns.  If you then move cursor so that
> it gets too close to the right margin of the window, the current line,
> and only that line, will be hscrolled by more than 5 columns, in order
> to bring point into view.  The other lines will remain at their
> 5-column hscroll.
> 
> IOW, in this mode "C-x <" affects all lines, but only the current line
> is scrolled more than that when needed.



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

* Re: Distinguishing: Temporary v. Semi-Permanent -- Horizontal Scrolling
@ 2018-07-03  2:44 Keith David Bershatsky
  2018-07-03 19:29 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Keith David Bershatsky @ 2018-07-03  2:44 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

As far as I am aware, there are four (4) basic situations that I need to be aware of in terms of horizontal scrolling:

1a.  Temporary Horizontal Scrolling:  (scroll-left 1)
1b.  Current line is horizontally scrolled the same as all other lines.

2a.  Temporary Horizontal Scrolling:  (scroll-left 1)
2b.  Current line is horizontally scrolled _differently_ than all other lines.
2c.  Assumes (setq-local auto-hscroll-mode 'current-line)

3a.  Semi-permanent Horizontal Scrolling:  (scroll-left 1 t)
3b.  Current line is horizontally scrolled the same as all other lines.

4a.  Semi-permanent Horizontal Scrolling:  (scroll-left 1 t)
4b.  Current line is horizontally scrolled _differently_ than all other lines.
4c.  Assumes (setq-local auto-hscroll-mode 'current-line)

In a previous post, you taught me that (it->w->min_hscroll > 0) tells us that semi-permanent horizontal scrolling is in effect.

I have been using the following hscl test for the 2nd situation above:

  bool hscl = (!it->w->suspend_auto_hscroll
               && EQ (Fbuffer_local_value (Qauto_hscroll_mode, buf), Qcurrent_line)
               && it->w->hscroll > 0);

The hscl test is _true_ for the 2nd, 3rd and 4th situations above.  Thus, the hscl test does not help us distinguish between the 3rd and 4th situations above.

Q:  In addition to (it->w->min_hscroll > 0), what test will help us distinguish between the 3rd and 4th situations above?



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

* Re: Distinguishing: Temporary v. Semi-Permanent -- Horizontal Scrolling
  2018-07-03  2:44 Keith David Bershatsky
@ 2018-07-03 19:29 ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2018-07-03 19:29 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: emacs-devel

> Date:  Mon, 02 Jul 2018 19:44:36 -0700
> From:  Keith David Bershatsky <esq@lawlist.com>
> Cc:  emacs-devel@gnu.org
> 
> Q:  In addition to (it->w->min_hscroll > 0), what test will help us distinguish between the 3rd and 4th situations above?

In case 4 this condition should be true:

  EQ (Fbuffer_local_value (Qauto_hscroll_mode, buf), Qcurrent_line)




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

* Re: Distinguishing: Temporary v. Semi-Permanent -- Horizontal Scrolling
@ 2018-07-03 20:20 Keith David Bershatsky
  2018-07-04  2:33 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Keith David Bershatsky @ 2018-07-03 20:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Thank you, Eli.  If we complicate the examples by assuming that the buffer-local variable auto-hscroll-mode is set to 'current-line for both case 3 and case 4, then an additional test would be needed when moving IT over the current line.  How do we know that the middle line in case 4 ("deserves fudge.") is horizontally scrolled differently than the lines above and below?

Every good boy deserves fudge.
Every good boy deserves fudge.
Every good boy deserves fudge.

3.  Semi-permanent Horizontal Scrolling:  (scroll-left 6 t)
    (setq-local auto-hscroll-mode 'current-line)

good boy deserves->
good boy deserves->
good boy deserves->

4.  Semi-permanent Horizontal Scrolling:  (scroll-left 6 t)
    (setq-local auto-hscroll-mode 'current-line)

good boy deserves->
deserves fudge.
good boy deserves->

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

DATE:  [07-03-2018 12:29:55] <03 Jul 2018 22:29:55 +0300>
FROM:  Eli Zaretskii <eliz@gnu.org>
> 
> > Date:  Mon, 02 Jul 2018 19:44:36 -0700
> > From:  Keith David Bershatsky <esq@lawlist.com>
> > Cc:  emacs-devel@gnu.org
> >
> > Q:  In addition to (it->w->min_hscroll > 0), what test will help us distinguish between the 3rd and 4th situations above?
> 
> In case 4 this condition should be true:
> 
>   EQ (Fbuffer_local_value (Qauto_hscroll_mode, buf), Qcurrent_line)



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

* Re: Distinguishing: Temporary v. Semi-Permanent -- Horizontal Scrolling
  2018-07-03 20:20 Keith David Bershatsky
@ 2018-07-04  2:33 ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2018-07-04  2:33 UTC (permalink / raw)
  To: Keith David Bershatsky; +Cc: emacs-devel

> Date:  Tue, 03 Jul 2018 13:20:51 -0700
> From:  Keith David Bershatsky <esq@lawlist.com>
> Cc:  emacs-devel@gnu.org
> 
> Thank you, Eli.  If we complicate the examples by assuming that the buffer-local variable auto-hscroll-mode is set to 'current-line for both case 3 and case 4, then an additional test would be needed when moving IT over the current line.  How do we know that the middle line in case 4 ("deserves fudge.") is horizontally scrolled differently than the lines above and below?

Its w->hscroll should be different from w->min_hscroll.



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

* Re: Distinguishing: Temporary v. Semi-Permanent -- Horizontal Scrolling
@ 2018-07-04 13:56 Keith David Bershatsky
  0 siblings, 0 replies; 10+ messages in thread
From: Keith David Bershatsky @ 2018-07-04 13:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Great!  Thank you!!! :)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

DATE:  [07-03-2018 19:33:00] <04 Jul 2018 05:33:00 +0300>
FROM:  Eli Zaretskii <eliz@gnu.org>
> 
> > Date:  Tue, 03 Jul 2018 13:20:51 -0700
> > From:  Keith David Bershatsky <esq@lawlist.com>
> > Cc:  emacs-devel@gnu.org
> >
> > Thank you, Eli.  If we complicate the examples by assuming that the buffer-local variable auto-hscroll-mode is set to 'current-line for both case 3 and case 4, then an additional test would be needed when moving IT over the current line.  How do we know that the middle line in case 4 ("deserves fudge.") is horizontally scrolled differently than the lines above and below?
> 
> Its w->hscroll should be different from w->min_hscroll.



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

end of thread, other threads:[~2018-07-04 13:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-24 17:31 Distinguishing: Temporary v. Semi-Permanent -- Horizontal Scrolling Keith David Bershatsky
  -- strict thread matches above, loose matches on Subject: below --
2018-07-04 13:56 Keith David Bershatsky
2018-07-03 20:20 Keith David Bershatsky
2018-07-04  2:33 ` Eli Zaretskii
2018-07-03  2:44 Keith David Bershatsky
2018-07-03 19:29 ` Eli Zaretskii
2018-06-24 16:16 Keith David Bershatsky
2018-06-24 16:40 ` Eli Zaretskii
2018-06-24  3:49 Keith David Bershatsky
2018-06-24 14:26 ` Eli Zaretskii

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.