mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-05 09:01:40 -05:00
Allow disabling of autocomplete
``` M-x customize-group RET ein-completion ``` Set `Ein:Completion Backend` to `ein:use-none-backend`, Set `State` to `Save for Future Sessions`. Also use `featurep` and `with-eval-after-load` to clean up the subpackage requiring gymnastics.
This commit is contained in:
parent
476a08f119
commit
d4ef4ed81c
13 changed files with 96 additions and 200 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -28,3 +28,4 @@ _static
|
||||||
*.zip
|
*.zip
|
||||||
.gitattributes
|
.gitattributes
|
||||||
.ecukes-temp*
|
.ecukes-temp*
|
||||||
|
dist
|
||||||
|
|
|
@ -15,6 +15,26 @@ Scenario: not running server locally
|
||||||
And I switch to log expr "ein:log-all-buffer-name"
|
And I switch to log expr "ein:log-all-buffer-name"
|
||||||
Then I should not see "ein:completions--prepare-oinfo"
|
Then I should not see "ein:completions--prepare-oinfo"
|
||||||
|
|
||||||
|
@complete
|
||||||
|
Scenario: auto completion
|
||||||
|
Given I set "ein:ac-direct-matches" to eval "nil"
|
||||||
|
Given I set "ein:completion-backend" to eval "(quote ein:use-ac-backend)"
|
||||||
|
Given new default notebook
|
||||||
|
And I type "import itertool"
|
||||||
|
And I press "C-c C-i"
|
||||||
|
And I wait for the smoke to clear
|
||||||
|
Then "ein:ac-direct-matches" should include "itertools"
|
||||||
|
|
||||||
|
@complete
|
||||||
|
Scenario: no auto completion
|
||||||
|
Given I set "ein:ac-direct-matches" to eval "nil"
|
||||||
|
Given I set "ein:completion-backend" to eval "(quote ein:use-none-backend)"
|
||||||
|
Given new default notebook
|
||||||
|
And I type "import itertool"
|
||||||
|
And I press "C-c C-i"
|
||||||
|
And I wait for the smoke to clear
|
||||||
|
Then "ein:ac-direct-matches" should not include "itertools"
|
||||||
|
|
||||||
@reconnect
|
@reconnect
|
||||||
Scenario: kernel reconnect succeeds
|
Scenario: kernel reconnect succeeds
|
||||||
Given new default notebook
|
Given new default notebook
|
||||||
|
@ -58,3 +78,4 @@ Scenario: kernel reconnect succeeds
|
||||||
And header says "Kernel requires reconnect \<ein:notebook-mode-map>\[ein:notebook-reconnect-session-command]"
|
And header says "Kernel requires reconnect \<ein:notebook-mode-map>\[ein:notebook-reconnect-session-command]"
|
||||||
And I clear log expr "ein:log-all-buffer-name"
|
And I clear log expr "ein:log-all-buffer-name"
|
||||||
And my reconnect is questioned
|
And my reconnect is questioned
|
||||||
|
And I restart kernel
|
||||||
|
|
|
@ -231,18 +231,23 @@
|
||||||
(f-mkdir dir)
|
(f-mkdir dir)
|
||||||
(ein:testing-make-directory-level dir 1 (string-to-number width) (string-to-number depth))))
|
(ein:testing-make-directory-level dir 1 (string-to-number width) (string-to-number depth))))
|
||||||
|
|
||||||
|
(When "^\"\\(.+\\)\" should \\(not \\)?include \"\\(.+\\)\"$"
|
||||||
|
(lambda (variable negate value)
|
||||||
|
(let ((member-p (member value (symbol-value (intern variable)))))
|
||||||
|
(if negate (should-not member-p) (should member-p)))))
|
||||||
|
|
||||||
(When "^I set \"\\(.+\\)\" to \"\\(.+\\)\"$"
|
(When "^I set \"\\(.+\\)\" to \"\\(.+\\)\"$"
|
||||||
(lambda (variable value)
|
(lambda (variable value)
|
||||||
(set (intern variable) value)))
|
(set (intern variable) value)))
|
||||||
|
|
||||||
|
(When "^I set \"\\(.+\\)\" to eval \"\\(.+\\)\"$"
|
||||||
|
(lambda (variable value)
|
||||||
|
(set (intern variable) (eval (car (read-from-string value))))))
|
||||||
|
|
||||||
(When "^I fset \"\\(.+\\)\" to \"\\(.+\\)\"$"
|
(When "^I fset \"\\(.+\\)\" to \"\\(.+\\)\"$"
|
||||||
(lambda (variable value)
|
(lambda (variable value)
|
||||||
(fset (intern variable) (function value))))
|
(fset (intern variable) (function value))))
|
||||||
|
|
||||||
(When "^I custom set \"\\(.+\\)\" to \"\\(.+\\)\"$"
|
|
||||||
(lambda (custom-variable value)
|
|
||||||
(customize-set-value (intern custom-variable) value)))
|
|
||||||
|
|
||||||
(When "^I get into notebook mode \"\\(.+\\)\" \"\\(.+\\)\"$"
|
(When "^I get into notebook mode \"\\(.+\\)\" \"\\(.+\\)\"$"
|
||||||
(lambda (notebook-dir file-path)
|
(lambda (notebook-dir file-path)
|
||||||
(When "I stop the server")
|
(When "I stop the server")
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
;;; debug-ein.el --- Debug ein.el
|
|
||||||
|
|
||||||
;; Copyright (C) 2012- Takafumi Arakaki
|
|
||||||
|
|
||||||
;; Author: Takafumi Arakaki <aka.tkf at gmail.com>
|
|
||||||
|
|
||||||
;; This file is NOT part of GNU Emacs.
|
|
||||||
|
|
||||||
;; debug-ein.el is free software: you can redistribute it and/or modify
|
|
||||||
;; it under the terms of the GNU General Public License as published by
|
|
||||||
;; the Free Software Foundation, either version 3 of the License, or
|
|
||||||
;; (at your option) any later version.
|
|
||||||
|
|
||||||
;; debug-ein.el is distributed in the hope that it will be useful,
|
|
||||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
;; GNU General Public License for more details.
|
|
||||||
|
|
||||||
;; You should have received a copy of the GNU General Public License
|
|
||||||
;; along with debug-ein.el. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
;;; Commentary:
|
|
||||||
|
|
||||||
;; emacs -Q -L path/to/nxhtml/util/ -l debug-ein.el
|
|
||||||
|
|
||||||
;;; Code:
|
|
||||||
|
|
||||||
(add-to-list 'load-path (file-name-directory load-file-name))
|
|
||||||
(require 'ein)
|
|
||||||
(require 'ein-dev)
|
|
||||||
|
|
||||||
(ein:dev-start-debug)
|
|
||||||
;; (ein:notebooklist-login ...)
|
|
||||||
|
|
||||||
|
|
||||||
;;; Extra stuff
|
|
||||||
|
|
||||||
(require 'markdown-mode nil t)
|
|
||||||
(require 'rst nil t)
|
|
||||||
|
|
||||||
(declare-function global-auto-complete-mode "auto-complete")
|
|
||||||
(when (featurep 'auto-complete)
|
|
||||||
(global-auto-complete-mode t)
|
|
||||||
(setq ein:use-auto-complete-superpack t))
|
|
||||||
|
|
||||||
(declare-function ein:smartrep-config "ein-smartrep")
|
|
||||||
(when (featurep 'smartrep)
|
|
||||||
(setq ein:use-smartrep t))
|
|
||||||
|
|
||||||
(custom-set-faces
|
|
||||||
;; Turn off background color for mumamo major chunk, to see
|
|
||||||
;; highlighting of prompt and stderr.
|
|
||||||
'(mumamo-background-chunk-major
|
|
||||||
((((class color) (min-colors 88) (background dark)) nil)))
|
|
||||||
;; '(mumamo-background-chunk-submode1
|
|
||||||
;; ((((class color) (min-colors 88) (background dark)) nil)))
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
;; Suppress this warning when using mumamo:
|
|
||||||
;; Warning: `font-lock-syntactic-keywords' is an obsolete variable (as of 24.1);
|
|
||||||
;; use `syntax-propertize-function' instead.
|
|
||||||
;; See: http://stackoverflow.com/a/5470584/727827
|
|
||||||
(when (and (equal emacs-major-version 24)
|
|
||||||
(equal emacs-minor-version 1))
|
|
||||||
(eval-after-load "bytecomp"
|
|
||||||
'(add-to-list 'byte-compile-not-obsolete-vars
|
|
||||||
'font-lock-syntactic-keywords)))
|
|
||||||
|
|
||||||
;;; debug-ein.el ends here
|
|
|
@ -34,6 +34,11 @@
|
||||||
|
|
||||||
|
|
||||||
;;; Configuration
|
;;; Configuration
|
||||||
|
(defcustom ein:use-auto-complete-superpack nil
|
||||||
|
"Set to `t' to use preset a little bit hacky auto-complete configuration.
|
||||||
|
When this option is enabled, cached omni completion is available."
|
||||||
|
:type 'boolean
|
||||||
|
:group 'ein-completion)
|
||||||
|
|
||||||
(defvar ein:ac-sources (and (boundp 'ac-sources)
|
(defvar ein:ac-sources (and (boundp 'ac-sources)
|
||||||
(default-value 'ac-sources))
|
(default-value 'ac-sources))
|
||||||
|
@ -238,14 +243,7 @@ Specifying non-`nil' to SUPERPACK enables richer auto-completion
|
||||||
(when superpack
|
(when superpack
|
||||||
(ein:ac-superpack)))
|
(ein:ac-superpack)))
|
||||||
|
|
||||||
|
(ein:ac-config ein:use-auto-complete-superpack)
|
||||||
(defvar ein:ac-config-once-called nil)
|
|
||||||
|
|
||||||
(defun ein:ac-config-once (&optional superpack)
|
|
||||||
(unless ein:ac-config-once-called
|
|
||||||
(setq ein:ac-config-once-called t)
|
|
||||||
(ein:ac-config superpack)))
|
|
||||||
|
|
||||||
(provide 'ein-ac)
|
(provide 'ein-ac)
|
||||||
|
|
||||||
;;; ein-ac.el ends here
|
;;; ein-ac.el ends here
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
(require 'ein-completer)
|
(require 'ein-completer)
|
||||||
(require 'company nil t)
|
(require 'company nil t)
|
||||||
|
|
||||||
|
(declare-function jedi:complete-request "jedi-core")
|
||||||
|
|
||||||
(autoload 'company-begin-backend "company")
|
(autoload 'company-begin-backend "company")
|
||||||
(autoload 'company-doc-buffer "company")
|
(autoload 'company-doc-buffer "company")
|
||||||
|
|
||||||
|
@ -63,7 +65,7 @@
|
||||||
(defun ein:company--complete-jedi (fetcher-callback)
|
(defun ein:company--complete-jedi (fetcher-callback)
|
||||||
(deferred:$
|
(deferred:$
|
||||||
(deferred:parallel
|
(deferred:parallel
|
||||||
;; (jedi:complete-request) ;; we need tkf-emacs submodule
|
(jedi:complete-request)
|
||||||
(ein:company--deferred-complete))
|
(ein:company--deferred-complete))
|
||||||
(deferred:nextc it
|
(deferred:nextc it
|
||||||
(lambda (replies)
|
(lambda (replies)
|
||||||
|
@ -94,11 +96,9 @@
|
||||||
(eql it 'ein:connect-mode)))
|
(eql it 'ein:connect-mode)))
|
||||||
minor-mode-list)
|
minor-mode-list)
|
||||||
(ein:object-at-point)))
|
(ein:object-at-point)))
|
||||||
(annotation (if ein:allow-company-annotations
|
(annotation (let ((kernel (ein:get-kernel)))
|
||||||
(let ((kernel (ein:get-kernel)))
|
|
||||||
(ein:aif (gethash arg (ein:$kernel-oinfo-cache kernel))
|
(ein:aif (gethash arg (ein:$kernel-oinfo-cache kernel))
|
||||||
(plist-get it :definition)
|
(plist-get it :definition))))
|
||||||
""))))
|
|
||||||
(doc-buffer (lexical-let ((arg arg))
|
(doc-buffer (lexical-let ((arg arg))
|
||||||
(cons :async
|
(cons :async
|
||||||
(lambda (cb)
|
(lambda (cb)
|
||||||
|
@ -109,7 +109,7 @@
|
||||||
(ein:pytools-find-source (ein:get-kernel-or-error)
|
(ein:pytools-find-source (ein:get-kernel-or-error)
|
||||||
obj
|
obj
|
||||||
cb)))))
|
cb)))))
|
||||||
(candidates () (or
|
(candidates (or
|
||||||
(ein:completions--find-cached-completion (ein:object-at-point)
|
(ein:completions--find-cached-completion (ein:object-at-point)
|
||||||
(ein:$kernel-oinfo-cache (ein:get-kernel-or-error)))
|
(ein:$kernel-oinfo-cache (ein:get-kernel-or-error)))
|
||||||
(lexical-let ((kernel (ein:get-kernel-or-error))
|
(lexical-let ((kernel (ein:get-kernel-or-error))
|
||||||
|
@ -124,7 +124,6 @@
|
||||||
(lambda (cb)
|
(lambda (cb)
|
||||||
(ein:company--complete cb)))))))))))
|
(ein:company--complete cb)))))))))))
|
||||||
|
|
||||||
|
|
||||||
(defun ein:company-backend--punctuation-check (thing col)
|
(defun ein:company-backend--punctuation-check (thing col)
|
||||||
(let ((query (ein:trim-right (subseq thing 0 col) "[\n]")))
|
(let ((query (ein:trim-right (subseq thing 0 col) "[\n]")))
|
||||||
(string-match "[]()\",[{}'=: ]$" query (- col 2))))
|
(string-match "[]()\",[{}'=: ]$" query (- col 2))))
|
||||||
|
@ -144,5 +143,7 @@
|
||||||
:callback cb)))))
|
:callback cb)))))
|
||||||
|
|
||||||
(setq ein:complete-on-dot nil)
|
(setq ein:complete-on-dot nil)
|
||||||
|
(when (boundp 'company-backends)
|
||||||
|
(add-to-list 'company-backends 'ein:company-backend))
|
||||||
|
|
||||||
(provide 'ein-company)
|
(provide 'ein-company)
|
||||||
|
|
|
@ -38,15 +38,14 @@
|
||||||
(require 'dash)
|
(require 'dash)
|
||||||
|
|
||||||
(defun ein:completer-choose ()
|
(defun ein:completer-choose ()
|
||||||
(require 'ein-ac)
|
|
||||||
(cond
|
(cond
|
||||||
((and (or (eql ein:completion-backend 'ein:use-ac-backend)
|
((and (or (eq ein:completion-backend 'ein:use-ac-backend)
|
||||||
(eql ein:completion-backend 'ein:use-ac-jedi-backend))
|
(eq ein:completion-backend 'ein:use-ac-jedi-backend))
|
||||||
(ein:eval-if-bound 'auto-complete-mode)
|
(ein:eval-if-bound 'auto-complete-mode)
|
||||||
(fboundp 'ein:completer-finish-completing-ac))
|
(fboundp 'ein:completer-finish-completing-ac))
|
||||||
#'ein:completer-finish-completing-ac)
|
#'ein:completer-finish-completing-ac)
|
||||||
(t
|
((eq ein:completion-backend 'ein:use-none-backend) #'ignore)
|
||||||
#'ein:completer-finish-completing-default)))
|
(t #'ein:completer-finish-completing-default)))
|
||||||
|
|
||||||
(defun ein:completer-beginning (matched-text)
|
(defun ein:completer-beginning (matched-text)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
|
@ -113,9 +112,8 @@
|
||||||
|
|
||||||
(defcustom ein:complete-on-dot t
|
(defcustom ein:complete-on-dot t
|
||||||
"Start completion when inserting a dot. Note that
|
"Start completion when inserting a dot. Note that
|
||||||
`ein:use-auto-complete' (or `ein:use-auto-complete-superpack')
|
`ein:use-auto-complete-superpack' must be `t' to enable this option.
|
||||||
must be `t' to enable this option. This variable has effect on
|
This variable has effect on notebook buffers and connected buffers."
|
||||||
notebook buffers and connected buffers."
|
|
||||||
:type 'boolean
|
:type 'boolean
|
||||||
:group 'ein-completion)
|
:group 'ein-completion)
|
||||||
|
|
||||||
|
|
|
@ -395,18 +395,20 @@ notebook."
|
||||||
:keymap ein:connect-mode-map
|
:keymap ein:connect-mode-map
|
||||||
:group 'ein
|
:group 'ein
|
||||||
(case ein:completion-backend
|
(case ein:completion-backend
|
||||||
(ein:use-ac-backend (ein:complete-on-dot-install ein:connect-mode-map)
|
(ein:use-ac-backend
|
||||||
(auto-complete-mode +1))
|
(assert (featurep 'ein-ac))
|
||||||
(ein:use-ac-jedi-backend (ein:jedi-complete-on-dot-install ein:connect-mode-map)
|
(ein:complete-on-dot-install ein:connect-mode-map)
|
||||||
(auto-complete-mode +1))
|
(auto-complete-mode))
|
||||||
(ein:use-company-backend (company-mode +1)
|
(ein:use-ac-jedi-backend
|
||||||
(when (boundp 'company-backends)
|
(assert (featurep 'ein-ac))
|
||||||
(add-to-list 'company-backends 'ein:company-backend)))
|
(ein:jedi-complete-on-dot-install ein:connect-mode-map)
|
||||||
(ein:use-company-jedi-backend (company-mode +1)
|
(auto-complete-mode))
|
||||||
(when (boundp 'company-backends)
|
(ein:use-company-backend
|
||||||
(add-to-list 'company-backends 'ein:company-backend)))
|
(assert (featurep 'ein-company))
|
||||||
|
(company-mode))
|
||||||
(t (warn "No autocompletion backend has been selected - see `ein:completion-backend'."))))
|
(ein:use-company-jedi-backend
|
||||||
|
(assert (featurep 'ein-company))
|
||||||
|
(company-mode))))
|
||||||
|
|
||||||
(put 'ein:connect-mode 'permanent-local t)
|
(put 'ein:connect-mode 'permanent-local t)
|
||||||
|
|
||||||
|
|
|
@ -68,8 +68,7 @@
|
||||||
(ein:notebook-kill-all-buffers)
|
(ein:notebook-kill-all-buffers)
|
||||||
(makunbound 'ein:notebook-mode-map) ; so defvar works.
|
(makunbound 'ein:notebook-mode-map) ; so defvar works.
|
||||||
(load "ein-notebook") ; ... but make sure it will be defined first.
|
(load "ein-notebook") ; ... but make sure it will be defined first.
|
||||||
(ein:load-files "^ein-.*\\.el$")
|
(ein:load-files "^ein-.*\\.el$"))
|
||||||
(ein:subpackages-reload))
|
|
||||||
|
|
||||||
(defun* ein:dev-require-all (&key (ignore-p #'ignore))
|
(defun* ein:dev-require-all (&key (ignore-p #'ignore))
|
||||||
(loop for f in (directory-files ein:source-dir nil "^ein-.*\\.el$")
|
(loop for f in (directory-files ein:source-dir nil "^ein-.*\\.el$")
|
||||||
|
|
|
@ -29,9 +29,10 @@
|
||||||
(require 'jedi nil t)
|
(require 'jedi nil t)
|
||||||
(require 'jedi-core nil t)
|
(require 'jedi-core nil t)
|
||||||
|
|
||||||
(require 'ein-ac)
|
|
||||||
(require 'ein-completer)
|
(require 'ein-completer)
|
||||||
(eval-when-compile (require 'ein-connect))
|
(eval-when-compile (require 'ein-connect))
|
||||||
|
(declare-function jedi:complete-request "jedi-core")
|
||||||
|
(declare-function ein:ac-prepare-completion "ein-ac")
|
||||||
|
|
||||||
(defvar ein:jedi-dot-complete-sources
|
(defvar ein:jedi-dot-complete-sources
|
||||||
'(ac-source-jedi-direct ac-source-ein-direct))
|
'(ac-source-jedi-direct ac-source-ein-direct))
|
||||||
|
@ -57,7 +58,7 @@
|
||||||
(lexical-let ((expand expand))
|
(lexical-let ((expand expand))
|
||||||
(deferred:$
|
(deferred:$
|
||||||
(deferred:parallel ; or `deferred:earlier' is better?
|
(deferred:parallel ; or `deferred:earlier' is better?
|
||||||
;; (jedi:complete-request) ;; need tkf/emacs-jedi submodule
|
(jedi:complete-request) ;; need tkf/emacs-jedi submodule
|
||||||
(ein:jedi--completer-complete))
|
(ein:jedi--completer-complete))
|
||||||
(deferred:nextc it
|
(deferred:nextc it
|
||||||
(lambda (replies)
|
(lambda (replies)
|
||||||
|
|
|
@ -47,20 +47,11 @@
|
||||||
:group 'ein)
|
:group 'ein)
|
||||||
|
|
||||||
(defun ein:smartrep-config ()
|
(defun ein:smartrep-config ()
|
||||||
(interactive)
|
|
||||||
(smartrep-define-key
|
(smartrep-define-key
|
||||||
ein:notebook-mode-map
|
ein:notebook-mode-map
|
||||||
"C-c"
|
"C-c"
|
||||||
ein:smartrep-notebook-mode-alist))
|
ein:smartrep-notebook-mode-alist))
|
||||||
|
|
||||||
|
|
||||||
(defvar ein:smartrep-config-once-called nil)
|
|
||||||
|
|
||||||
(defun ein:smartrep-config-once ()
|
|
||||||
(unless ein:smartrep-config-once-called
|
|
||||||
(setq ein:smartrep-config-once-called t)
|
|
||||||
(ein:smartrep-config)))
|
|
||||||
|
|
||||||
(provide 'ein-smartrep)
|
(provide 'ein-smartrep)
|
||||||
|
|
||||||
;;; ein-smartrep.el ends here
|
;;; ein-smartrep.el ends here
|
||||||
|
|
|
@ -25,11 +25,9 @@
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(eval-when-compile (defvar ein:ac-config-once-called)
|
(eval-when-compile (defvar ein:smartrep-config-once-called))
|
||||||
(defvar ein:smartrep-config-once-called))
|
|
||||||
|
|
||||||
(declare-function ein:ac-config-once "ein-ac")
|
(declare-function ein:smartrep-config "ein-smartrep")
|
||||||
(declare-function ein:smartrep-config-once "ein-smartrep")
|
|
||||||
|
|
||||||
(defcustom ein:completion-backend 'ein:use-ac-backend
|
(defcustom ein:completion-backend 'ein:use-ac-backend
|
||||||
"Determines which completion backend to use in opened EIN notebooks.
|
"Determines which completion backend to use in opened EIN notebooks.
|
||||||
|
@ -41,32 +39,14 @@ you restart Emacs. The available completion backends are::
|
||||||
* ein:use-ac-jedi-backend : Use auto-complete with the Jedi backend.
|
* ein:use-ac-jedi-backend : Use auto-complete with the Jedi backend.
|
||||||
* ein:use-company-backend : Use company-mode with IPython's builtin completion engine.
|
* ein:use-company-backend : Use company-mode with IPython's builtin completion engine.
|
||||||
* ein:use-company-jedi-backends : Use company-mode with the Jedi backend (currently not implemented).
|
* ein:use-company-jedi-backends : Use company-mode with the Jedi backend (currently not implemented).
|
||||||
* ein:use-custom-backend: EIN will not enable any backend, leaving it to the user to configure their own custom solution.
|
* ein:use-none-backend: Avoid autocomplete altogether
|
||||||
"
|
"
|
||||||
:type '(choice
|
:type '(choice
|
||||||
(const ein:use-ac-backend)
|
(const ein:use-ac-backend)
|
||||||
(const ein:use-ac-jedi-backend)
|
(const ein:use-ac-jedi-backend)
|
||||||
(const ein:use-company-backend)
|
(const ein:use-company-backend)
|
||||||
(const ein:use-company-jedi-backend)
|
(const ein:use-company-jedi-backend)
|
||||||
(const ein:use-custom-backed))
|
(const ein:use-none-backend))
|
||||||
:group 'ein-completion)
|
|
||||||
|
|
||||||
(defcustom ein:allow-company-annotations nil
|
|
||||||
"Allow annotations to be shown when using the company completion backend in EIN. You can disable this if you are seeing poor performance completing symbols."
|
|
||||||
:type 'boolean
|
|
||||||
:group 'ein-completion)
|
|
||||||
|
|
||||||
;; (defcustom ein:use-auto-complete nil
|
|
||||||
;; "Set to `t' to use preset auto-complete configuration.
|
|
||||||
;; Use `ein:use-auto-complete-superpack' when you need more powerful
|
|
||||||
;; auto completion."
|
|
||||||
;; :type 'boolean
|
|
||||||
;; :group 'ein-completion)
|
|
||||||
|
|
||||||
(defcustom ein:use-auto-complete-superpack nil
|
|
||||||
"Set to `t' to use preset a little bit hacky auto-complete configuration.
|
|
||||||
When this option is enabled, cached omni completion is available."
|
|
||||||
:type 'boolean
|
|
||||||
:group 'ein-completion)
|
:group 'ein-completion)
|
||||||
|
|
||||||
(defcustom ein:use-smartrep nil
|
(defcustom ein:use-smartrep nil
|
||||||
|
@ -85,47 +65,17 @@ When this option is enabled, cached omni completion is available."
|
||||||
:type 'boolean
|
:type 'boolean
|
||||||
:group 'ein)
|
:group 'ein)
|
||||||
|
|
||||||
(defcustom ein:load-dev nil
|
|
||||||
"Load development helper."
|
|
||||||
:type 'boolean
|
|
||||||
:group 'ein)
|
|
||||||
|
|
||||||
(defun ein:subpackages-load ()
|
(defun ein:subpackages-load ()
|
||||||
"Load sub-packages depending on configurations."
|
"Load sub-packages depending on configurations."
|
||||||
(cl-ecase ein:completion-backend
|
(cl-case ein:completion-backend
|
||||||
(ein:use-ac-backend (require 'ein-ac)
|
(ein:use-ac-backend (require 'ein-ac))
|
||||||
(ein:ac-config-once ein:use-auto-complete-superpack))
|
(ein:use-ac-jedi-backend (require 'ein-ac))
|
||||||
(ein:use-ac-jedi-backend (require 'ein-jedi)
|
(ein:use-company-backend (require 'ein-company))
|
||||||
;; (jedi:setup) ;; need tkf/emacs-jedi submodule
|
(ein:use-company-jedi-backend (require 'ein-company)))
|
||||||
(ein:jedi-setup)
|
|
||||||
(ein:ac-config-once ein:use-auto-complete-superpack))
|
|
||||||
(ein:use-company-backend (require 'ein-company)
|
|
||||||
(when (boundp 'company-backends)
|
|
||||||
(add-to-list 'company-backends 'ein:company-backend)))
|
|
||||||
(ein:use-company-jedi-backend (require 'ein-company)
|
|
||||||
(when (boundp 'company-backends)
|
|
||||||
(add-to-list 'company-backends 'ein:company-backend)))
|
|
||||||
(ein:use-custom-backend (warn "Automatic configuration of autocompletiong for EIN is disabled."))
|
|
||||||
(t (if (and (boundp 'ein:use-auto-complete)
|
|
||||||
(not (featurep 'company)))
|
|
||||||
(progn
|
|
||||||
(warn "ein:use-auto-complete has been deprecated. Please see `ein:completion-backend' for configuring autocompletion in ein.")
|
|
||||||
(setq ein:completion-backend 'ein:use-ac-backend)
|
|
||||||
(require 'ein-ac)
|
|
||||||
(ein:ac-config-once ein:use-auto-complete-superpack)))))
|
|
||||||
(when ein:use-smartrep
|
(when ein:use-smartrep
|
||||||
(require 'ein-smartrep)
|
(with-eval-after-load "ein-smartrep"
|
||||||
(ein:smartrep-config-once))
|
(ein:smartrep-config))
|
||||||
(when ein:load-dev
|
(require 'ein-smartrep)))
|
||||||
(require 'ein-dev)))
|
|
||||||
|
|
||||||
|
|
||||||
(defun ein:subpackages-reload ()
|
|
||||||
"Reload sub-packages."
|
|
||||||
(interactive)
|
|
||||||
(setq ein:ac-config-once-called nil)
|
|
||||||
(setq ein:smartrep-config-once-called nil)
|
|
||||||
(ein:subpackages-load))
|
|
||||||
|
|
||||||
(provide 'ein-subpackages)
|
(provide 'ein-subpackages)
|
||||||
|
|
||||||
|
|
|
@ -9,5 +9,4 @@
|
||||||
(with-current-buffer "*scratch*"
|
(with-current-buffer "*scratch*"
|
||||||
(erase-buffer))
|
(erase-buffer))
|
||||||
(ein:process-divine-dir 1 "" "*scratch*")
|
(ein:process-divine-dir 1 "" "*scratch*")
|
||||||
(ein:process-divine-port 1 "" "*scratch*")
|
(ein:process-divine-port 1 "" "*scratch*"))
|
||||||
(should (zerop (with-current-buffer "*scratch*" (length (buffer-string))))))
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue