mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-06 01:21:38 -05:00
Add ein:ac-chunk-candidates-from-list
This commit is contained in:
parent
2627157e60
commit
91861e8fd2
1 changed files with 30 additions and 0 deletions
|
@ -50,6 +50,36 @@
|
|||
table)
|
||||
"`ein:dotty-syntax-table' plus \"~\" considered as a word character.")
|
||||
|
||||
|
||||
;;; Chunk (adapted from auto-complete-chunk.el)
|
||||
|
||||
(defvar ein:ac-chunk-regex
|
||||
(rx (group-n 1 (| (syntax whitespace)
|
||||
(syntax open-parenthesis)
|
||||
(syntax close-parenthesis)
|
||||
bol))
|
||||
(* (+ (| (syntax word) (syntax symbol)))
|
||||
(syntax punctuation))
|
||||
(+ (| (syntax word) (syntax symbol)))
|
||||
(? (syntax punctuation))
|
||||
point)
|
||||
"A regexp that matches to a \"chunk\" containing words and dots.")
|
||||
|
||||
(defun ein:ac-chunk-beginning ()
|
||||
"Return the position where the chunk begins."
|
||||
(ignore-errors
|
||||
(save-excursion
|
||||
(+ (re-search-backward ein:ac-chunk-regex) (length (match-string 1))))))
|
||||
|
||||
(defun ein:ac-chunk-candidates-from-list (chunk-list)
|
||||
"Return matched candidates in CHUNK-LIST."
|
||||
(let* ((start (ein:ac-chunk-beginning)))
|
||||
(when start
|
||||
(loop with prefix = (buffer-substring start (point))
|
||||
for cc in chunk-list
|
||||
when (string-prefix-p prefix cc)
|
||||
collect cc))))
|
||||
|
||||
|
||||
;;; AC Source
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue