Skip to content

Instantly share code, notes, and snippets.

@kiwanami
Created January 20, 2011 08:23
Show Gist options
  • Save kiwanami/787575 to your computer and use it in GitHub Desktop.
Save kiwanami/787575 to your computer and use it in GitHub Desktop.
yasnippets for emacs lisp
# name : defvar template
# group : defvar
# contributor : kiwanami
# --
(defvar ${1:`(save-excursion
(let ((re "(def\\\\(un\\\\|var\\\\)[ \t\n]*\\\\([a-z0-9]*[:-]\\\\)"))
(cond
((or
(re-search-backward re nil t)
(re-search-forward re nil t))
(match-string 2))
(t ""))))`}${2:var-name} ${3:value}$0
"$1$2.")
# name : defun template
# group : defun
# contributor : kiwanami
# --
(defun ${1:`(save-excursion
(let ((re "(def\\\\(un\\\\|var\\\\)[ \t\n]*\\\\([a-z0-9]*[:-]\\\\)"))
(cond
((or
(re-search-backward re nil t)
(re-search-forward re nil t))
(match-string 2))
(t ""))))`}${2:func-name} (${3:args})
"$2
${3:$(mapconcat 'upcase (split-string (replace-regexp-in-string "&[a-z]+" "" yas/text)) " \n")}"
$0
)
#name : let template
# --
(let (($0
#name : lexical-let template
# --
(lexical-let (($0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment