help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Slickedit features in Emacs?


From: Mark Mynsted
Subject: Re: Slickedit features in Emacs?
Date: 23 May 2003 08:38:55 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

>>>>> "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.                           / \


reply via email to

[Prev in Thread] Current Thread [Next in Thread]