mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
Accept patch from dima.exe to add #key in template file (Issue 43)
This commit is contained in:
parent
6e6aa80b1c
commit
70191eb0d9
@ -6,9 +6,16 @@ ChangeLog
|
|||||||
:Contact: pluskid@gmail.com
|
:Contact: pluskid@gmail.com
|
||||||
:Date: 2008-03-22
|
:Date: 2008-03-22
|
||||||
|
|
||||||
0.5.7 /
|
0.5.7 / 2008-12-03
|
||||||
=================
|
==================
|
||||||
|
|
||||||
|
* Fixed `Issue 28
|
||||||
|
<http://code.google.com/p/yasnippet/issues/detail?id=28>`_ of
|
||||||
|
properly clean up snippet (by joaotavora).
|
||||||
|
* Added a new section "Field-level undo functionality" to correct
|
||||||
|
`Issue 33 <http://code.google.com/p/yasnippet/issues/detail?id=33>`_
|
||||||
|
(by joaotavora).
|
||||||
|
* Added some snippets from users for sql, erlang, scala, html, xml, latex, etc.
|
||||||
* Fixed `Issue 16
|
* Fixed `Issue 16
|
||||||
<http://code.google.com/p/yasnippet/issues/detail?id=16>`_ by adding
|
<http://code.google.com/p/yasnippet/issues/detail?id=16>`_ by adding
|
||||||
``$>`` support. Here's the `doc for $> indenting
|
``$>`` support. Here's the `doc for $> indenting
|
||||||
|
21
yasnippet.el
21
yasnippet.el
@ -3,7 +3,7 @@
|
|||||||
;; Copyright 2008 pluskid
|
;; Copyright 2008 pluskid
|
||||||
;;
|
;;
|
||||||
;; Author: pluskid <pluskid@gmail.com>
|
;; Author: pluskid <pluskid@gmail.com>
|
||||||
;; Version: 0.5.6
|
;; Version: 0.5.7
|
||||||
;; X-URL: http://code.google.com/p/yasnippet/
|
;; X-URL: http://code.google.com/p/yasnippet/
|
||||||
|
|
||||||
;; This file is free software; you can redistribute it and/or modify
|
;; This file is free software; you can redistribute it and/or modify
|
||||||
@ -188,7 +188,7 @@ to expand.
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Internal variables
|
;; Internal variables
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
(defvar yas/version "0.5.6")
|
(defvar yas/version "0.5.7")
|
||||||
|
|
||||||
(defvar yas/snippet-tables (make-hash-table)
|
(defvar yas/snippet-tables (make-hash-table)
|
||||||
"A hash table of snippet tables corresponding to each major-mode.")
|
"A hash table of snippet tables corresponding to each major-mode.")
|
||||||
@ -886,7 +886,7 @@ Here's a list of currently recognized variables:
|
|||||||
# --
|
# --
|
||||||
#include \"$1\""
|
#include \"$1\""
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(let ((name file-name) template bound condition)
|
(let ((name file-name) template bound condition key)
|
||||||
(if (re-search-forward "^# --\n" nil t)
|
(if (re-search-forward "^# --\n" nil t)
|
||||||
(progn (setq template
|
(progn (setq template
|
||||||
(buffer-substring-no-properties (point)
|
(buffer-substring-no-properties (point)
|
||||||
@ -897,10 +897,12 @@ Here's a list of currently recognized variables:
|
|||||||
(when (string= "name" (match-string-no-properties 1))
|
(when (string= "name" (match-string-no-properties 1))
|
||||||
(setq name (match-string-no-properties 2)))
|
(setq name (match-string-no-properties 2)))
|
||||||
(when (string= "condition" (match-string-no-properties 1))
|
(when (string= "condition" (match-string-no-properties 1))
|
||||||
(setq condition (read (match-string-no-properties 2))))))
|
(setq condition (read (match-string-no-properties 2))))
|
||||||
|
(when (string= "key" (match-string-no-properties 1))
|
||||||
|
(setq key (match-string-no-properties 2)))))
|
||||||
(setq template
|
(setq template
|
||||||
(buffer-substring-no-properties (point-min) (point-max))))
|
(buffer-substring-no-properties (point-min) (point-max))))
|
||||||
(list template name condition)))
|
(list key template name condition)))
|
||||||
|
|
||||||
(defun yas/directory-files (directory file?)
|
(defun yas/directory-files (directory file?)
|
||||||
"Return directory files or subdirectories in full path."
|
"Return directory files or subdirectories in full path."
|
||||||
@ -989,10 +991,11 @@ hierarchy."
|
|||||||
(dolist (file (yas/directory-files directory t))
|
(dolist (file (yas/directory-files directory t))
|
||||||
(when (file-readable-p file)
|
(when (file-readable-p file)
|
||||||
(insert-file-contents file nil nil nil t)
|
(insert-file-contents file nil nil nil t)
|
||||||
(let ((snippet-file-name (file-name-nondirectory file)))
|
(let* ((snip (yas/parse-template))
|
||||||
(push (cons snippet-file-name
|
(key (or (car snip)
|
||||||
(yas/parse-template snippet-file-name))
|
(file-name-nondirectory file)))
|
||||||
snippets)))))
|
(snip (cdr snip)))
|
||||||
|
(push (cons key snip) snippets)))))
|
||||||
(yas/define-snippets mode-sym
|
(yas/define-snippets mode-sym
|
||||||
snippets
|
snippets
|
||||||
parent)
|
parent)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user