From: Yuan Fu <casouri@gmail.com>
To: "emacs-devel\\@gnu.org" <emacs-devel@gnu.org>
Subject: Alternative to current-column that counts from visual line beginning
Date: Mon, 28 Dec 2020 21:19:11 -0500 [thread overview]
Message-ID: <87F0777E-F283-4315-B9E5-D104B145EF89@gmail.com> (raw)
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
next reply other threads:[~2020-12-29 2:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-29 2:19 Yuan Fu [this message]
2020-12-29 2:40 ` Alternative to current-column that counts from visual line beginning Stefan Monnier
2020-12-29 5:01 ` Yuan Fu
2020-12-29 6:21 ` Eli Zaretskii
2020-12-29 21:05 ` Yuan Fu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87F0777E-F283-4315-B9E5-D104B145EF89@gmail.com \
--to=casouri@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.