emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/gnuplot cc547ce0c8: Fix completion-at-point functions (#74


From: ELPA Syncer
Subject: [nongnu] elpa/gnuplot cc547ce0c8: Fix completion-at-point functions (#74)
Date: Wed, 29 Dec 2021 06:02:52 -0500 (EST)

branch: elpa/gnuplot
commit cc547ce0c86309c59d3aeaecbb202d9dd7144d91
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: GitHub <noreply@github.com>

    Fix completion-at-point functions (#74)
    
    According to the Emacs documentation the completion functions should not
    prefilter the candidates themselves. It is up to the completion UI to 
perform
    the filtering. By deferring the filtering to the completion UI various
    completion styles like substring, flex or orderless can be used. In 
contrast,
    the old implementation enforced prefix matching.
---
 gnuplot-context.el | 22 +++++-----------------
 gnuplot.el         | 20 +++++---------------
 2 files changed, 10 insertions(+), 32 deletions(-)

diff --git a/gnuplot-context.el b/gnuplot-context.el
index 8911003e70..00230ea1d0 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 5c3e1c0f3c..b3c1f3a8f1 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      ;; <HW>
   "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          ; <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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]