]> git.eshelyaron.com Git - kubed.git/commitdiff
; * kubed.el (kubed-list-read-filter): Also complete operators.
authorEshel Yaron <me@eshelyaron.com>
Thu, 1 Aug 2024 20:13:16 +0000 (22:13 +0200)
committerEshel Yaron <me@eshelyaron.com>
Thu, 1 Aug 2024 20:13:16 +0000 (22:13 +0200)
kubed.el

index 2073526a02d850e66e749356abdf459248502955..562d1f3585332d9c610cf47a5fe2997fe3b2f516 100644 (file)
--- a/kubed.el
+++ b/kubed.el
@@ -246,23 +246,28 @@ of the error, push a mark before moving point."
                      (with-temp-buffer
                        (set-syntax-table emacs-lisp-mode-syntax-table)
                        (insert "(" cont)
-                       (when-let ((f-a (elisp--fnsym-in-current-sexp))
-                                  ((car f-a))
-                                  (a (cadr f-a)))
-                         (cond
-                          ((= a 1)
-                           ;; Complete column names.
-                           (list (car bounds) (cdr bounds) cols))
-                          ((= a 2)
-                           ;; Complete column values.
-                           (when-let ((beg (nth 1 (syntax-ppss)))
-                                      (col (save-excursion
-                                             (goto-char beg)
-                                             (forward-char 1)
-                                             (forward-sexp 2)
-                                             (thing-at-point 'symbol))))
-                             (list (car bounds) (cdr bounds)
-                                   (alist-get col vals nil nil #'string=)))))))))
+                       (when-let ((fn-argi (elisp--fnsym-in-current-sexp))
+                                  (argi (cadr fn-argi)))
+                         (if (= argi 0)
+                             ;; Complete operators.
+                             (list (car bounds) (cdr bounds) '("=" "~"))
+                           (when (car fn-argi)
+                             (cond
+                              ((= argi 1)
+                               ;; Complete column names.
+                               (list (car bounds) (cdr bounds) cols))
+                              ((= argi 2)
+                               ;; Complete column values.
+                               (when-let ((beg (nth 1 (syntax-ppss)))
+                                          ;; Grab preceding symbol.
+                                          (col (save-excursion
+                                                 (goto-char beg)
+                                                 (forward-char 1)
+                                                 (forward-sexp 2)
+                                                 (thing-at-point 'symbol))))
+                                 (list (car bounds) (cdr bounds)
+                                       (alist-get col vals
+                                                  nil nil #'string=)))))))))))
                  nil t))
             (read-from-minibuffer
              (format-prompt prompt "disable")