Emacs column-number-mode numbers columns from 0 which normally doesn't cause me any grief, but I'm working with some line/column based data files whose spec starts with '1', and it would be a lot easier if I could either get emacs to do that, or find some elisp to.
Thoughts welcome.
You cannot easily change Emacs to have 1-based column counting, the change would have to be in the C code.
However, you can calculate your own column and put that in the mode line. Note: this requires the use of the force-mode-line-update
- which could potentially slow down your Emacs (just keep it in mind in case two years from now Emacs feels sluggish on some large buffer).
;; update the mode line to have line number and column number
(setq mode-line-position
'("%p (%l," (:eval (format "%d)" (1+ (current-column))))))
;; force the update of the mode line so the column gets updated
(add-hook 'post-command-hook 'force-mode-line-update)
Doc links of use are 'Variables Used In Mode Line' and 'Cursor Position Information'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With