all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Slickedit features in Emacs?
@ 2003-05-21 18:59 Henrik Jönsson
  2003-05-21 19:08 ` Phillip Lord
                   ` (6 more replies)
  0 siblings, 7 replies; 20+ messages in thread
From: Henrik Jönsson @ 2003-05-21 18:59 UTC (permalink / raw)


I just was on a demo for Visual SlickEdit here at my company. I am
impressed.
My initial question was of course if the functions in Slickedit exists
in emacs. Some of them exists I know.

* Autocompletion of expressions. When the user write "if " it expands
automatically into a full if template. Can this be done with
skeletons?

* "Intellisense". I know that semantic can do something like this, but
does it work for everyday use? Has anyone tried it?

* Dynamic Tagging. Go to the function declaration etc. I haven't used
tags that much.

I don't want to abandon emacs because I use it for calendar, diary,
notes, etc. But for programming Slickedit is very interresting.

Regards

Henrik

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

* Re: Slickedit features in Emacs?
  2003-05-21 18:59 Slickedit features in Emacs? Henrik Jönsson
@ 2003-05-21 19:08 ` Phillip Lord
  2003-05-21 19:29 ` Benjamin Rutt
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 20+ messages in thread
From: Phillip Lord @ 2003-05-21 19:08 UTC (permalink / raw)


>>>>> "Henrik" == Henrik Jönsson <henrik.jonsson@se.transport.bombardier.com> writes:

  Henrik> I just was on a demo for Visual SlickEdit here at my
  Henrik> company. I am impressed.  My initial question was of course
  Henrik> if the functions in Slickedit exists in emacs. Some of them
  Henrik> exists I know.

  Henrik> * Autocompletion of expressions. When the user write "if "
  Henrik>   it expands
  Henrik> automatically into a full if template. Can this be done with
  Henrik> skeletons?

There are several different ways of doing this within emacs, including
tempo and skeleton. JDE does this out of the box for java. 


  Henrik> * "Intellisense". I know that semantic can do something like
  Henrik>   this, but
  Henrik> does it work for everyday use? Has anyone tried it?

Again the Java version of this works out of the box with JDE. My own
experience with the full semantic version suggests that its not ready
for every day use yet, but I hope that it will become so. 

Although my experience with Java is that dynamic abbreviation
expansion works as well in most circumstances and is quicker. 

  Henrik> * Dynamic Tagging. Go to the function declaration etc. I
  Henrik>   haven't used
  Henrik> tags that much.

Again there are many facilities for doing this sort of navigation. 

  Henrik> I don't want to abandon emacs because I use it for calendar,
  Henrik> diary, notes, etc. But for programming Slickedit is very
  Henrik> interresting.

I always thought it looked good, but start up costs of learning
something new are always large. I tend to stick with emacs, because of
its breadth (the number of things it supports) rather than its depth
(how well it supports each). 

Cheers

Phil

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

* Re: Slickedit features in Emacs?
  2003-05-21 18:59 Slickedit features in Emacs? Henrik Jönsson
  2003-05-21 19:08 ` Phillip Lord
@ 2003-05-21 19:29 ` Benjamin Rutt
  2003-05-22  7:07   ` Henrik Jönsson
  2003-05-21 19:34 ` Peter Lee
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Benjamin Rutt @ 2003-05-21 19:29 UTC (permalink / raw)


henrik.jonsson@se.transport.bombardier.com (Henrik Jönsson) writes:

> My initial question was of course if the functions in Slickedit
> exists in emacs. Some of them exists I know.
>
> * Autocompletion of expressions. When the user write "if " it expands
> automatically into a full if template. Can this be done with
> skeletons?

Yes, you just combine skeletons with abbrev.  I like to type "ifx " to
expand my template in C mode:

(define-skeleton my-skeleton-c-if
  "Insert a c if statement" nil
  "if (" > _ ")" \n
  "{" '(indent-for-tab-command) \n
  \n
  "}" '(indent-for-tab-command))
(define-abbrev c-mode-abbrev-table "ifx" "" 'my-skeleton-c-if)

> * "Intellisense". I know that semantic can do something like this, but
> does it work for everyday use? Has anyone tried it?

I think semantic is still a work in progress, but some have had
success with it.  Another option is xref (http://www.xref.sk/), which
is commercial, $29 I think, and works for C and Java.  In addition,
the JDE works great for java.

> * Dynamic Tagging. Go to the function declaration etc. I haven't used
> tags that much.

etags, M-x visit-tags-table and M-. work great for me.
-- 
Benjamin

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

* Re: Slickedit features in Emacs?
  2003-05-21 18:59 Slickedit features in Emacs? Henrik Jönsson
  2003-05-21 19:08 ` Phillip Lord
  2003-05-21 19:29 ` Benjamin Rutt
@ 2003-05-21 19:34 ` Peter Lee
  2003-05-21 19:38 ` Burton Samograd
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 20+ messages in thread
From: Peter Lee @ 2003-05-21 19:34 UTC (permalink / raw)


>>>>> "Henrik" == Henrik Jönsson <henrik.jonsson@se.transport.bombardier.com> writes:

    Henrik> I just was on a demo for Visual SlickEdit here at my
    Henrik> company. I am impressed.  My initial question was of
    Henrik> course if the functions in Slickedit exists in emacs. Some
    Henrik> of them exists I know.

    Henrik> * Autocompletion of expressions. When the user write "if "
    Henrik> it expands automatically into a full if template. Can this
    Henrik> be done with skeletons?

    Henrik> * "Intellisense". I know that semantic can do something
    Henrik> like this, but does it work for everyday use? Has anyone
    Henrik> tried it?

I don't use either of the above two things in emacs so I won't comment
on them (but I'm fairly certain autocompletions - aliases in slickedit -
are doable in emacs.

    Henrik> * Dynamic Tagging. Go to the function declaration etc. I
    Henrik> haven't used tags that much.

I do use ctags.  It's not dynamic like it is with slickedit however
(although I'm sure someone smarter than me could find a hook to make
it so).

    Henrik> I don't want to abandon emacs because I use it for
    Henrik> calendar, diary, notes, etc. But for programming Slickedit
    Henrik> is very interresting.

I used Slickedit for about 2 and a half years.  It has some nice
features for programmers.  The things I miss are intellisense and the
dynamic tagging.  The things I don't miss are the excruciatingly slow
load times of large workspaces, the occasional crashes,
buggy inconsistencies in tag file creation, the slick-c language, the
performance price you paid for dynamic tagging on large workspaces, and
of course the hefty price tag.

Towards the end of my time with slickedit I was using WTL quite
heavily and the intellisense didn't work well with it, so with the
primary reason I was willing to dish out $$ gone, I decided to learn
Emacs.

I'm quite happy now with Emacs and couldn't see myself ever using any
other editor.

Your mileage may vary of course.

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

* Re: Slickedit features in Emacs?
  2003-05-21 18:59 Slickedit features in Emacs? Henrik Jönsson
                   ` (2 preceding siblings ...)
  2003-05-21 19:34 ` Peter Lee
@ 2003-05-21 19:38 ` Burton Samograd
  2003-05-21 20:30 ` Stefan Monnier
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 20+ messages in thread
From: Burton Samograd @ 2003-05-21 19:38 UTC (permalink / raw)


henrik.jonsson@se.transport.bombardier.com (Henrik Jönsson) writes:
> I just was on a demo for Visual SlickEdit here at my company. I am
> impressed.
> My initial question was of course if the functions in Slickedit exists
> in emacs. Some of them exists I know.

If it doesn't, learn some elisp and write them :)  Generally if you
want emacs to do something, it's already been written or just write
it after you get comfortable with elisp.  

> * Autocompletion of expressions. When the user write "if " it expands
> automatically into a full if template. Can this be done with
> skeletons?

Check out abbrev mode.

> * "Intellisense". I know that semantic can do something like this, but
> does it work for everyday use? Has anyone tried it?

Don't know what this is, so I can't comment.

> * Dynamic Tagging. Go to the function declaration etc. I haven't used
> tags that much.

I don't know about dynamic tagging, but TAGS support is very good in
emacs.

> I don't want to abandon emacs because I use it for calendar, diary,
> notes, etc. But for programming Slickedit is very interresting.

So is emacs, but it has a bit of a learning curve and all those nifty
features aren't setup by default.  Do some browsing in the info tree
to see what's available.

-- 
burton samograd
kruhft@kruhft.dyndns.org
http://kruhftwerk.dyndns.org

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

* Re: Slickedit features in Emacs?
  2003-05-21 18:59 Slickedit features in Emacs? Henrik Jönsson
                   ` (3 preceding siblings ...)
  2003-05-21 19:38 ` Burton Samograd
@ 2003-05-21 20:30 ` Stefan Monnier
  2003-05-22 13:56   ` Benjamin Rutt
  2003-05-21 20:53 ` Ole Laursen
  2003-05-22 15:31 ` Kai Großjohann
  6 siblings, 1 reply; 20+ messages in thread
From: Stefan Monnier @ 2003-05-21 20:30 UTC (permalink / raw)


>>>>> "Henrik" == Henrik Jönsson <henrik.jonsson@se.transport.bombardier.com> writes:
> * Autocompletion of expressions. When the user write "if " it expands
> automatically into a full if template. Can this be done with
> skeletons?

Others have already replied.  While we're here.  What do people think of
extending `define-skeleton' with some options to put the skeleton in
an abbrev table ?  Something like

   (define-skeleton my-skeleton-c-if
     "Insert a c if statement"
     :abbrev ("ifx" c-mode-abbrev-table)
     nil
     "if (" > _ ")" \n
     "{" > \n \n "}" >)

> * "Intellisense".

Depends on the language.
I use it everyday in elisp.  I've used it in CommonLisp as well where
it also worked very nicely (by querying an inferior CL process).
It also works for LaTeX if you use AUCTeX.
I know it supposedly also works well in Java with JDE (which also works by
querying an inferior process).
For non-OO languages, I expect that completion based on a TAGS table should
work nicely.

> I know that semantic can do something like this, but
> does it work for everyday use? Has anyone tried it?

I've never really used it, so I wouldn't know.

> * Dynamic Tagging. Go to the function declaration etc. I haven't used
> tags that much.

IIRC, recent version of `etags' can efficiently refresh a TAGS file,
such that you can do something like (add-hook 'after-save-hook
'etags-refresh) and have your tags table updated whenever you save.
But I can't remember the details and I wouldn't be surprised if some
elisp snippet is still missing.


        Stefan

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

* Re: Slickedit features in Emacs?
  2003-05-21 18:59 Slickedit features in Emacs? Henrik Jönsson
                   ` (4 preceding siblings ...)
  2003-05-21 20:30 ` Stefan Monnier
@ 2003-05-21 20:53 ` Ole Laursen
  2003-05-22 15:31 ` Kai Großjohann
  6 siblings, 0 replies; 20+ messages in thread
From: Ole Laursen @ 2003-05-21 20:53 UTC (permalink / raw)


henrik.jonsson@se.transport.bombardier.com (Henrik Jönsson) writes:

> * Autocompletion of expressions. When the user write "if " it expands
> automatically into a full if template. Can this be done with
> skeletons?

I think the necessary code is implemented, someone just need to make a
bunch of good templates for the various modes and get it distributed,
perhaps even in included in Emacs proper. That would be really, really
cool!

> * "Intellisense". I know that semantic can do something like this, but
> does it work for everyday use? Has anyone tried it?

The C++ support is at least still somewhat flaky. Klaus Berndl has
been working on the parser which I think is pretty good now, but the
look up features in Semantic quite often don't get the context right.
Quite a lot is going to happen with Semantic 2.0, though, it seems.

> I don't want to abandon emacs because I use it for calendar, diary,
> notes, etc. But for programming Slickedit is very interresting.

In the end, editing code is still about editing text. Emacs beats
everything out there for text editing. (Including that infamous little
ed-with-sound-feedback clone out there.)

-- 
Ole Laursen
http://www.cs.auc.dk/~olau/

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

* Re: Slickedit features in Emacs?
  2003-05-21 19:29 ` Benjamin Rutt
@ 2003-05-22  7:07   ` Henrik Jönsson
  2003-05-22 12:38     ` Bruce Ashfield
                       ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Henrik Jönsson @ 2003-05-22  7:07 UTC (permalink / raw)


Benjamin Rutt <rutt+news@cis.ohio-state.edu> wrote in message news:<wc3addgrtd8.fsf@gamma.cis.ohio-state.edu>...
> henrik.jonsson@se.transport.bombardier.com (Henrik Jönsson) writes:
> 
> > My initial question was of course if the functions in Slickedit a full if template. Can this be done with
> > skeletons?
> 
> Yes, you just combine skeletons with abbrev.  I like to type "ifx " to
> expand my template in C mode:
> 
> (define-skeleton my-skeleton-c-if
>   "Insert a c if statement" nil
>   "if (" > _ ")" \n
>   "{" '(indent-for-tab-command) \n
>   \n
>   "}" '(indent-for-tab-command))
> (define-abbrev c-mode-abbrev-table "ifx" "" 'my-skeleton-c-if)
> 

Nice! Binding this to "ifx" works great. But I can't get it to bind to
"if(". Is it possible?

/henrik

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

* Re: Slickedit features in Emacs?
  2003-05-22  7:07   ` Henrik Jönsson
@ 2003-05-22 12:38     ` Bruce Ashfield
  2003-05-22 14:14     ` Stefan Monnier
  2003-05-22 17:12     ` Peter Lee
  2 siblings, 0 replies; 20+ messages in thread
From: Bruce Ashfield @ 2003-05-22 12:38 UTC (permalink / raw)
  Cc: help-gnu-emacs

Hi,

abbrev is using the current modes definition of a word to trigger
autocomplete. I added the following in my .emacs files:

  ;; modifying the syntax table to put ":" in the word constituent
  ;; table. This allows abbrev mode to use colon's as part of expansions
  (modify-syntax-entry ?: "w" c-mode-syntax-table)

  (define-abbrev c-mode-abbrev-table ":hstart" "" 'tempo-template-c-header-start)

You would have to do the same thing with "(" if you want it to trigger. 
But making these changes will impact any other operations that work on 
"words" in your mode. i.e. delete word would now snack on your "if(" and
not just if.

That's just my understanding, I'm sure I'll be corrected if I'm wrong.

Cheers,

Bruce


In message: Re: Slickedit features in Emacs?  on May 22 Henrik J?nsson
wrote:

> Benjamin Rutt <rutt+news@cis.ohio-state.edu> wrote in message news:<wc3addgrtd8.fsf@gamma.cis.ohio-state.edu>...
> > henrik.jonsson@se.transport.bombardier.com (Henrik Jönsson) writes:
> > 
> > > My initial question was of course if the functions in Slickedit a full if template. Can this be done with
> > > skeletons?
> > 
> > Yes, you just combine skeletons with abbrev.  I like to type "ifx " to
> > expand my template in C mode:
> > 
> > (define-skeleton my-skeleton-c-if
> >   "Insert a c if statement" nil
> >   "if (" > _ ")" \n
> >   "{" '(indent-for-tab-command) \n
> >   \n
> >   "}" '(indent-for-tab-command))
> > (define-abbrev c-mode-abbrev-table "ifx" "" 'my-skeleton-c-if)
> > 
> 
> Nice! Binding this to "ifx" works great. But I can't get it to bind to
> "if(". Is it possible?
> 
> /henrik
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-gnu-emacs

-- 

Bruce Ashfield         | "Thou shalt not follow the NULL pointer, for
ashfield@computer.org  |  chaos and madness await thee at its end."
bruce@zedd.org         |       - unknown

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

* Re: Slickedit features in Emacs?
  2003-05-21 20:30 ` Stefan Monnier
@ 2003-05-22 13:56   ` Benjamin Rutt
  0 siblings, 0 replies; 20+ messages in thread
From: Benjamin Rutt @ 2003-05-22 13:56 UTC (permalink / raw)


"Stefan Monnier" <monnier+gnu.emacs.help/news/@flint.cs.yale.edu> writes:

> Others have already replied.  While we're here.  What do people think of
> extending `define-skeleton' with some options to put the skeleton in
> an abbrev table ?  Something like
>
>    (define-skeleton my-skeleton-c-if
>      "Insert a c if statement"
>      :abbrev ("ifx" c-mode-abbrev-table)
>      nil
>      "if (" > _ ")" \n
>      "{" > \n \n "}" >)

It gets my vote.  Why not allow them to be combined explicitly, since
so many people combine skeletons and abbrevs separately anyway.
-- 
Benjamin

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

* Re: Slickedit features in Emacs?
  2003-05-22  7:07   ` Henrik Jönsson
  2003-05-22 12:38     ` Bruce Ashfield
@ 2003-05-22 14:14     ` Stefan Monnier
  2003-05-22 17:12     ` Peter Lee
  2 siblings, 0 replies; 20+ messages in thread
From: Stefan Monnier @ 2003-05-22 14:14 UTC (permalink / raw)


> Nice! Binding this to "ifx" works great. But I can't get it to bind to
> "if(". Is it possible?

Emacs's abbrevs can only be made of characters whose syntactic category is
"word".  I think XEmacs has lifted this limitation, but it hasn't been
implemented in Emacs (yet: any taker?).


        Stefan

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

* Re: Slickedit features in Emacs?
  2003-05-21 18:59 Slickedit features in Emacs? Henrik Jönsson
                   ` (5 preceding siblings ...)
  2003-05-21 20:53 ` Ole Laursen
@ 2003-05-22 15:31 ` Kai Großjohann
  6 siblings, 0 replies; 20+ messages in thread
From: Kai Großjohann @ 2003-05-22 15:31 UTC (permalink / raw)


henrik.jonsson@se.transport.bombardier.com (Henrik Jönsson) writes:

> * Dynamic Tagging. Go to the function declaration etc. I haven't used
> tags that much.

>From my understanding of "dynamic" in this thread, I think it's not
necessary.  I mean, *.o files aren't dynamic, either.  You just
invoke "make" to create new ones that correspond to the changed
source code.  So why not have "make" create the TAGS file, too?

Well, in interpreted languages it's different, because there no "make"
is normally involved.  It's just edit-run.  But you could create a
background job that regenerates the TAGS file every few minutes.  Or
write something that regenerates the TAGS file on saving a buffer.
-- 
This line is not blank.

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

* Re: Slickedit features in Emacs?
  2003-05-22  7:07   ` Henrik Jönsson
  2003-05-22 12:38     ` Bruce Ashfield
  2003-05-22 14:14     ` Stefan Monnier
@ 2003-05-22 17:12     ` Peter Lee
  2003-05-22 19:42       ` Mark Mynsted
  2 siblings, 1 reply; 20+ messages in thread
From: Peter Lee @ 2003-05-22 17:12 UTC (permalink / raw)


>>>>> "Henrik" == Henrik Jönsson <henrik.jonsson@se.transport.bombardier.com> writes:

    Henrik> Benjamin Rutt <rutt+news@cis.ohio-state.edu> wrote in
    Henrik> message news:<wc3addgrtd8.fsf@gamma.cis.ohio-state.edu>...
    >> henrik.jonsson@se.transport.bombardier.com (Henrik Jönsson)
    >> writes:
    >> 
    >> > My initial question was of course if the functions in
    >> Slickedit a full if template. Can this be done with >
    >> skeletons?
    >> 
    >> Yes, you just combine skeletons with abbrev.  I like to type
    >> "ifx " to expand my template in C mode:
    >> 
    >> (define-skeleton my-skeleton-c-if "Insert a c if statement" nil
    >> "if (" > _ ")" \n "{" '(indent-for-tab-command) \n \n "}"
    >> '(indent-for-tab-command)) (define-abbrev c-mode-abbrev-table
    >> "ifx" "" 'my-skeleton-c-if)
    >> 

    Henrik> Nice! Binding this to "ifx" works great. But I can't get
    Henrik> it to bind to "if(". Is it possible?

I added the above code and typing ifx in a c++ file didn't do
anything.  Abbrev-mode was on... so I'm not sure.  Any ideas ?  I've
never used skeletons in emacs before.

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

* Re: Slickedit features in Emacs?
  2003-05-22 17:12     ` Peter Lee
@ 2003-05-22 19:42       ` Mark Mynsted
  2003-05-22 20:04         ` Peter Lee
  0 siblings, 1 reply; 20+ messages in thread
From: Mark Mynsted @ 2003-05-22 19:42 UTC (permalink / raw)


>>>>> "Peter" == Peter Lee <pete_lee@swbell.net> writes:
Peter> I added the above code and typing ifx in a c++ file didn't do
Peter> anything.  Abbrev-mode was on... so I'm not sure.  Any ideas ?  I've
Peter> never used skeletons in emacs before.

Two ideas:

1. The abbrev code was
(define-abbrev c-mode-abbrev-table "ifx" "" 'my-skeleton-c-if)

That abbrev is specific for c-mode.  Type M-h v mode-name
If the result is not "C" then I do not think you are in the correct
mode.

2. You have to type a non-word character following the abbrev to get
   the abbrev to expand. (Or use one of the interactive functions.) So
   ifx then space would expand the abbrev.  But just ifx would not...

You could see if the skeleton is working by simply typing:
M-x my-skeleton-c-if

-- 
-MM
I rarely read email from this address          /"\
because of spam.                               \ /     ASCII Ribbon Campaign
I MAY see it if you put #NOTSPAM#               X      Against HTML Mail
in the subject line.                           / \

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

* Re: Slickedit features in Emacs?
  2003-05-22 19:42       ` Mark Mynsted
@ 2003-05-22 20:04         ` Peter Lee
  2003-05-22 20:23           ` Kai Großjohann
  2003-05-22 20:52           ` Mark Mynsted
  0 siblings, 2 replies; 20+ messages in thread
From: Peter Lee @ 2003-05-22 20:04 UTC (permalink / raw)


>>>>> "Mark" == Mark Mynsted <mmynsted_news@gbronline.com> writes:

>>>>> "Peter" == Peter Lee <pete_lee@swbell.net> writes:
    Peter> I added the above code and typing ifx in a c++ file didn't
    Peter> do anything.  Abbrev-mode was on... so I'm not sure.  Any
    Peter> ideas ?  I've never used skeletons in emacs before.

    Mark> Two ideas:

    Mark> 1. The abbrev code was (define-abbrev c-mode-abbrev-table
    Mark> "ifx" "" 'my-skeleton-c-if)

    Mark> That abbrev is specific for c-mode.  Type M-h v mode-name If
    Mark> the result is not "C" then I do not think you are in the
    Mark> correct mode.

Thanks for the reply Mark.  I changed the define to be:
(define-abbrev c++-mode-abbrev-table "ifx" "" 'my-skeleton-c-if)

It now works.  Do you know of a way to map these to multiple modes?  I
know there is a c-mode-common-hook that works for both c and c++, I
was wondering if there's something similar for c-mode-abbrev-table
(something like a c-mode-common-abbrev-table).

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

* Re: Slickedit features in Emacs?
  2003-05-22 20:04         ` Peter Lee
@ 2003-05-22 20:23           ` Kai Großjohann
  2003-05-22 20:52           ` Mark Mynsted
  1 sibling, 0 replies; 20+ messages in thread
From: Kai Großjohann @ 2003-05-22 20:23 UTC (permalink / raw)


Peter Lee <pete_lee@swbell.net> writes:

> Thanks for the reply Mark.  I changed the define to be:
> (define-abbrev c++-mode-abbrev-table "ifx" "" 'my-skeleton-c-if)
>
> It now works.  Do you know of a way to map these to multiple modes?

Use copy and paste...
-- 
This line is not blank.

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

* Re: Slickedit features in Emacs?
  2003-05-22 20:04         ` Peter Lee
  2003-05-22 20:23           ` Kai Großjohann
@ 2003-05-22 20:52           ` Mark Mynsted
  2003-05-22 21:03             ` Stefan Monnier
  1 sibling, 1 reply; 20+ messages in thread
From: Mark Mynsted @ 2003-05-22 20:52 UTC (permalink / raw)


>>>>> "Peter" == Peter Lee <pete_lee@swbell.net> writes:
Peter> Thanks for the reply Mark.  I changed the define to be:
Peter> (define-abbrev c++-mode-abbrev-table "ifx" "" 'my-skeleton-c-if)

Peter> It now works.  Do you know of a way to map these to multiple modes?  I
Peter> know there is a c-mode-common-hook that works for both c and c++, I
Peter> was wondering if there's something similar for c-mode-abbrev-table
Peter> (something like a c-mode-common-abbrev-table).

There are a few ways I think.

- There should be a way to capture the name of the mode using
mode-name from the hook added to 'c-mode-common-hook, such that when
the hook gets called it finds the name, translates that to the correct
abbrev table name then adds the abbrev to the applicable table.
If you get that working, I would like to use it myself.  :-)

- You could add it to the global abbrev table, global-abbrev-table,
but then it would be global, which I think would not be something that
one would want.

- You could simply add it to each of your c-like modes when the
c-mode-common-hook is called.  But of course you would need to know
what modes you use...


-- 
-MM
I rarely read email from this address          /"\
because of spam.                               \ /     ASCII Ribbon Campaign
I MAY see it if you put #NOTSPAM#               X      Against HTML Mail
in the subject line.                           / \

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

* Re: Slickedit features in Emacs?
  2003-05-22 20:52           ` Mark Mynsted
@ 2003-05-22 21:03             ` Stefan Monnier
  2003-05-23 13:38               ` Mark Mynsted
  0 siblings, 1 reply; 20+ messages in thread
From: Stefan Monnier @ 2003-05-22 21:03 UTC (permalink / raw)


> - There should be a way to capture the name of the mode using
> mode-name from the hook added to 'c-mode-common-hook, such that when
> the hook gets called it finds the name, translates that to the correct
> abbrev table name then adds the abbrev to the applicable table.
> If you get that working, I would like to use it myself.  :-)

What's wrong with `local-abbrev-table' ?


        Stefan

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

* Re: Slickedit features in Emacs?
  2003-05-22 21:03             ` Stefan Monnier
@ 2003-05-23 13:38               ` Mark Mynsted
  2003-05-23 15:44                 ` Peter Lee
  0 siblings, 1 reply; 20+ messages in thread
From: Mark Mynsted @ 2003-05-23 13:38 UTC (permalink / raw)


>>>>> "Stefan" == Stefan Monnier <monnier+gnu.emacs.help/news/@flint.cs.yale.edu> writes:

>> - There should be a way to capture the name of the mode using
>> mode-name from the hook added to 'c-mode-common-hook, such that when
>> the hook gets called it finds the name, translates that to the correct
>> abbrev table name then adds the abbrev to the applicable table.
>> If you get that working, I would like to use it myself.  :-)

Stefan> What's wrong with `local-abbrev-table' ?

That is great.
Now the following will work exactly as requested, i.e. it will work
for any mode that triggers the c-mode-common-hook:

(define-skeleton my-skeleton-c-if
   "Insert a c if statement" nil
   "if (" > _ ")" \n
   "{" '(indent-for-tab-command) \n
   \n
   "}" '(indent-for-tab-command))

(defun my-c-mode-common-hook ()
(define-abbrev local-abbrev-table "ifx" "" 'my-skeleton-c-if))
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

Thank you Stefan!

-- 
-MM
I rarely read email from this address          /"\
because of spam.                               \ /     ASCII Ribbon Campaign
I MAY see it if you put #NOTSPAM#               X      Against HTML Mail
in the subject line.                           / \

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

* Re: Slickedit features in Emacs?
  2003-05-23 13:38               ` Mark Mynsted
@ 2003-05-23 15:44                 ` Peter Lee
  0 siblings, 0 replies; 20+ messages in thread
From: Peter Lee @ 2003-05-23 15:44 UTC (permalink / raw)


>>>>> "Mark" == Mark Mynsted <mmynsted_news@gbronline.com> writes:

>>>>> "Stefan" == Stefan Monnier
>>>>> <monnier+gnu.emacs.help/news/@flint.cs.yale.edu> writes:
    >>> - There should be a way to capture the name of the mode using
    >>> mode-name from the hook added to 'c-mode-common-hook, such
    >>> that when the hook gets called it finds the name, translates
    >>> that to the correct abbrev table name then adds the abbrev to
    >>> the applicable table.  If you get that working, I would like
    >>> to use it myself.  :-)

    Stefan> What's wrong with `local-abbrev-table' ?

    Mark> That is great.  Now the following will work exactly as
    Mark> requested, i.e. it will work for any mode that triggers the
    Mark> c-mode-common-hook:

    Mark> (define-skeleton my-skeleton-c-if "Insert a c if statement"
    Mark> nil "if (" > _ ")" \n "{" '(indent-for-tab-command) \n \n
    Mark> "}" '(indent-for-tab-command))

    Mark> (defun my-c-mode-common-hook () (define-abbrev
    Mark> local-abbrev-table "ifx" "" 'my-skeleton-c-if)) (add-hook
    Mark> 'c-mode-common-hook 'my-c-mode-common-hook)

Ahhh that's what I was looking for... Thanks Stefan and Mark.

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

end of thread, other threads:[~2003-05-23 15:44 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-21 18:59 Slickedit features in Emacs? Henrik Jönsson
2003-05-21 19:08 ` Phillip Lord
2003-05-21 19:29 ` Benjamin Rutt
2003-05-22  7:07   ` Henrik Jönsson
2003-05-22 12:38     ` Bruce Ashfield
2003-05-22 14:14     ` Stefan Monnier
2003-05-22 17:12     ` Peter Lee
2003-05-22 19:42       ` Mark Mynsted
2003-05-22 20:04         ` Peter Lee
2003-05-22 20:23           ` Kai Großjohann
2003-05-22 20:52           ` Mark Mynsted
2003-05-22 21:03             ` Stefan Monnier
2003-05-23 13:38               ` Mark Mynsted
2003-05-23 15:44                 ` Peter Lee
2003-05-21 19:34 ` Peter Lee
2003-05-21 19:38 ` Burton Samograd
2003-05-21 20:30 ` Stefan Monnier
2003-05-22 13:56   ` Benjamin Rutt
2003-05-21 20:53 ` Ole Laursen
2003-05-22 15:31 ` Kai Großjohann

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.