all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Alternative to current-column that counts from visual line beginning
@ 2020-12-29  2:19 Yuan Fu
  2020-12-29  2:40 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Yuan Fu @ 2020-12-29  2:19 UTC (permalink / raw)
  To: emacs-devel\@gnu.org

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


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

end of thread, other threads:[~2020-12-29 21:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-29  2:19 Alternative to current-column that counts from visual line beginning Yuan Fu
2020-12-29  2:40 ` Stefan Monnier
2020-12-29  5:01   ` Yuan Fu
2020-12-29  6:21     ` Eli Zaretskii
2020-12-29 21:05       ` Yuan Fu

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.