Monday, September 03, 2012

emacs 문자위치(column number) 표시

#1. "0"부터 시작.
(setq column-number-mode t)

#2. "1"부터 시작.
구글그룹에서 검색됨. [알수없음]님께 감사.
;; 3.7.00  Column-numbers
;; Use my own column-number mode (which counts from 1, not 0)
;; String containing current column as last evaluated.  Initialize to "1"
(defvar current-column "1")
(make-variable-buffer-local 'current-column)
;; Update the string containing the current column.
;; The current-column function starts counting at zero, so add one to it
(defun do-update-column ()
  (setq current-column (int-to-string (1+ (current-column))))
  (set-buffer-modified-p (buffer-modified-p)))
;; Now set it up so that the current-column is updated by every keystroke
(add-hook 'post-command-hook 'do-update-column)

 (setq-default mode-line-format
   '("L:%l C:" current-column " %b [%P] " global-mode-string "("
     mode-name minor-mode-alist "%n"
     mode-line-process nv-percent ") F: %f "))

위 내용을 .emacs에 저장.

No comments: