From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Completion Date: Sat, 01 Sep 2018 11:51:52 +0200 Organization: Programmerer Ingebrigtsen Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1535796185 21707 195.159.176.226 (1 Sep 2018 10:03:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 1 Sep 2018 10:03:05 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 01 12:03:01 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fw2k9-0005VI-4L for ged-emacs-devel@m.gmane.org; Sat, 01 Sep 2018 12:03:01 +0200 Original-Received: from localhost ([::1]:36361 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fw2mF-00082W-8K for ged-emacs-devel@m.gmane.org; Sat, 01 Sep 2018 06:05:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40134) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fw2l6-0007Hc-9u for emacs-devel@gnu.org; Sat, 01 Sep 2018 06:04:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fw2ZW-0004zd-B5 for emacs-devel@gnu.org; Sat, 01 Sep 2018 05:52:05 -0400 Original-Received: from [195.159.176.226] (port=60280 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fw2ZW-0004zM-3b for emacs-devel@gnu.org; Sat, 01 Sep 2018 05:52:02 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fw2XL-0007k8-Nr for emacs-devel@gnu.org; Sat, 01 Sep 2018 11:49:47 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 60 Original-X-Complaints-To: usenet@blaine.gmane.org Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEUYFx2Li4/x8fMAAQYC BQsBAwoAAggEBw41D2olAAACYElEQVQ4jU2TQW7jMAxFaaAdb6UCA28nuYJarbOQo22BseQD2GK2 AiqPrj+fst2UiBGAzxT5P2WqLTIeItLXFhc8VKtDVNfwCd6+weiCC9Ot0z+ApKfQInnqkLtqfdE7 CN9R85sADYBwk/PVebxRau0aIAHPEvzPKEG+J19aTcvPtU4zNbCRxym1+qm9TX31ABc9OKqjK2Md S3EupBuUQiXATNuETEj4YebPl9rvIKBHcTGCRE7BZ6qiRA9JphoDh8SJEUmrThQOTBiqyETRmuX9 32enxBXdo6LUcQcIcbh50kdq8qZ7CtYa85EPs4ZIo2jDpEuaFpPmfSUKFTIsBkXfOrLPreCqXtHc TdKD4wPdzh2qzUJH84l5luXuBVd1l6mauZzWis56B38iy2rFvxBXKTiWrrhVIB9hyPwEw/tKzntp wkmAPgE/2s6DOIibcPa+DukJmNf8BByo3armbPDfV3FAcyfuSp5jOEv0b15l3BE74YRlzYeF6pd5 wBK3kaIFZnHIovCi1V8AaUHUozdZDNbWpL7sKovq4SsveTM87d0vPYD3lXIo2+NlsTYcH4K6T+gB gLMyG2PTAfTrLEdR3lzpe8OGbyeYMG4mj9sfa+KFP7v9qCjgVsIDt1eAnRvQzXZR+OhrxsRmWaHw omR6ETjG1JdwR3eI0VpRia0Ci4rzl7GLMQuuXEcU7QkCkkYeYyEe3x90YFzX1nEA2IXDNtFR2nWL Zo8nqNg5CpYD3LCtfmG/35IfIOWtLoZnsV3yHy1rzzesXJ8qxDaAfzYHKL5OYwoLx70A2uqG7+E/ q98q+CkFXPwAAAAASUVORK5CYII= Mail-Copies-To: never Cancel-Lock: sha1:LmhrwYHw6/uaZDxQ1ndzeF2fGkY= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:229159 Archived-At: I've been looking at the completion functions and documentation for pretty much the first time in my life this morning, and I've got some questions. :-/ 1) From 20.6.7 Programmed Completion ‘nil’ This specifies a ‘try-completion’ operation. The function should return ‘t’ if the specified string is a unique and exact match; if there is more than one match, it should return the common substring of all matches (if the string is an exact match for one completion alternative but also matches other longer alternatives, the return value is the string); if there are no matches, it should return ‘nil’. Let's say the set is '("foo" "zot") and the string is "fo". Then there's one match, and it's unique, of course. But it's not exact? So should it return nil, then? 2) The entire `completing-read' machinery is based on prefix, matches and nothing else; is that right? That is, if you want to do completion on words inside strings (for instance, if you want "foo" to have a match in a collection string like "zot foo bar", then there is no built-in machinery in Emacs for this? 3) The completion selection machinery in simple.el is nice, but it would be nice to be able to pass more information about the strings into it and get it all back after the user has chosen something. The obvious thing is to put a text property on the strings, and that almost, almost works, except for this: (defun choose-completion (&optional event) "Choose the completion at point. If EVENT, use EVENT's position to determine the starting position." [...] (setq end (or (next-single-property-change end 'mouse-face) (point-max))) (buffer-substring-no-properties beg end))))) If that had been just `buffer-substring', then the information would survive back to the caller. `minibuffer-allow-text-properties' exists. Would it make sense to add a new variable, like `completion-allow-text-properties', to handle this case as well? Like I said, this entire area is new to me, so I may be misunderstanding something here... -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no