Re: JDE Complete Menu

2003-01-10 Thread Ole Arndt

Hi Jeba, Hi Paul,

Paul Kinnucan [EMAIL PROTECTED] writes:
 Jeba Bhaskaran writes:
   I am currently using dabbrev-completion to complete
   variable names in a Java buffer. How difficult would
   it be to add this functionality to the JDE Complete
   Menu function? For example, if there is a ., then
   the jde-complete-menu as it now would be called and if
   a . is not present then dabbrev-completion function
   would be called. Can this be added to the wish list? 
   
 
 This would be easy to do but I don't believe it is
 the right thing to do. I don't see the point of calling
 dabbrev to complete field and method names defined
 or inherited by the class in the current buffer.
 
 - Paul

I have a function `jde-indent-complete' which provides this
functionality.

Instead of dabbrev-expand I use hippie-expand, because of the support
semantic provides for it. Semantic automatically adds
`senator-try-expand-semantic' to your `hippie-expand-try-functions-list'.
This gives you local member name completion via semantic. If this fails,
hippie-expand calls abbrev-expand and dabbrev-expand afterwards.
For words with a dot in front `jde-complete' will be called.

I have bound this to function to TAB, so completion feels the same
as in the shell and in the rest of emacs. I couldn't live without it :-)

The function has gone though various changes/optimizations as my elisp
knowledge slowly grew from clueless to dilettante, here comes the
current version:

(defun jde-indent-complete ()
  A special indent/complete function. I calls three different
functions depending on context:

- The region is active:
reindent the region.

- The point is in front of the text on this line:
try to reindent the line. 

- The point is directly after a dot character (\.\) or in/at
   the end of a word starting with a dot:
call `jde-complete'

- Otherwise:
call `hippie-expand'

  (interactive)
  (if (mark-or-region-active)
  (indent-region (mark) (point) nil)
(if (save-excursion (skip-chars-backward  \t) (bolp))
(indent-for-tab-command)
  (if (not (equal major-mode 'jde-mode))
  (hippie-expand 1)
(if (or (char-equal (char-before) ?.)
(save-excursion (backward-word 1) 
(char-equal (char-before) ?.)))
(jde-complete)
  (hippie-expand 1))


; you probably need this also:

(require 'hippie-exp)
(setq hippie-expand-try-functions-list
  '(try-expand-all-abbrevs
try-expand-dabbrev
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill))


-- 
Ole Arndt http://www.sugarshark.com
---




Re: JDE Complete Menu

2003-01-10 Thread Jeba Bhaskaran
Hello Ole,
 I copied your code to my init.el file and getting the
following error when trying to use the method ( called
by M-x jde-indent-complete):

Signaling: (void-function mark-or-region-active)
  (mark-or-region-active)
  (if (mark-or-region-active) (indent-region (mark)
(point) nil) (if (save-excursion ... ...)
(indent-for-tab-command) (if ... ... ...)))
  (lambda nil A special indent/complete function. I
calls three different\nfunctions depending on
context:\n\n- The region is active:\nreindent
the region.\n\n- The point is in front of the text on
this line:\ntry to reindent the line. \n\n-
The point is directly after a dot character (\.\) or
in/at\n   the end of a word starting with a dot:\n
   call `jde-complete'\n\n- Otherwise:\ncall
`hippie-expand'\n (interactive) (if
(mark-or-region-active) (indent-region ... ... nil)
(if ... ... ...)))()
  call-interactively(jde-indent-complete)
  command-execute(jde-indent-complete t)
  execute-extended-command(nil)
  call-interactively(execute-extended-command)

--- Ole Arndt [EMAIL PROTECTED] wrote:
 
 Hi Jeba, Hi Paul,
 
 Paul Kinnucan [EMAIL PROTECTED] writes:
  Jeba Bhaskaran writes:
I am currently using dabbrev-completion to
 complete
variable names in a Java buffer. How difficult
 would
it be to add this functionality to the JDE
 Complete
Menu function? For example, if there is a .,
 then
the jde-complete-menu as it now would be called
 and if
a . is not present then dabbrev-completion
 function
would be called. Can this be added to the wish
 list? 

  
  This would be easy to do but I don't believe it is
  the right thing to do. I don't see the point of
 calling
  dabbrev to complete field and method names defined
  or inherited by the class in the current buffer.
  
  - Paul
 
 I have a function `jde-indent-complete' which
 provides this
 functionality.
 
 Instead of dabbrev-expand I use hippie-expand,
 because of the support
 semantic provides for it. Semantic automatically
 adds
 `senator-try-expand-semantic' to your
 `hippie-expand-try-functions-list'.
 This gives you local member name completion via
 semantic. If this fails,
 hippie-expand calls abbrev-expand and dabbrev-expand
 afterwards.
 For words with a dot in front `jde-complete' will be
 called.
 
 I have bound this to function to TAB, so completion
 feels the same
 as in the shell and in the rest of emacs. I couldn't
 live without it :-)
 
 The function has gone though various
 changes/optimizations as my elisp
 knowledge slowly grew from clueless to dilettante,
 here comes the
 current version:
 
 (defun jde-indent-complete ()
   A special indent/complete function. I calls three
 different
 functions depending on context:
 
 - The region is active:
 reindent the region.
 
 - The point is in front of the text on this line:
 try to reindent the line. 
 
 - The point is directly after a dot character
 (\.\) or in/at
the end of a word starting with a dot:
 call `jde-complete'
 
 - Otherwise:
 call `hippie-expand'
 
   (interactive)
   (if (mark-or-region-active)
   (indent-region (mark) (point) nil)
 (if (save-excursion (skip-chars-backward  \t)
 (bolp))
   (indent-for-tab-command)
   (if (not (equal major-mode 'jde-mode))
 (hippie-expand 1)
   (if (or (char-equal (char-before) ?.)
   (save-excursion (backward-word 1) 
   (char-equal (char-before) ?.)))
   (jde-complete)
 (hippie-expand 1))
 
 
 ; you probably need this also:
 
 (require 'hippie-exp)
 (setq hippie-expand-try-functions-list
   '(try-expand-all-abbrevs
   try-expand-dabbrev
   try-expand-dabbrev-all-buffers
   try-expand-dabbrev-from-kill))
 
 
 -- 
 Ole Arndt
 http://www.sugarshark.com

---
 


__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



Re: JDE Complete Menu

2003-01-10 Thread Ole Arndt
Jeba Bhaskaran [EMAIL PROTECTED] writes:

 Hello Ole,
  I copied your code to my init.el file and getting the
 following error when trying to use the method ( called
 by M-x jde-indent-complete):

 Signaling: (void-function mark-or-region-active)
   (mark-or-region-active)
   (if (mark-or-region-active) (indent-region (mark)
 (point) nil) (if (save-excursion ... ...)
 (indent-for-tab-command) (if ... ... ...)))
   (lambda nil A special indent/complete function. I
 calls three different\nfunctions depending on
 context:\n\n- The region is active:\nreindent
 the region.\n\n- The point is in front of the text on
 this line:\ntry to reindent the line. \n\n-
 The point is directly after a dot character (\.\) or
 in/at\n   the end of a word starting with a dot:\n
call `jde-complete'\n\n- Otherwise:\ncall
 `hippie-expand'\n (interactive) (if
 (mark-or-region-active) (indent-region ... ... nil)
 (if ... ... ...)))()
   call-interactively(jde-indent-complete)
   command-execute(jde-indent-complete t)
   execute-extended-command(nil)
   call-interactively(execute-extended-command)


Oops, you need this as well:

(or (boundp 'running-xemacs)
(defvar running-xemacs (string-match XEmacs\\|Lucid emacs-version)))

;; unify region checking
(if running-xemacs
(defun mark-or-region-active ()
  check if the region is currenty active
  zmacs-region-active-p)
  (defun mark-or-region-active ()
check if the region is currenty active
mark-active)
  )

-- 
Ole Arndt http://www.sugarshark.com
---
Any sufficiently advanced bug is indistinguishable from a feature.
-- Rich Kulawiec




JDE Complete Menu

2003-01-09 Thread Jeba Bhaskaran
I am currently using dabbrev-completion to complete
variable names in a Java buffer. How difficult would
it be to add this functionality to the JDE Complete
Menu function? For example, if there is a ., then
the jde-complete-menu as it now would be called and if
a . is not present then dabbrev-completion function
would be called. Can this be added to the wish list? 

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



JDE Complete Menu

2003-01-09 Thread Paul Kinnucan
Jeba Bhaskaran writes:
  I am currently using dabbrev-completion to complete
  variable names in a Java buffer. How difficult would
  it be to add this functionality to the JDE Complete
  Menu function? For example, if there is a ., then
  the jde-complete-menu as it now would be called and if
  a . is not present then dabbrev-completion function
  would be called. Can this be added to the wish list? 
  

This would be easy to do but I don't believe it is
the right thing to do. I don't see the point of calling
dabbrev to complete field and method names defined
or inherited by the class in the current buffer.

- Paul




jde-complete-menu error

2002-12-28 Thread Paul Kinnucan
Jayakrishnan Nair writes:
  I get the following error while trying to do
  jde-complete-menu. I am using J2SE 1.4.1
  
  Debugger entered--Lisp error: (error Beanshell eval
  error. See messages buffer for details.)
signal(error (Beanshell eval error. See messages
  buffer for details.))
error(Beanshell eval error. See messages buffer for
  details.)
   
  
 bsh-eval(jde.util.Completion.getClassInfo(\org.openide.explorer.ExplorerPanel\,0);
  t)

[snip]

  Starting the BeanShell. Please wait...
  Beanshell expression evaluation error.
Expression:
  jde.util.Completion.getClassInfo(org.openide.explorer.ExplorerPanel,0);
Error: // Error: // Uncaught Exception: TargetError
  : at Line: 16 : in file: unknown file : jde .util
  .Completion .getClassInfo (
  org.openide.explorer.ExplorerPanel , 0 ) 
  Target exception: java.lang.LinkageError: Class
  org/openide/windows/Workspace violates loader
  constraints
   [2 times]
 
[snip]

The completion command could not load your ExplorerPanel class because
of the LinkageError. I have no idea what constraints the error message
refers to. Does this error occur all the time or only in the
case of this particular class?

- Paul




Re: jde-complete-menu error

2002-12-28 Thread Jayakrishnan Nair
Paul,

I declared a PropertyChangeEvent evt and then later in
the code I thought it was declared as e (instead of
evt). So I typed e.get and then jde-complete-menu.
Since e was not available in the file, this error
came. But when I changed it to evt.get and typed
jde-complete-menu, the menu appeared.

Somehow the error message was not very informative.

Thanks again for a great development environment.

JK
--- Paul Kinnucan [EMAIL PROTECTED] wrote:
 Jayakrishnan Nair writes:
   I get the following error while trying to do
   jde-complete-menu. I am using J2SE 1.4.1
   
   Debugger entered--Lisp error: (error Beanshell
 eval
   error. See messages buffer for details.)
 signal(error (Beanshell eval error. See
 messages
   buffer for details.))
 error(Beanshell eval error. See messages
 buffer for
   details.)

  

bsh-eval(jde.util.Completion.getClassInfo(\org.openide.explorer.ExplorerPanel\,0);
   t)
 
 [snip]
 
   Starting the BeanShell. Please wait...
   Beanshell expression evaluation error.
 Expression:
  

jde.util.Completion.getClassInfo(org.openide.explorer.ExplorerPanel,0);
 Error: // Error: // Uncaught Exception:
 TargetError
   : at Line: 16 : in file: unknown file : jde
 .util
   .Completion .getClassInfo (
   org.openide.explorer.ExplorerPanel , 0 ) 
   Target exception: java.lang.LinkageError: Class
   org/openide/windows/Workspace violates loader
   constraints
[2 times]
  
 [snip]
 
 The completion command could not load your
 ExplorerPanel class because
 of the LinkageError. I have no idea what constraints
 the error message
 refers to. Does this error occur all the time or
 only in the
 case of this particular class?
 
 - Paul
 


__
Do you Yahoo!?
New DSL Internet Access from SBC  Yahoo!
http://sbc.yahoo.com