emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: line-start?


From: Bastien
Subject: Re: line-start?
Date: Fri, 07 Feb 2020 11:48:02 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

> Then (nth 1) of what posn-at-x-y returns is not what you want.  You
> should use the (car (nth 6)) instead.

FWIW I just tried this:

(car (nth 6 (posn-at-x-y
        0 (+ (cdr (posn-x-y (posn-at-point pos window)))
             (- (nth 1 (window-edges nil t nil t))
                (nth 1 (window-edges nil nil nil t)))))))

but it always returns 0.

The version with (nth 1 ...) works fine, though.

>> The use case was this one: given a line, display the content of this
>> line in the header line.  When horizontally scrolled, the header has
>> to display a substring of the line under the cursor, something like
>> (substring (current-line-string) offset-in-columns).
>
> But using the buffer position, you could use buffer-substring instead,
> right?

Yes, sure, but I still need to know the window line start to get the
offset.

-- 
 Bastien



reply via email to

[Prev in Thread] Current Thread [Next in Thread]