Is there a built-in function that does this:
(defun mk-column-at (point)
"Return column number at POINT."
(save-excursion
(goto-char point)
(current-column)))
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityIs there a built-in function that does this:
(defun mk-column-at (point)
"Return column number at POINT."
(save-excursion
(goto-char point)
(current-column)))
"Point" means something in Emacs. It is the buffer position just before the text cursor - the position at which text is self-inserted. It is confusing to name a parameter POINT
, since point typically does not correspond to whatever position might be passed to the function as argument. Better to call it POSITION
or POS
or POSN
, following convention, or something else.
Wrt the question, there is no such predefined function, as far as I know. What you write is about as succinct as it gets. I would probably just use the code in the function body, rather than bothering to define a function for this, but what you've done seems reasonable to me.
line-move-visual
insimple.el
. The presence of certain overlays (e.g., with the after-string property), however, conflict with that approach when point is at the end of the line. – lawlist Nov 3 '15 at 19:16