[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [h-e-w] c-mode : can't expand '#d' to '#define'
From: |
Peter Milliken |
Subject: |
RE: [h-e-w] c-mode : can't expand '#d' to '#define' |
Date: |
Wed, 25 Sep 2002 07:25:46 +1000 |
Jeff,
I can't explain this behaviour :-) But if you are interested in a much
better and easier to use (my opinion since I am the author! :-)) "code
abbreviation" system, then have a look at
http://www.zipworld.com.au/~peterm. There are templates there for C. The
system doesn't have expansion of tokens (nomenclature for what you are
trying to do below) using the space enabled but it is easy to add.
For example, the token definition in ELSE (Emacs Language Sensitive Editor
:-)) for these would be:
DELETE TOKEN D -
/LANGUAGE="C" -
DEFINE TOKEN D -
/LANGUAGE="C" -
/PLACEHOLDER=DO_STATEMENT
END DEFINE
DELETE TOKEN #D -
/LANGUAGE="C" -
DEFINE TOKEN #D -
/LANGUAGE="C" -
"#define {text}"
END DEFINE
DELETE TOKEN DE -
/LANGUAGE="C" -
DEFINE TOKEN DE -
/LANGUAGE="C" -
"default:"
END DEFINE
Bit more "verbose", I will admit, but I believe that it is easier for a
newbie to pick up i.e. no requirements for learning Elisp in this system!
:-) It comes with a 40+ user/reference manual as well i.e. no need to "read
the code Luke!" :-)
Note that the first definition "points to" the definition for the "do
statement", which generates a template like this:
do {
{statement}...
} while ({expression});
The cursor is "automatically" positioned at the next placeholder
({statement} in the do example or {text} in the #define definition). Just
start typing and the placeholder text is automatically replaced with
whatever you are typing :-)
Any assistance I can be give me a yell :-)
Peter
-----Original Message-----
From: Jeff Rancier [mailto:address@hidden
Sent: Wednesday, September 25, 2002 3:35 AM
To: Emacs Help (Windows)
Subject: [h-e-w] c-mode : can't expand '#d' to '#define'
Hello All:
In c-mode, I have the following:
(defconst c-expand-list '(
("#d" "#define ")
("d" "do\n{\n\n} while();" (6 15))
("de" "default:")
) "Expansions for C mode" )
(defun c-mode-expand-add-hooks ()
(expand-add-abbrevs c-mode-abbrev-table c-expand-list))
(add-hook 'c-mode-hook 'c-mode-expand-add-hooks)
When I type #d followed by a space, I get the do expansion. Can anyone
explain this?
--
Thanks,
Jeff
Warning: Copyright ResMed. Where the contents of this email and/or attachment
includes materials prepared by ResMed, the use of those materials is subject
exclusively to the conditions of engagement between ResMed and the intended
recipient.
This communication is confidential and may contain legally privileged
information. By the use of email over the Internet or other communication
systems, ResMed is not waiving either confidentiality of, or legal privilege
in,the content of the email and of any attachments.
If the recipient of this message is not the intended addressee, please call
ResMed immediately on +61 2 9886 5000 Sydney, Australia.