How can I add my personal abbreviation to emmet-mode in Emacs?
I'm using emmet-mode in Emacs24.
I want to expand php
to <?php ?>
, but Emmet doesn't support php abbreviation.
I thought if I insert a line (puthash "php" "<?php ?>;" tbl)
between some other addreviation, but it doesn't work. Above all I don't want to write directly emmet-mode.el
.
How can I define my abbreviation outside of mode elisp file?
emacs
add a comment |
I'm using emmet-mode in Emacs24.
I want to expand php
to <?php ?>
, but Emmet doesn't support php abbreviation.
I thought if I insert a line (puthash "php" "<?php ?>;" tbl)
between some other addreviation, but it doesn't work. Above all I don't want to write directly emmet-mode.el
.
How can I define my abbreviation outside of mode elisp file?
emacs
Did you try M-x add-mode-abbrev?
– Andreas Röhler
Sep 29 '13 at 14:57
I didn't know it. I'll try it either. Thanks for your tips!
– ironsand
Sep 30 '13 at 8:38
add a comment |
I'm using emmet-mode in Emacs24.
I want to expand php
to <?php ?>
, but Emmet doesn't support php abbreviation.
I thought if I insert a line (puthash "php" "<?php ?>;" tbl)
between some other addreviation, but it doesn't work. Above all I don't want to write directly emmet-mode.el
.
How can I define my abbreviation outside of mode elisp file?
emacs
I'm using emmet-mode in Emacs24.
I want to expand php
to <?php ?>
, but Emmet doesn't support php abbreviation.
I thought if I insert a line (puthash "php" "<?php ?>;" tbl)
between some other addreviation, but it doesn't work. Above all I don't want to write directly emmet-mode.el
.
How can I define my abbreviation outside of mode elisp file?
emacs
emacs
asked Sep 29 '13 at 2:02


ironsandironsand
3,913841100
3,913841100
Did you try M-x add-mode-abbrev?
– Andreas Röhler
Sep 29 '13 at 14:57
I didn't know it. I'll try it either. Thanks for your tips!
– ironsand
Sep 30 '13 at 8:38
add a comment |
Did you try M-x add-mode-abbrev?
– Andreas Röhler
Sep 29 '13 at 14:57
I didn't know it. I'll try it either. Thanks for your tips!
– ironsand
Sep 30 '13 at 8:38
Did you try M-x add-mode-abbrev?
– Andreas Röhler
Sep 29 '13 at 14:57
Did you try M-x add-mode-abbrev?
– Andreas Röhler
Sep 29 '13 at 14:57
I didn't know it. I'll try it either. Thanks for your tips!
– ironsand
Sep 30 '13 at 8:38
I didn't know it. I'll try it either. Thanks for your tips!
– ironsand
Sep 30 '13 at 8:38
add a comment |
2 Answers
2
active
oldest
votes
I would use yasnippet
for that. Anyway, for emmet-mode
:
(puthash "pp" "<?php ${child} ?>" emmet-tag-snippets-table)
As far as I understand, all the preferences for emmet-mode
is contained in the hash table emmet-snippets
, it then contains nested hash table for per mode specific snippets and aliases.
emmet-snippets = {
"html": {
"snippets": {...}
"aliases": {...}
},
"css": {
"snippets": {...}
"aliases": {...}
}
}
Thanks for your info! I'll use yasnippet. It seems to be pretty match my situation.
– ironsand
Sep 30 '13 at 8:36
1
That innergethash
call can be replaced withemmet-tag-snippets-table
. (There's alsoemmet-tag-aliases-table
andemmet-css-snippets
.)
– pyrocrasty
Apr 10 '16 at 8:47
add a comment |
M-x add-mode-abbrev works here with emmet-mode
.
There is an inconvenience from add-mode-abbrev
, as its uses backward-word
internally to catch the expansion wanted. Thus call it without numeric argument, which will default to numeric arg 1, it will bind "php ?>" as expansion. Than M-x edit-abbrevs RET and fix that.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f19073674%2fhow-can-i-add-my-personal-abbreviation-to-emmet-mode-in-emacs%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I would use yasnippet
for that. Anyway, for emmet-mode
:
(puthash "pp" "<?php ${child} ?>" emmet-tag-snippets-table)
As far as I understand, all the preferences for emmet-mode
is contained in the hash table emmet-snippets
, it then contains nested hash table for per mode specific snippets and aliases.
emmet-snippets = {
"html": {
"snippets": {...}
"aliases": {...}
},
"css": {
"snippets": {...}
"aliases": {...}
}
}
Thanks for your info! I'll use yasnippet. It seems to be pretty match my situation.
– ironsand
Sep 30 '13 at 8:36
1
That innergethash
call can be replaced withemmet-tag-snippets-table
. (There's alsoemmet-tag-aliases-table
andemmet-css-snippets
.)
– pyrocrasty
Apr 10 '16 at 8:47
add a comment |
I would use yasnippet
for that. Anyway, for emmet-mode
:
(puthash "pp" "<?php ${child} ?>" emmet-tag-snippets-table)
As far as I understand, all the preferences for emmet-mode
is contained in the hash table emmet-snippets
, it then contains nested hash table for per mode specific snippets and aliases.
emmet-snippets = {
"html": {
"snippets": {...}
"aliases": {...}
},
"css": {
"snippets": {...}
"aliases": {...}
}
}
Thanks for your info! I'll use yasnippet. It seems to be pretty match my situation.
– ironsand
Sep 30 '13 at 8:36
1
That innergethash
call can be replaced withemmet-tag-snippets-table
. (There's alsoemmet-tag-aliases-table
andemmet-css-snippets
.)
– pyrocrasty
Apr 10 '16 at 8:47
add a comment |
I would use yasnippet
for that. Anyway, for emmet-mode
:
(puthash "pp" "<?php ${child} ?>" emmet-tag-snippets-table)
As far as I understand, all the preferences for emmet-mode
is contained in the hash table emmet-snippets
, it then contains nested hash table for per mode specific snippets and aliases.
emmet-snippets = {
"html": {
"snippets": {...}
"aliases": {...}
},
"css": {
"snippets": {...}
"aliases": {...}
}
}
I would use yasnippet
for that. Anyway, for emmet-mode
:
(puthash "pp" "<?php ${child} ?>" emmet-tag-snippets-table)
As far as I understand, all the preferences for emmet-mode
is contained in the hash table emmet-snippets
, it then contains nested hash table for per mode specific snippets and aliases.
emmet-snippets = {
"html": {
"snippets": {...}
"aliases": {...}
},
"css": {
"snippets": {...}
"aliases": {...}
}
}
edited Nov 21 '18 at 10:00


Richard de Wit
3,77843342
3,77843342
answered Sep 29 '13 at 8:58
tungdtungd
11.3k33641
11.3k33641
Thanks for your info! I'll use yasnippet. It seems to be pretty match my situation.
– ironsand
Sep 30 '13 at 8:36
1
That innergethash
call can be replaced withemmet-tag-snippets-table
. (There's alsoemmet-tag-aliases-table
andemmet-css-snippets
.)
– pyrocrasty
Apr 10 '16 at 8:47
add a comment |
Thanks for your info! I'll use yasnippet. It seems to be pretty match my situation.
– ironsand
Sep 30 '13 at 8:36
1
That innergethash
call can be replaced withemmet-tag-snippets-table
. (There's alsoemmet-tag-aliases-table
andemmet-css-snippets
.)
– pyrocrasty
Apr 10 '16 at 8:47
Thanks for your info! I'll use yasnippet. It seems to be pretty match my situation.
– ironsand
Sep 30 '13 at 8:36
Thanks for your info! I'll use yasnippet. It seems to be pretty match my situation.
– ironsand
Sep 30 '13 at 8:36
1
1
That inner
gethash
call can be replaced with emmet-tag-snippets-table
. (There's also emmet-tag-aliases-table
and emmet-css-snippets
.)– pyrocrasty
Apr 10 '16 at 8:47
That inner
gethash
call can be replaced with emmet-tag-snippets-table
. (There's also emmet-tag-aliases-table
and emmet-css-snippets
.)– pyrocrasty
Apr 10 '16 at 8:47
add a comment |
M-x add-mode-abbrev works here with emmet-mode
.
There is an inconvenience from add-mode-abbrev
, as its uses backward-word
internally to catch the expansion wanted. Thus call it without numeric argument, which will default to numeric arg 1, it will bind "php ?>" as expansion. Than M-x edit-abbrevs RET and fix that.
add a comment |
M-x add-mode-abbrev works here with emmet-mode
.
There is an inconvenience from add-mode-abbrev
, as its uses backward-word
internally to catch the expansion wanted. Thus call it without numeric argument, which will default to numeric arg 1, it will bind "php ?>" as expansion. Than M-x edit-abbrevs RET and fix that.
add a comment |
M-x add-mode-abbrev works here with emmet-mode
.
There is an inconvenience from add-mode-abbrev
, as its uses backward-word
internally to catch the expansion wanted. Thus call it without numeric argument, which will default to numeric arg 1, it will bind "php ?>" as expansion. Than M-x edit-abbrevs RET and fix that.
M-x add-mode-abbrev works here with emmet-mode
.
There is an inconvenience from add-mode-abbrev
, as its uses backward-word
internally to catch the expansion wanted. Thus call it without numeric argument, which will default to numeric arg 1, it will bind "php ?>" as expansion. Than M-x edit-abbrevs RET and fix that.
edited Sep 29 '13 at 15:47
answered Sep 29 '13 at 15:20
Andreas RöhlerAndreas Röhler
4,271815
4,271815
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f19073674%2fhow-can-i-add-my-personal-abbreviation-to-emmet-mode-in-emacs%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Did you try M-x add-mode-abbrev?
– Andreas Röhler
Sep 29 '13 at 14:57
I didn't know it. I'll try it either. Thanks for your tips!
– ironsand
Sep 30 '13 at 8:38