unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Possibly Weird Behavior Regarding First Lines Which are Invisible?
       [not found] <1623180934.4325548.1706854404633.ref@mail.yahoo.com>
@ 2024-02-02  6:13 ` Jaft
  2024-02-04 13:42   ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Jaft @ 2024-02-02  6:13 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

So I have a buffer; let's say 9 lines. And I have a function which runs (previous-line) (beginning-of-line 1) and said function is bound to a key (let's say <up>).
So I apply a text-property of 'invisible using (pos-bol) of the first line and (1+ (pos-eol)) in order to get the first line to disappear, like it's not even there.
If I'm on line 3 and M-: my function, it does what I'd expect and (point) will return the (pos-bol) of the second line. But, if I execute my function by pressing <up> from line 3, (point) keeps returning back 1, the point of the beginning of line 1 rather than the point at the beginning of line 2.
Is this expected behavior? I'd be less weirded out if running code through M-: gave back similar results but I get what I'd expect to happen no matter what code I run and only the unexpected behavior when running the exact same code via a key binding.
I'm running version 29.1 (GTK+ version 3.24.37 but through the terminal; I wouldn't expect these to affect anything as much as the Emacs version, though. On Guix).


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

* Re: Possibly Weird Behavior Regarding First Lines Which are Invisible?
  2024-02-02  6:13 ` Possibly Weird Behavior Regarding First Lines Which are Invisible? Jaft
@ 2024-02-04 13:42   ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2024-02-04 13:42 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Fri, 2 Feb 2024 06:13:24 +0000 (UTC)
> From: Jaft <jaft.r@outlook.com>
> 
> So I have a buffer; let's say 9 lines. And I have a function which runs (previous-line) (beginning-of-line 1) and said function is bound to a key (let's say <up>).
> So I apply a text-property of 'invisible using (pos-bol) of the first line and (1+ (pos-eol)) in order to get the first line to disappear, like it's not even there.
> If I'm on line 3 and M-: my function, it does what I'd expect and (point) will return the (pos-bol) of the second line. But, if I execute my function by pressing <up> from line 3, (point) keeps returning back 1, the point of the beginning of line 1 rather than the point at the beginning of line 2.
> Is this expected behavior?

Yes, it is.  After you press <UP>, the automatic point-adjustment
moves point to before the invisible text.  If you want to disable
that, set global-disable-point-adjustment to a non-nil value.



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

end of thread, other threads:[~2024-02-04 13:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1623180934.4325548.1706854404633.ref@mail.yahoo.com>
2024-02-02  6:13 ` Possibly Weird Behavior Regarding First Lines Which are Invisible? Jaft
2024-02-04 13:42   ` Eli Zaretskii

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