GNU bug report logs - #16604
24.3.50; False negatives in lisp-completion-at-point

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Fri, 31 Jan 2014 04:47:02 UTC

Severity: minor

Found in version 24.3.50

Fixed in version 24.4

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 16604 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 16604 <at> debbugs.gnu.org
Subject: Re: bug#16604: 24.3.50; False negatives in lisp-completion-at-point
Date: Sun, 02 Feb 2014 03:52:30 +0200
Is it okay to install the following patch?

On a related note, company-capf returns nil to `duplicates', but with 
the patch below, for example, I do receive duplicates from it. And with 
another, functional completion table I wrote in a third-party package. 
Should I change `duplicates' to t?

=== modified file 'lisp/emacs-lisp/lisp.el'
--- lisp/emacs-lisp/lisp.el	2014-01-01 07:43:34 +0000
+++ lisp/emacs-lisp/lisp.el	2014-02-02 01:42:32 +0000
@@ -830,7 +830,7 @@
                 ;; use it to provide a more specific completion table 
in some
                 ;; cases.  E.g. filter out keywords that are not 
understood by
                 ;; the macro/function being called.
-                (list nil (completion-table-in-turn
+                (list nil (completion-table-merge
                            lisp--local-variables-completion-table
                            obarray)       ;Could be anything.
                       :annotation-function

=== modified file 'lisp/minibuffer.el'
--- lisp/minibuffer.el	2014-01-07 23:36:29 +0000
+++ lisp/minibuffer.el	2014-02-02 01:46:41 +0000
@@ -393,6 +393,27 @@
                         (complete-with-action action table string pred))
                       tables)))

+(defun completion-table-merge (&rest tables)
+  "Create a completion table that collects completions from all TABLES."
+  ;; FIXME: same caveat as in `completion-table-in-turn', only harder
+  ;; to fix.
+  (lambda (string pred action)
+    (cond
+     ((null action)
+      (try-completion string
+                      (mapcar (lambda (table)
+                                (try-completion string table pred))
+                              tables)
+                      pred))
+     ((eq action t)
+      (apply #'append (mapcar (lambda (table)
+                                (all-completions string table pred))
+                              tables)))
+     ((not (or (eq (car-safe action) 'boundaries)
+               (eq action 'metadata)))
+      (completion--some (lambda (table) (test-completion string table 
pred))
+                        tables)))))
+
 (defun completion-table-with-quoting (table unquote requote)
   ;; A difficult part of completion-with-quoting is to map positions 
in the
   ;; quoted string to equivalent positions in the unquoted string and




This bug report was last modified 11 years and 112 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.