How can I add my personal abbreviation to emmet-mode in Emacs?












1















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?










share|improve this question























  • 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
















1















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?










share|improve this question























  • 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














1












1








1








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?










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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



















  • 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












2 Answers
2






active

oldest

votes


















2














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": {...}
}
}





share|improve this answer


























  • 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 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



















1














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.






share|improve this answer

























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    2














    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": {...}
    }
    }





    share|improve this answer


























    • 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 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
















    2














    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": {...}
    }
    }





    share|improve this answer


























    • 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 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














    2












    2








    2







    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": {...}
    }
    }





    share|improve this answer















    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": {...}
    }
    }






    share|improve this answer














    share|improve this answer



    share|improve this answer








    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 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



















    • 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 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

















    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













    1














    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.






    share|improve this answer






























      1














      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.






      share|improve this answer




























        1












        1








        1







        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.






        share|improve this answer















        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.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Sep 29 '13 at 15:47

























        answered Sep 29 '13 at 15:20









        Andreas RöhlerAndreas Röhler

        4,271815




        4,271815






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

            Npm cannot find a required file even through it is in the searched directory