unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Completion
@ 2018-09-01  9:51 Lars Ingebrigtsen
  2018-09-01 14:49 ` Completion Drew Adams
  2018-09-01 15:14 ` Completion Stefan Monnier
  0 siblings, 2 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2018-09-01  9:51 UTC (permalink / raw)
  To: emacs-devel

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





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-09-05 23:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-01  9:51 Completion Lars Ingebrigtsen
2018-09-01 14:49 ` Completion Drew Adams
2018-09-03 16:48   ` Completion Lars Ingebrigtsen
2018-09-01 15:14 ` Completion Stefan Monnier
2018-09-03 16:45   ` Completion Lars Ingebrigtsen
2018-09-03 17:19     ` Completion Stefan Monnier
2018-09-03 17:40       ` Completion Lars Ingebrigtsen
2018-09-05 23:03         ` Completion Stephen Leake

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).