* Mark position from C
[not found] <878rgztc9p.fsf.ref@yahoo.com>
@ 2023-02-15 11:10 ` Po Lu
2023-02-15 13:54 ` Eli Zaretskii
0 siblings, 1 reply; 7+ messages in thread
From: Po Lu @ 2023-02-15 11:10 UTC (permalink / raw)
To: emacs-devel
Is there a canonical C function to obtain the position of mark? Right
now, I'm doing this to compare mark against point, which looks wrong.
&& XMARKER (BVAR (current_buffer, mark))->position
&& marker_position (BVAR (current_buffer,
mark)) == PT)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mark position from C
2023-02-15 11:10 ` Mark position from C Po Lu
@ 2023-02-15 13:54 ` Eli Zaretskii
2023-02-16 1:24 ` Po Lu
0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-02-15 13:54 UTC (permalink / raw)
To: Po Lu; +Cc: emacs-devel
> From: Po Lu <luangruo@yahoo.com>
> Date: Wed, 15 Feb 2023 19:10:26 +0800
>
> Is there a canonical C function to obtain the position of mark? Right
> now, I'm doing this to compare mark against point, which looks wrong.
>
> && XMARKER (BVAR (current_buffer, mark))->position
> && marker_position (BVAR (current_buffer,
> mark)) == PT)
marker_position (BVAR (current_buffer, mark)) is it. Why does it look
wrong to you?
And why do you need the first condition?
And why do you need to access the mark in the first place? It is rare
for the C code to need that; about the only place where we do it is in
interpreting the 'interactive' codes.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mark position from C
2023-02-15 13:54 ` Eli Zaretskii
@ 2023-02-16 1:24 ` Po Lu
2023-02-16 8:14 ` Eli Zaretskii
0 siblings, 1 reply; 7+ messages in thread
From: Po Lu @ 2023-02-16 1:24 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
> marker_position (BVAR (current_buffer, mark)) is it. Why does it look
> wrong to you?
What if the buffer's mark marker does not point into a buffer, or points
into the wrong buffer (is the latter even possible?)
> And why do you need the first condition?
Sorry, that should've been
XMARKER (BVAR (current_buffer, mark))->buffer
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mark position from C
2023-02-16 1:24 ` Po Lu
@ 2023-02-16 8:14 ` Eli Zaretskii
2023-02-16 8:48 ` Po Lu
0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-02-16 8:14 UTC (permalink / raw)
To: Po Lu; +Cc: emacs-devel
> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Thu, 16 Feb 2023 09:24:36 +0800
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > marker_position (BVAR (current_buffer, mark)) is it. Why does it look
> > wrong to you?
>
> What if the buffer's mark marker does not point into a buffer
marker_position signals an error in that case.
> or points into the wrong buffer (is the latter even possible?)
What do you mean by "wrong buffer"?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mark position from C
2023-02-16 8:14 ` Eli Zaretskii
@ 2023-02-16 8:48 ` Po Lu
2023-02-16 9:06 ` Eli Zaretskii
0 siblings, 1 reply; 7+ messages in thread
From: Po Lu @ 2023-02-16 8:48 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
> What do you mean by "wrong buffer"?
Some other buffer, i.e. if someone does this:
(set-marker (mark-marker) 0 (get-buffer-create "*the wrong buffer*"))
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mark position from C
2023-02-16 8:48 ` Po Lu
@ 2023-02-16 9:06 ` Eli Zaretskii
2023-02-16 10:00 ` Po Lu
0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-02-16 9:06 UTC (permalink / raw)
To: Po Lu; +Cc: emacs-devel
> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Thu, 16 Feb 2023 16:48:58 +0800
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > What do you mean by "wrong buffer"?
>
> Some other buffer, i.e. if someone does this:
>
> (set-marker (mark-marker) 0 (get-buffer-create "*the wrong buffer*"))
Did you see what happens if you do that?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mark position from C
2023-02-16 9:06 ` Eli Zaretskii
@ 2023-02-16 10:00 ` Po Lu
0 siblings, 0 replies; 7+ messages in thread
From: Po Lu @ 2023-02-16 10:00 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Po Lu <luangruo@yahoo.com>
>> Cc: emacs-devel@gnu.org
>> Date: Thu, 16 Feb 2023 16:48:58 +0800
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>> > What do you mean by "wrong buffer"?
>>
>> Some other buffer, i.e. if someone does this:
>>
>> (set-marker (mark-marker) 0 (get-buffer-create "*the wrong buffer*"))
>
> Did you see what happens if you do that?
Yes... the mark now points to the wrong buffer.
Anyway, I think I've figured this out now. Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-02-16 10:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <878rgztc9p.fsf.ref@yahoo.com>
2023-02-15 11:10 ` Mark position from C Po Lu
2023-02-15 13:54 ` Eli Zaretskii
2023-02-16 1:24 ` Po Lu
2023-02-16 8:14 ` Eli Zaretskii
2023-02-16 8:48 ` Po Lu
2023-02-16 9:06 ` Eli Zaretskii
2023-02-16 10:00 ` Po Lu
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).