Skip to content

Fix completion-at-point functions #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 5 additions & 17 deletions gnuplot-context.el
Original file line number Diff line number Diff line change
Expand Up @@ -2054,23 +2054,11 @@ there."

(defun gnuplot-context-completion-at-point ()
"Return completions of keyword preceding point, using context."
(let* ((end (point))
(beg
(save-excursion
(skip-syntax-backward "w_" (gnuplot-point-at-beginning-of-command))
(point)))
(word nil)
(completions (gnuplot-completions)))

(setq word (buffer-substring beg end)
completions (all-completions word completions))

(if completions
(list beg end completions)
(if (not (equal "" word))
(message "No gnuplot keywords complete '%s'" word)
(message "No completions at point"))
nil)))
(list (save-excursion
(skip-syntax-backward "w_" (gnuplot-point-at-beginning-of-command))
(point))
(point)
(gnuplot-completions)))

;; Eldoc help
(defun gnuplot-eldoc-function ()
Expand Down
20 changes: 5 additions & 15 deletions gnuplot.el
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,6 @@ beginning the continued command."
"A list of keywords used in GNUPLOT.
These are set by `gnuplot-set-keywords-list' from the values in
`info-lookup-cache'.")
(defvar gnuplot-keywords-alist nil) ;; For all-completions
(defvar gnuplot-keywords-pending t ;; <HW>
"A boolean which gets toggled when the info file is probed.")
(defcustom gnuplot-keywords-when 'deferred ;; 'immediately
Expand Down Expand Up @@ -1944,8 +1943,7 @@ See the comments in `gnuplot-info-hook'."
;; user will not want them lying around
(and (get-buffer "info dir") (kill-buffer "info dir"))
(and (get-buffer "info dir<2>") (kill-buffer "info dir<2>")))
(setq gnuplot-keywords (gnuplot-set-keywords-list))
(setq gnuplot-keywords-alist (mapcar 'list gnuplot-keywords)))
(setq gnuplot-keywords (gnuplot-set-keywords-list)))

(defun gnuplot-set-keywords-list ()
"Set `gnuplot-keywords' from `info-lookup-cache'.
Expand Down Expand Up @@ -2078,18 +2076,10 @@ positions and COMPLETIONS is a list."

(if gnuplot-keywords-pending ; <HW>
(gnuplot-setup-info-look))
(let* ((end (point))
(beg (condition-case _err
(save-excursion (backward-sexp 1) (point))
(error (point))))
(patt (buffer-substring beg end))
(pattern (if (string-match "\\([^ \t]*\\)\\s-+$" patt)
(match-string 1 patt) patt))
(completions (all-completions pattern gnuplot-keywords-alist)))
(if completions
(list beg end completions)
(message "No gnuplot keywords complete '%s'" pattern)
nil)))
(list (condition-case _err
(save-excursion (backward-sexp 1) (point))
(error (point)))
(point) gnuplot-keywords))


(defun gnuplot-info-lookup-symbol (symbol &optional mode)
Expand Down