I'm using semantic-complete on xemacs. Well, trying anyway :). Xemacs
lacks `minibuffer-contents' and `compare-strings', so I was trying to
dive in to re-implement semantic-complete in a compatible way.
With regard to `compare-strings', it seems that the two uses of
compare-strings I found in semantic could be made compatible using
string= and substring, plus some (admittedly annoying) length checks:
RCS file: /cvsroot/cedet/cedet/semantic/semantic-find.el,v
retrieving revision 1.11
diff -r1.11 semantic-find.el
< `(let ((l (length ,prefix)))
> `(let ((l (length ,prefix))
< (eq (compare-strings ,prefix 0 nil
< (semantic-tag-name (car tags)) 0 l
> (setq tagstr (semantic-tag-name (car tags)))
> (and (>= (length tagstr) l)
> (string= ,prefix
> (substring tagstr 0 l))))
RCS file: /cvsroot/cedet/cedet/semantic/semantic-complete.el,v
retrieving revision 1.4
diff -r1.4 semantic-complete.el
[ ... ]
< (and (slot-boundp obj 'last-prefix)
< (eq (compare-strings (oref obj last-prefix) 0 nil
< prefix 0 (length prefix))
> (and (slot-boundp obj 'last-prefix)
> (string= (oref obj last-prefix) prefix)))
As for `minibuffer-contents', I was wondering: why
`read-from-minibuffer' needed to be used with a keymap when
`completing-read' with a completion function could work just as well?
Using `completing-read' would obviate the need to set "next-action"
symbols and such. I've just started trying to implement that as follows:
first, call `completing-read' instead of `read-from-minibuffer' in
< (read-from-minibuffer prompt
< (or history
> (completing-read prompt
> (or history
Then, define the function. This is a start but it doesn't move through
the source buffer yet. In fact I'm quite impressed and mystified how
The function I have here merely performs the proper minibuffer text
completion without the highlighting "focus" magic:
> (defun semantic-complete-function (str-to-complete pred-func
> "TABLE function for completing-read to perform actual completion."
> semantic-completion-collector-engine str-to-complete)
> (let* ((tblref
> (oref semantic-completion-display-engine table))
> (mapcar semantic-completion-displayor-format-tag-function
> ((not compl-flag)
> (if (not comp) nil
> (if (and (eq (length tblref) 1)
> (string= (car fmtlist) str-to-complete))
> ((eq compl-flag t)
> (eq comp str-to-complete)))))
In addition to not doing the highlighting, this function doesn't always
display the proper info such as "Complete but not unique", but it does
behave properly overall.
I wanted to submit it as-is to see if anyone had thoughts or thought
that this wasn't a good way to go. At least for `compare-strings', it's
not possible to specify case matching, so maybe there's a better way?
On Thu, 2003-05-01 at 23:12, Eric M. Ludlam wrote:
> Hi all,
> I checked in changes to semantic-complete that I'd been working on
> for a little while. I added the `focus' concept to the displayor
> class. The new focus baseclass has basic focusing code in it, and
> the concrete class `semantic-displayor-traditional-with-focus-highlight'
> multiply inherits.
> Thus if you run `semantic-complete-test', each subsequent complete
> cycles through completion, show completions, then focus on one
> element by highlighting it in the buffer. It's kind of spiffy. I
> suspect there is a bug or two hiding in there still, but I'm tired.
> Add to this the work I checked in a while ago for default values,
> and you've got a pretty nifty completing prompt.
> I still need to concoct a way to configure which collector and
> displayor you may customize for a given task, and then merge in
> Masatake's tooltip version. The tooltip version will be nifty for
> in-buffer completion.
> Have fun
Stuart Popejoy <stuart@...>
Pink Sheets LLC