fix(emacs): support tabs in a file

Fix #226
This commit is contained in:
Soonho Kong 2014-10-07 14:40:54 -07:00
parent e40ef9f6c5
commit 78e9854bae
4 changed files with 15 additions and 5 deletions

View file

@ -126,7 +126,7 @@
(defun company-lean--findg-candidates (prefix)
(let ((line-number (line-number-at-pos))
(column-number (current-column))
(column-number (lean-line-offset))
pattern)
(lean-server-send-cmd-sync (lean-cmd-wait) '(lambda () ()))
(setq pattern (if current-prefix-arg
@ -203,7 +203,6 @@ triggers a completion immediately."
(defun company-lean--findp-candidates (prefix)
(let ((line-number (line-number-at-pos))
(column-number (current-column))
pattern)
(lean-server-send-cmd-sync (lean-cmd-wait) '(lambda () ()))
(lean-server-send-cmd-sync (lean-cmd-findp line-number prefix)

View file

@ -456,13 +456,13 @@ Take out \"BEGININFO\" and \"ENDINFO\" and Use \"ACK\" as a delim."
(save-excursion
(forward-char 1)
(backward-list 1)
`(,(line-number-at-pos) . ,(current-column))))
`(,(line-number-at-pos) . ,(lean-line-offset))))
(defun lean-get-info-record-at-point (cont)
"Get info-record at the current point"
(let* ((file-name (buffer-file-name))
(line-number (line-number-at-pos))
(column-number (current-column))
(column-number (lean-line-offset))
(cmd (cond ((looking-at "(")
(lean-cmd-info line-number column-number))
;; TODO(soonhok): give information on '('

View file

@ -480,7 +480,7 @@ If it's not the same with file-name (default: buffer-file-name), send VISIT cmd.
(defun lean-server-get-info-record-at-pos (body)
(let* ((file-name (buffer-file-name))
(column (current-column)))
(column (lean-line-offset)))
(when (and (or (looking-at (rx (or white "," ")" "}" "]")))
(eolp))
(> column 1))

View file

@ -166,4 +166,15 @@
(when id-beg
(buffer-substring id-beg cur-pos))))))
(defun lean-line-offset ()
"Return the byte-offset of current position, counting from the
beginning of the line"
(interactive)
(let ((bol-pos
(save-excursion
(beginning-of-line)
(point)))
(pos (point)))
(- pos bol-pos)))
(provide 'lean-util)