* tempo in JDE: completion with <spc>
@ 2003-09-12 0:41 FRC
2003-09-16 19:50 ` FRC
0 siblings, 1 reply; 4+ messages in thread
From: FRC @ 2003-09-12 0:41 UTC (permalink / raw)
Hi,
I use NTEmacs and JDE mode w/ ECB to write Java code and I like them much,
although it did take some time to configure everything to my taste.
One (minor) thing I'd like to change is the way the 'for', 'if' etc...
abbrevs expansion deal with the last inserted char (the one that triggered
the expansion).
My understanding is that JDE tempo template functions are put in the
function cell of the entries in the abbrev table - these functions are
called when the abbrev is expanded. As far as I'm concerned, I always expand
the abbrevs by hitting <space> just after the abbrev. This is usually fine,
except for these tempo-based expansions, which more often than not define
some tempo-mark in the middle of the expansion (eg. to define the loop
variables in the 'for' statement etc...). In these cases, the <space> char
is inserted after the expansion, right where the expansion left the point;
but I always delete that space, b/c I don't want it and if I did I would put
it in the tempo template in the 1st place. For example, the 'if' expansion
sets the point just after the opening paranthesis, but then the <space>
self-inserts itself there, although I'll never want a space here. I
appreciate that this insertion is perfectly consistent, but how can I get
rid of it *only* for the tempo-based expansions (I don't want to discard the
space when I expand 'public' or 'interface' for instance) ?
I tried to bind some tempo-space function of my own to <space>, but this
func doesn't know if I want to keep the space or not (ie. if the abbrev has
been expanded with tempo). I could use brute-force and list all the
tempo-based abbrevs and checks if current abbrev matches one of them, but
there must be a better way.
My guess is that I need a mean to cancel the <space> char insertion from
within the tempo template, but I didn't manage to do so (looked at
discard-input and another unread-xxx function).
How can I sort this out (apart from hitting C-x ' instead of <space>) ?
FRC
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: tempo in JDE: completion with <spc>
2003-09-12 0:41 tempo in JDE: completion with <spc> FRC
@ 2003-09-16 19:50 ` FRC
2003-09-17 5:29 ` Sandip Chitale
0 siblings, 1 reply; 4+ messages in thread
From: FRC @ 2003-09-16 19:50 UTC (permalink / raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2418 bytes --]
I found out that a 'no-self-insert property can be put in the plist of the
symbol present in the function cell of the entry in the abbrev
table/obarray. If the function returns non-nil, the char is discarded -
which is exactly what I was looking for.
FRC
"FRC" <frc--NoSpAm--@myrealbox.com> a écrit dans le message de
news:bjr4ob$o6t$1@news-reader4.wanadoo.fr...
> Hi,
>
> I use NTEmacs and JDE mode w/ ECB to write Java code and I like them much,
> although it did take some time to configure everything to my taste.
> One (minor) thing I'd like to change is the way the 'for', 'if' etc...
> abbrevs expansion deal with the last inserted char (the one that triggered
> the expansion).
> My understanding is that JDE tempo template functions are put in the
> function cell of the entries in the abbrev table - these functions are
> called when the abbrev is expanded. As far as I'm concerned, I always
expand
> the abbrevs by hitting <space> just after the abbrev. This is usually
fine,
> except for these tempo-based expansions, which more often than not define
> some tempo-mark in the middle of the expansion (eg. to define the loop
> variables in the 'for' statement etc...). In these cases, the <space> char
> is inserted after the expansion, right where the expansion left the point;
> but I always delete that space, b/c I don't want it and if I did I would
put
> it in the tempo template in the 1st place. For example, the 'if' expansion
> sets the point just after the opening paranthesis, but then the <space>
> self-inserts itself there, although I'll never want a space here. I
> appreciate that this insertion is perfectly consistent, but how can I get
> rid of it *only* for the tempo-based expansions (I don't want to discard
the
> space when I expand 'public' or 'interface' for instance) ?
> I tried to bind some tempo-space function of my own to <space>, but this
> func doesn't know if I want to keep the space or not (ie. if the abbrev
has
> been expanded with tempo). I could use brute-force and list all the
> tempo-based abbrevs and checks if current abbrev matches one of them, but
> there must be a better way.
> My guess is that I need a mean to cancel the <space> char insertion from
> within the tempo template, but I didn't manage to do so (looked at
> discard-input and another unread-xxx function).
> How can I sort this out (apart from hitting C-x ' instead of <space>) ?
>
> FRC
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: tempo in JDE: completion with <spc>
2003-09-16 19:50 ` FRC
@ 2003-09-17 5:29 ` Sandip Chitale
2003-09-18 9:47 ` FRC
0 siblings, 1 reply; 4+ messages in thread
From: Sandip Chitale @ 2003-09-17 5:29 UTC (permalink / raw)
Can you share the code with us?
thanks,
sandip
"FRC" <frc--NoSpAm--@myrealbox.com> wrote in message news:<bk7pi5$e3f$1@news-reader1.wanadoo.fr>...
> I found out that a 'no-self-insert property can be put in the plist of the
> symbol present in the function cell of the entry in the abbrev
> table/obarray. If the function returns non-nil, the char is discarded -
> which is exactly what I was looking for.
>
> FRC
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: tempo in JDE: completion with <spc>
2003-09-17 5:29 ` Sandip Chitale
@ 2003-09-18 9:47 ` FRC
0 siblings, 0 replies; 4+ messages in thread
From: FRC @ 2003-09-18 9:47 UTC (permalink / raw)
sandipchitale@yahoo.com (Sandip Chitale) wrote in message news:<b607d812.0309162129.4d019ab1@posting.google.com>...
> Can you share the code with us?
>
> thanks,
> sandip
>
> "FRC" <frc--NoSpAm--@myrealbox.com> wrote in message news:<bk7pi5$e3f$1@news-reader1.wanadoo.fr>...
> > I found out that a 'no-self-insert property can be put in the plist of the
> > symbol present in the function cell of the entry in the abbrev
> > table/obarray. If the function returns non-nil, the char is discarded -
> > which is exactly what I was looking for.
> >
> > FRC
It goes like this in the jde-mode-hook of my .emacs:
(mapatoms
(lambda (symb) (and (symbolp (symbol-function symb)) (string-match
"tempo-template-jde-gen" (symbol-name (symbol-function symb))) (put
(symbol-function symb) 'no-self-insert t)))
local-abbrev-table)
I'm still an Emacs-Lisp rookie, so there might be a better way to get
the same result.
Note that it somewhat messed with completions within comments, as in
these cases I do want the space insertion but the expansion (even if
void) eats it unconditionally. This is a minor pb AFAIC and quoting
with C-q does the job.
HTH,
FRC
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-09-18 9:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-12 0:41 tempo in JDE: completion with <spc> FRC
2003-09-16 19:50 ` FRC
2003-09-17 5:29 ` Sandip Chitale
2003-09-18 9:47 ` FRC
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).