From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] (icomplete-vertical-mode): Add support for affixations and, annotations Date: Wed, 26 May 2021 19:12:56 +0100 Message-ID: References: <87zgwlb4xc.fsf@gmail.com> <617d06ca-27bf-2ae8-26eb-1042123499d3@daniel-mendler.de> <87pmxhb1rs.fsf@gmail.com> <23510125-37b9-e87e-3590-5322f44772ce@daniel-mendler.de> <87a6olazff.fsf@gmail.com> <0a854bd9-27b0-3ed3-ba74-25d2765c083a@daniel-mendler.de> <87fsybiwcc.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31440"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Juri Linkov , Stefan Monnier , "emacs-devel@gnu.org" To: Daniel Mendler , daniel@dsemy.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed May 26 20:38:40 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1llyQS-00083V-Q4 for ged-emacs-devel@m.gmane-mx.org; Wed, 26 May 2021 20:38:40 +0200 Original-Received: from localhost ([::1]:45416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llyQR-000117-P4 for ged-emacs-devel@m.gmane-mx.org; Wed, 26 May 2021 14:38:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58168) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lly1y-0002cY-R9 for emacs-devel@gnu.org; Wed, 26 May 2021 14:13:22 -0400 Original-Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]:56265) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lly1n-0006kk-L4 for emacs-devel@gnu.org; Wed, 26 May 2021 14:13:22 -0400 Original-Received: by mail-pj1-x1029.google.com with SMTP id kr9so1255890pjb.5 for ; Wed, 26 May 2021 11:13:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=cIavdxVDUY6IEfyXVZD53BqK6E/YpgB3xeUBoxfZ9dk=; b=UQLC2D4CyZzIfbHwBtwqcd0Di8z/YIZDFUp4hNQzP1mIrSxcOQSv8ME3tf3+x1yXc1 FT08MPIzWyAQN74KUHbBygC8Rtf7s7Ew+Chgh7Py3D9ZsT35nEaHQyblivxA9eAV0JM+ 88dTS7rb+FXgPzkaBLuDrRQ83jXOJHO6RwXzoZgKpDYUSPPhUV4LehMTrqnoZMvMv8T2 IS6gmeLusKt99DTLu40gnTNSZfoNa3P1LQOsjR0faTvmtozI6jvh3XmOC/pK42LpjE5d 5K5O47L8yBCAiX3KFIGGO+e5doU/PQD6MgXjvGr3wOuPrmYu3BkdpuDivOtdtNydWTDT eNYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=cIavdxVDUY6IEfyXVZD53BqK6E/YpgB3xeUBoxfZ9dk=; b=dvCdEXFCNJMRWtoI2kVFdBMG7uo0PbwwR1TAU213L+eQnRvhYUp6+sXnM95ZXVcWWi DhDNHVQN6xT0gS1yFqgvDxQMCqLsH54OxdggL/UHRVUbk4RoHaoxcH9J+AeIfx4h3G+H bA8wcSZZk2aUI2e1bD1AgkvuLjm5rbklSeBFCNo07XmRQzPmOUww2Ex7aJrhsPnjvi6i lhnWCLvxZCoohl/QnhghTaYoUONmJkudyE0bT0HdOK0Dw2qwYs0FQnJgkZg2I9EppLlN E3Uh5FMW1il/lrPVVFTNT5WP04ul9r8g/4Ao4OFD5NfSQKY248C5nIZOjFkEMk5R29Or MITA== X-Gm-Message-State: AOAM5312dvr8UR0olTXoYQQ0ohaQRYxZqJk1qqofZFqHLtM1jNM8tKRv boot+gvHyISFU8RvE2/VEN05hANcpZoyNYvQtVc= X-Google-Smtp-Source: ABdhPJx3qiI5GewER7bJaAC+ktiJ/YRg7whZJTa7TkzFA9Fba4VNqaARO+1kUT8WHAjr+gYxRvG0mBfzcn4ptQhf6ls= X-Received: by 2002:a17:902:9348:b029:f0:d51a:7a4c with SMTP id g8-20020a1709029348b02900f0d51a7a4cmr36983051plp.60.1622052788527; Wed, 26 May 2021 11:13:08 -0700 (PDT) In-Reply-To: <87fsybiwcc.fsf@gmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=joaotavora@gmail.com; helo=mail-pj1-x1029.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:269923 Archived-At: > > Icomplete already should somehow work as a > > `completion-in-region-function`, but I think it is a bit brittle. > I have a vague recollection that Someone Somewhere (tm) in one of my > extensions over at GitHub tried it out and found it could mostly work > with some tweaks. Will search for it. Found it, it was in https://github.com/joaotavora/eglot/issues/577, and the author, Daniel Semyonov, is using `completing-read` directly. IOW it's not specific to icomplete at all. Here is his code. In that issue he states that Eglot's completion table is problematic, and he's probably right, but the general idea of making a completion-in-region-function from completing-read is very interesting. It would in principle mean that = every completing-read frontend could also be used in many other places. Jo=C3=A3o (defun init-ui-completing-read-in-region (start end col &optional pred) "Completion in region function utilizing `completing-read'." (if (minibufferp) (completion--in-region start end col pred) (let* ((buffer (current-buffer)) (pos (list start end)) (init (buffer-substring-no-properties start end)) (all (all-completions init col pred)) (try (try-completion init col pred))) (setq this-command #'completion-at-point) (cond ((or (eq try t) ; Sole completion. (and (=3D (length all) 1) (string=3D (car all) try))) (choose-completion-string (car all) buffer pos) t) ;; Commented out since try-completion erroneously returns nil. ;; ((and (null try) ; No completions. ;; (> (length init) 0)) ;; (message "No completion") ;; nil) (t ; Some completions. (choose-completion-string (completing-read "Completion: " col pred t init) buffer pos) t)))))