emacs-devel
[Top][All Lists]
Advanced

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

Alternative to current-column that counts from visual line beginning


From: Yuan Fu
Subject: Alternative to current-column that counts from visual line beginning
Date: Mon, 28 Dec 2020 21:19:11 -0500

I need to know the column number of the point on the current _visual_ line. 
current-column measures from logical beginning of line, so it gives rather 
unintuitive result on wrapped lines. I had to do this:

(save-excursion
    (let ((col (current-column)))
      ;; Go to visual line beginning.
      (vertical-motion 0)
      (- col (current-column))))

to get the column number counting from the visual line beginning. Is there a 
function that does what I want? If not, maybe we should add one, or add an 
argument to current-column.

Yuan


reply via email to

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