diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-08-26 00:57:58 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-08-26 00:57:58 +0200 |
commit | fd316e2c5b7b2868d7e5ba571af90de258d005f6 (patch) | |
tree | f470a9aa948296231214d4e0e3d2a34b5914b88e /elisp | |
parent | b38d0243910b65d763576bcf662da4d33f64e324 (diff) | |
download | geiser-fd316e2c5b7b2868d7e5ba571af90de258d005f6.tar.gz geiser-fd316e2c5b7b2868d7e5ba571af90de258d005f6.tar.bz2 |
Company: handling correctly the mode lighter and autodoc interaction.
Diffstat (limited to 'elisp')
-rw-r--r-- | elisp/geiser-company.el | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/elisp/geiser-company.el b/elisp/geiser-company.el index ef4ce38..15b9cb8 100644 --- a/elisp/geiser-company.el +++ b/elisp/geiser-company.el @@ -31,6 +31,9 @@ (make-variable-buffer-local (defvar geiser-company--enabled-flag nil)) +(make-variable-buffer-local + (defvar geiser-company--autodoc-flag nil)) + (defsubst geiser-company--candidates (prefix module) (car (geiser-completion--complete prefix module))) @@ -50,28 +53,31 @@ (if module (geiser-edit-module id) (geiser-edit-symbol id)) (cons (current-buffer) (point)))))) -(defsubst geiser-company--prefix-at-point (module) - (and geiser-company--enabled-flag - (looking-at-p "\\_>") - (not (nth 8 (syntax-ppss))) - (geiser-completion--prefix module))) +(defun geiser-company--prefix-at-point (module) + (when geiser-company--enabled-flag + (cond ((nth 8 (syntax-ppss)) 'stop) + ((looking-at-p "\\_>") (geiser-completion--prefix module)) + (module 'stop) + (t nil)))) ;;; Activation (defun geiser-company--setup (enable) (setq geiser-company--enabled-flag enable) - (when (boundp 'company-lighter) - (setq company-lighter "/C")) + (when (boundp 'company-default-lighter) + (set (make-local-variable 'company-default-lighter) "/C")) (when (fboundp 'company-mode) (company-mode nil) (when enable (company-mode enable)))) (defun geiser-company--inhibit-autodoc (ignored) - (setq geiser-autodoc--inhibit-flag t)) + (when (setq geiser-company--autodoc-flag geiser-autodoc-mode) + (geiser-autodoc-mode -1))) (defun geiser-company--restore-autodoc (&optional ignored) - (setq geiser-autodoc--inhibit-flag nil)) + (when geiser-company--autodoc-flag + (geiser-autodoc-mode 1))) ;;; Backends: |