unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 16604@debbugs.gnu.org
Subject: bug#16604: 24.3.50; False negatives in lisp-completion-at-point
Date: Sun, 02 Feb 2014 03:52:30 +0200	[thread overview]
Message-ID: <52EDA4DE.8050904@yandex.ru> (raw)
In-Reply-To: <jwv61p01ara.fsf-monnier+emacsbugs@gnu.org>

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





  parent reply	other threads:[~2014-02-02  1:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-31  4:46 bug#16604: 24.3.50; False negatives in lisp-completion-at-point Dmitry Gutov
2014-01-31 14:34 ` Stefan Monnier
2014-01-31 14:37   ` Dmitry Gutov
2014-01-31 15:05   ` Thierry Volpiatto
2014-02-02  1:52   ` Dmitry Gutov [this message]
2014-02-02  2:39     ` Stefan Monnier
2014-02-02  3:00       ` Dmitry Gutov
2014-02-02 14:12         ` Stefan Monnier
2014-02-02 18:24           ` Stefan Monnier
2014-02-03  2:03             ` Stefan Monnier
2014-02-03  3:48               ` Stefan Monnier
2014-02-04  5:37             ` Dmitry Gutov
2014-02-04 17:54               ` Stefan Monnier
2014-02-05  4:41                 ` Dmitry Gutov
2014-02-05 13:53                   ` Stefan Monnier
2014-02-06  1:38                     ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52EDA4DE.8050904@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=16604@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).