Buffer position column in Emacs Lisp?

In Emacs Lisp, if you have a buffer position stored in a variable, how do you find which column it is in?

+7
source share
2 answers

Check out the documentation for columns and save-excursion .

 (save-excursion (goto-char pos) (current-column)) 
+16
source

Trey already nailed it (although I personally have not tried it), but here is what I wrote for this.

 (defun calculate-column (point) (save-excursion (goto-char point) (beginning-of-line) (- point (point)))) 
+1
source

All Articles