Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 822907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:51:58+00:00 2026-05-15T02:51:58+00:00

given all the possible solutions to have a template system with GNU Emacs, what

  • 0

given all the possible solutions to have a template system with GNU Emacs, what do people use today ? I am still using skeleton-mode but as I read it here and there, we must be really few to do so.

What are you using and why ? (maybe I could switch to a more popular tool).

For example, given this snippet:

(define-skeleton mwe:cl-defpackage-skeleton
  "Inserts a Common Lisp DEFPACKAGE skeleton."
  (skeleton-read "Package: " (if v1
                                 (file-name-sans-extension
                                  (file-name-nondirectory
                                   (buffer-file-name)))))
  (if (setq v1 (bobp)) ";;; -*- Mode:Lisp; Syntax:ANSI-Common-Lisp;")
  & (if buffer-file-coding-system
        (concat " Coding:"
                (symbol-name 
                 (coding-system-get buffer-file-coding-system 
                                    'mime-charset))))
  & " -*-"
  & \n
  & \n "(defpackage #:" str
  \n "(:nicknames" ("Nickname: " " #:" str) & ")" | '(kill-whole-line -1)
  \n "(:use #:CL" ((slime-read-package-name "USEd package: ") " #:" str) ")"
  ")" \n
  \n
  (if v1 "(in-package #:") & str & ")" & \n &
  \n
  _)

(credits: http://www.foldr.org/~michaelw/log/programming/lisp/defpackage-skeleton)

which (modern) template mode could do the same (and how ;)) ?

Cheers

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T02:51:59+00:00Added an answer on May 15, 2026 at 2:51 am

    I use yasnippet.

    In my emacs I have this:

    (require 'yasnippet-bundle)
    

    In my hook for each mode where I want to use snippets (like my c-mode hook, etc), I have this:

    (yas/minor-mode-on)
    

    The “static” snippets I use are available, in the directory structure I use, here:

    http://cheeso.members.winisp.net/srcview.aspx?dir=emacs&file=snippets.zip

    You need to create the bundle .el file mentioned above, once, when any of the snippets change. do it this way:

    (require 'yasnippet)
    (yas/compile-bundle 
     ; the starting point
     "c:/your/path/yasnippet.el"
    
     ; the bundle file to generate
     "c:/your/path/yasnippet-bundle.el" 
    
     ; the snippet dir from which to generate the bundle
     "c:/your/path/snippets")
    

    That’s it!

    Then, when I’m in a C# file and type for<TAB>, I get a template with a for loop. And so on.


    I also use yasnippet with dynamic snippet templates. A C# code-completion module I wrote calls yas/expand-snippet with a dynamically constructed string that defines the template to expand.

    So, you can type

      MyType.Method(<COMPLETE>
    

    …where <COMPLETE> is the code-completion key, and the code-completion module does the lookup on the MyType.Method(, then builds a menu of choices, and pops it up. When the user selects a choice from the menu, the code-completion module builds the template, containing fields for each of the arguments for the selected method. Then it calls yas/expand-snippet and that template is injected into the buffer, just as if it had been a static template. In the dynamically-generated template, each argument to the method gets a “typeover” field, and I just fill it in, tabbing through the fields. Pretty nice.

    This “dynamic snippet” idea would work with any code-completion engine. You just need a way to map from a method or function signature, like this:

      function(int arg1, string arg2, char arg3)
    

    to a yasnippet template definition string, which looks like this:

      function(${1:int arg1}, ${2:string arg2}, ${3:char arg3}) 
    

    And that’s a pretty trivial piece of elisp.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.