In Emacs Lisp, if you have a buffer position stored in a variable, how do you find what column it is in?
In Emacs Lisp, if you have a buffer position stored in a variable, how do you find what column it is in?
There is an ambiguity in the question: "what column is it in" could mean either 1) "what character column does it appear to be in" or 2) "how many characters does one have to advance from the beginning of the line to get to the current position". These are normally the same, but can be different in the presence of characters with a text property like '(display (space :width 7)) [which says to display the characters having that text property as if they were 7 spaces wide].
The elisp function current-column returns meaning 1 but computing on values of (point) returns meaning 2. Trey Jackson's answer will return a different value than compman's because of this in some circumstances.
Another possibility for meaning 2 is (- (point) (line-beginning-position))