diff --git a/gnuplot-context.el b/gnuplot-context.el index 8911003..00230ea 100644 --- a/gnuplot-context.el +++ b/gnuplot-context.el @@ -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 () diff --git a/gnuplot.el b/gnuplot.el index 5c3e1c0..b3c1f3a 100644 --- a/gnuplot.el +++ b/gnuplot.el @@ -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 ;; "A boolean which gets toggled when the info file is probed.") (defcustom gnuplot-keywords-when 'deferred ;; 'immediately @@ -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'. @@ -2078,18 +2076,10 @@ positions and COMPLETIONS is a list." (if gnuplot-keywords-pending ; (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)