This same thought occurred to me this weekend, without even having read this
thread. Try this code out and let me know what you think...
Cheers,
/Nick
(defun njs-try-complete-java-symbol (old)
"A function to use with `hippie-expand-try-functions-list' that
allows completion of java symbols at point. Uses the JDE's
completion facitily."
(when (not old)
(let ((pair (jde-complete-java-variable-at-point)))
(when pair
(save-excursion
(goto-char jde-complete-current-beginning)
(if (and (> (length (car pair)) 0)
(search-backward (car pair) nil t))
(set-marker jde-complete-current-beginning (point))))
(condition-case err
(jde-complete-find-completion-for-pair pair)
(error (setq jde-complete-current-list nil)))
(if jde-complete-current-list
(progn
(setq hippie-expand-verbose nil)
(he-init-string jde-complete-current-beginning
jde-complete-current-end)
(setq he-expand-list jde-complete-current-list))
(setq he-expand-list ())))))
(while (and he-expand-list
(he-string-member (caar he-expand-list) he-tried-table))
(setq he-expand-list (cdr he-expand-list)))
(if (null he-expand-list)
(progn
(when old
(setq hippie-expand-verbose t)
(he-reset-string))
())
(he-substitute-string (concat he-search-string (caar he-expand-list))
nil)
(message "%s" (cdar he-expand-list))
(setq he-expand-list (cdr he-expand-list))
t))
;; Change the content of `hippie-expand-try-functions-list' to your liking.
(add-hook 'jde-mode-hook
(function (lambda ()
(set (make-local-variable
'hippie-expand-try-functions-list)
'(try-expand-line
try-expand-list
njs-try-complete-java-symbol
try-expand-dabbrev
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill)))))
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]
> Sent: Friday, February 02, 2001 10:08 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: RE: hippie-expand
>
>
> Hi Steff,
>
> Maybe what I wanted to do makes sense, I don't know.
>
> I thought it would be useful to have hippie-expand first try to use
> jde-complete-at-point to complete java methods and fields. To
> do this,
> you have to add jde-complete-at-point to the list of completion
> functions that hippie-expands tries. You cannot just add
> jde-complete-at-point because hippie-expand expects all of its try
> functions to obey some pre-defined semantics. More detailed
> explanation
> and examples of this can be found in hippie-exp.el in the FSF Emacs
> lisp directory.
>
> Thanks!
>
> Chuck
>
> > -----Original Message-----
> > From: s.nicolas [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, February 02, 2001 1:26 AM
> > To: Chuck.Irvine
> > Subject: Re: hippie-expand
> >
> >
> > Hi chuck,
> >
> > I didn't understand very well your hippie-expand feature,
> > shall yuo explain it to me, i could help yu as I contributed to the
> > completion facility.
> >
> > Steff
> >
> > [EMAIL PROTECTED] wrote:
> >
> > > This has promise! The first thing that crossed my mind is
> writing a
> > > "try-jde-complete-at-point" function with the obvious
> > functionality. I
> > > looked in the hippie-exp.el for instructions on doing this and it
> > > looked a little more complicated then I expected. This
> looks useful
> > > enough that I'm determined to do it, unless someone already
> > has, that
> > > is. Anyone? Thanks!
> > >
> > > Chuck
> > >
> > > > -----Original Message-----
> > > > From: sandip.chitale [mailto:[EMAIL PROTECTED]]
> > > > Sent: Thursday, February 01, 2001 12:46 PM
> > > > To: jde
> > > > Cc: sandip.chitale
> > > > Subject: hippie-expand
> > > >
> > > >
> > > > Folks,
> > > >
> > > > Some one was asking about being able to complete
> > > > paths in the customization buffer while setting global
> > > > classpath etc.
> > > >
> > > > I want to bering to your attention the following -
> > > >
> > > > hippie-expand is an interactive compiled Lisp function in
> > > > `hippie-exp'.
> > > > (hippie-expand ARG)
> > > >
> > > > Try to expand text before point, using multiple methods.
> > > > The expansion functions in
> `hippie-expand-try-functions-list' are
> > > > tried in order, until a possible expansion is found. Repeated
> > > > application of `hippie-expand' inserts successively possible
> > > > expansions.
> > > > With a positive numeric argument, jumps directly to the ARG next
> > > > function in this list. With a negative argument or just C-u,
> > > > undoes the expansion.
> > > >
> > > > where -
> > > > hippie-expand-try-functions-list's value is
> > > > (try-complete-file-name-partially try-complete-file-name
> > > > try-expand-all-abbrevs try-expand-list try-expand-line
> > > > try-expand-dabbrev
> > > > try-expand-dabbrev-all-buffers try-expand-dabbrev-from-kill
> > > > try-complete-lisp-symbol-partially try-complete-lisp-symbol)
> > > >
> > > >
> > > > Documentation:
> > > > The list of expansion functions tried in order by
> `hippie-expand'.
> > > > To change the behavior of `hippie-expand', remove, change the
> > > > order of,
> > > > or insert functions in this list.
> > > >
> > > > I bind it to the CTRL-TAB and it works great in any buffer.
> > > >
> > > > (global-set-key [C-tab] 'hippie-expand)
> > > >
> > > > HTH,
> > > > sandip
> > > >
> > > >
> >
> >
> >
>