all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nordlöw <per.nordlow@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: YAsnippet Emacs-Lisp Templates
Date: Thu, 25 Sep 2008 02:39:26 -0700 (PDT)	[thread overview]
Message-ID: <31d2385f-2763-4f49-832e-f5ff89e270ea@f63g2000hsf.googlegroups.com> (raw)
In-Reply-To: 87myhwaaxh.fsf@manatee.domain

On 25 Sep, 10:26, Andy Stewart <lazycat.mana...@gmail.com> wrote:
> >>>>> "Nordlöw" == Nordlöw  <per.nord...@gmail.com> writes:
>
> Hi, Nordlöw!
>
>     Nordlöw> Has anyone written any YAsnippet templates for emacs-lisp?
>     Nordlöw> /Nordlöw
>
> This my YASnippet templates for emacs-lisp.
>
> ------------------------------> addal start <------------------------------
> #name : (autoload '... "..." "..." ...)
> # --
> (autoload '${1:function-name} "${2:file-name}" "${3:document}" ${0:interactive})
> ------------------------------> addal end   <------------------------------
>
> ------------------------------> addav start <------------------------------
> #name : (defadvice ... ... ...)
> # --
> (defadvice ${1:function-name} (${2:args})
>   "${3:advice-document}"
>   (${0:advice-body})
> )
> ------------------------------> addav end   <------------------------------
>
> ------------------------------> addbk start <------------------------------
> #name : (basic-set-key-alist ...)
> # --
> (basic-set-key-alist ${0:rest})
> ------------------------------> addbk end   <------------------------------
>
> ------------------------------> addgk start <------------------------------
> #name : (global-set-key (kbd "...") ...)
> # --
> (global-set-key (kbd "${1:some-key}") ${0:some-command})
> ------------------------------> addgk end   <------------------------------
>
> ------------------------------> addhk start <------------------------------
> #name : (dolist (hook (list ... )) (add-hook hook '...))
> # --
> (dolist (hook (list
>                ${1:mode-list}
>                ))
>   (add-hook hook '${0:mode-hook}))
> ------------------------------> addhk end   <------------------------------
>
> ------------------------------> addhkd start <------------------------------
> #name : (dolist (hooked (list ...)) (add-hook '... 'hooked))
> # --
> (dolist (hooked (list
>                ${1:mode-list}
>                ))
>   (add-hook '${0:mode-hook} 'hooked))
> ------------------------------> addhkd end   <------------------------------
>
> ------------------------------> addlk start <------------------------------
> #name : (define-key ... (kbd "...") ...)
> # --
> (define-key ${1:some-mode-map} (kbd "${2:some-key}") ${0:some-command})
> ------------------------------> addlk end   <------------------------------
>
> ------------------------------> addpr start <------------------------------
> #name : (provide '...)
> # --
> (provide '${0:library-name})
> ------------------------------> addpr end   <------------------------------
>
> ------------------------------> addrq start <------------------------------
> #name : (require '...)
> # --
> (require '${0:library-name})
> ------------------------------> addrq end   <------------------------------
>
> ------------------------------> addse start <------------------------------
> #name : (setq ... ...)
> # --
> (setq ${1:variable-name} ${0:variable-value})
> ------------------------------> addse end   <------------------------------
>
> ------------------------------> deffu start <------------------------------
> #name : (defun ... (...) "..." ...)
> # --
> (defun ${1:Function Name} ($2)
>   "${3:Function document}"
>   $0)
> ------------------------------> deffu end   <------------------------------
>
> ------------------------------> defvr start <------------------------------
> #name : (defvar ... ... "...")
> # --
> (defvar ${1:variable-name} ${2:variable-varlue} "${0:document}")
> ------------------------------> defvr end   <------------------------------
>
> ------------------------------> evalal start <------------------------------
> #name : (eval-after-load ... ...)
> # --
> (eval-after-load ${1:file-name}
>   ${0:form})
> ------------------------------> evalal end   <------------------------------
>
> ------------------------------> header start <------------------------------
> #name : A elisp file header
> # --
> ;;; ${1:filename}.el --- ${2:Simple description}
>
> ;; Author: ${3:Andy Stewart} ${4:<lazycat.mana...@gmail.com>}
> ;; Maintainer: ${5:Andy Stewart} ${6:<lazycat.mana...@gmail.com>}
> ;; Copyright (C) 2008, $3, all rights reserved.
> ;; Created: ${7:Created time}
> ;; Version: ${8:Current version}
> ;; Last-Updated: ${9:Update time}
> ;; URL: ${10:not distributed yet}
> ;; Keywords: ${11:keyword}
> ;; Compatibility: GNU Emacs ${12:Compatibility version}
>
> ;; This program is free software; you can redistribute it and/or modify
> ;; it under the terms of the GNU General Public License as published by
> ;; the Free Software Foundation; either version 2, or (at your option)
> ;; any later version.
>
> ;; This program is distributed in the hope that it will be useful,
> ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
> ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> ;; GNU General Public License for more details.
>
> ;; You should have received a copy of the GNU General Public License
> ;; along with this program; see the file COPYING.  If not, write to
> ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
> ;; Floor, Boston, MA 02110-1301, USA.
>
> ;; Features that might be requried by this library:
> ;;
> ;;      ${13:None}
> ;;
>
> ;;; Installation:
> ;;
> ;; Copy $1.el to your load-path and add to your ~/.emacs
> ;;
> ;;      (require '$1)
> ;;
> ;; ${14:No need more}
>
> ;;; Commentary:
> ;;
> ;; ${15:Comment}
> ;;
>
> ;;; Change log:
> ;;      
> ;;      ${16:Chang log}
> ;;
>
> ;;; Acknowledgements:
> ;;
> ;; $17
> ;;
>
> ;;; TODO
> ;;
> ;; $18
> ;;
>
> ;;; Require
> $19
>
> ;;; Code:
>
> $0
>
> (provide '$1)
>
> ;;; $1.el ends here
> ------------------------------> header end   <------------------------------
>
> Enjoy!
>
> Andy.

Great!

Is it possible to change the way these are are triggered (the keys I
believe YAsnippet calls them)?

I would like yasnippet to trigger on the real uses of them. For
example

"(defmacro " + TAB
expands defmacro-statement.

Thanks in advance,
Nordlöw


  reply	other threads:[~2008-09-25  9:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-25  7:14 YAsnippet Emacs-Lisp Templates Nordlöw
2008-09-25  8:26 ` Andy Stewart
2008-09-25  9:39   ` Nordlöw [this message]
2008-09-25 10:53     ` Andy Stewart
2008-09-25 12:19     ` weber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=31d2385f-2763-4f49-832e-f5ff89e270ea@f63g2000hsf.googlegroups.com \
    --to=per.nordlow@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.