Commit 5b9b750a authored by Ted Zlatanov's avatar Ted Zlatanov
Browse files

Cleanup cfengine3-mode so complete-symbol works again.

* progmodes/cfengine.el (cfengine3--current-word): Remove.
(cfengine3--current-function): Bring in the current-function
functionality from `cfengine3--current-word'.
(cfengine3-completion-function): Bring in the
bounds-of-current-word functionality from
`cfengine3--current-word'.
parent 82cf20e4
2013-12-16 Teodor Zlatanov <tzz@lifelogs.com>
* progmodes/cfengine.el (cfengine3--current-word): Remove.
(cfengine3--current-function): Bring in the current-function
functionality from `cfengine3--current-word'.
(cfengine3-completion-function): Bring in the
bounds-of-current-word functionality from
`cfengine3--current-word'.
2013-12-16 Martin Rudalics <rudalics@gmx.at>
* window.el (display-buffer-below-selected): Bind
......
......@@ -1165,24 +1165,18 @@ Intended as the value of `indent-line-function'."
;; CLASS: [.|&!()a-zA-Z0-9_\200-\377]+::
;; CATEGORY: [a-zA-Z_]+:
(defun cfengine3--current-word (&optional bounds)
"Propose a word around point in the current CFEngine 3 buffer."
(save-excursion
(skip-syntax-forward "w_")
(when (search-backward-regexp
cfengine-mode-syntax-functions-regex
(point-at-bol)
t)
(if bounds
(list (point) (match-end 1))
(match-string 1)))))
(defun cfengine3--current-function ()
"Look up current CFEngine 3 function"
(let* ((syntax (cfengine3-make-syntax-cache))
(flist (assq 'functions syntax)))
(when flist
(let ((w (cfengine3--current-word)))
(let ((w (save-excursion
(skip-syntax-forward "w_")
(when (search-backward-regexp
cfengine-mode-syntax-functions-regex
(point-at-bol)
t)
(match-string 1)))))
(and w (assq (intern w) flist))))))
;; format from "cf-promises -s json", e.g. "sort" function:
......@@ -1271,7 +1265,10 @@ see. Use it by executing `turn-on-eldoc-mode'."
(defun cfengine3-completion-function ()
"Return completions for function name around or before point."
(cfengine3-make-syntax-cache)
(let* ((bounds (cfengine3--current-word t))
(let* ((bounds (save-excursion
(let ((p (point)))
(skip-syntax-backward "w_" (point-at-bol))
(list (point) p))))
(syntax (cfengine3-make-syntax-cache))
(flist (assq 'functions syntax)))
(when bounds
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment